[RFC 1/4] bus/pci: fix check on interrupt FD for FreeBSD

David Marchand david.marchand at redhat.com
Thu Jul 23 15:54:21 CEST 2026


On Thu, 23 Jul 2026 at 15:35, Bruce Richardson
<bruce.richardson at intel.com> wrote:
>
> On Thu, Jul 23, 2026 at 03:19:04PM +0200, David Marchand wrote:
> > A 0 file descriptor is valid. And a negative value is not.
> > Only close a positive file descriptor.
> >
> > Fixes: 5a60a7ffc801 ("pci: introduce functions to alloc and free uio resource")
> >
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
> > ---
> >  drivers/bus/pci/bsd/pci.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
> > index c6df31d486..bbe08605af 100644
> > --- a/drivers/bus/pci/bsd/pci.c
> > +++ b/drivers/bus/pci/bsd/pci.c
> > @@ -93,7 +93,7 @@ pci_uio_free_resource(struct rte_pci_device *dev,
> >  {
> >       rte_free(uio_res);
> >
> > -     if (rte_intr_fd_get(dev->intr_handle)) {
> > +     if (rte_intr_fd_get(dev->intr_handle) >= 0) {
> >               close(rte_intr_fd_get(dev->intr_handle));
> >               rte_intr_fd_set(dev->intr_handle, -1);
> >               rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_UNKNOWN);
>
> Unlikely that we actually have fd as 0 for this call, but change is
> technically correct.

Yes, this is why I did not Cc: stable.
Thanks.


-- 
David Marchand



More information about the dev mailing list