[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_N-2R49jeftB3_+pKeQ_51WE9RW3iZ6=q-q62Lc6eMOJg@mail.gmail.com>
Date: Wed, 27 Aug 2014 15:01:42 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: Dave Airlie <airlied@...ux.ie>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm: Test for PCI root bus to avoid NULL pointer dereference
On Wed, Aug 27, 2014 at 2:57 PM, Alex Williamson
<alex.williamson@...hat.com> wrote:
> If we have a GPU on the PCI root bus that calls
> drm_pcie_get_speed_cap_mask() we end up with a NULL pointer
> dereference since pdev->bus->self is NULL. We already protect
> against callers passing non-PCI devices, so let's also catch this
> case and return -EINVAL.
>
> Root complex graphics are not terribly likely outside of IGD, but
> when we assign a standard plugin GPU to a virtual machine, our
> assumption that we have a parent device quickly becomes invalid.
>
> Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
Reviewed-by: Alex Deucher <alexander.deucher@....com>
> ---
>
> drivers/gpu/drm/drm_pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 020cfd9..411e806 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -390,7 +390,7 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
> u32 lnkcap, lnkcap2;
>
> *mask = 0;
> - if (!dev->pdev)
> + if (!dev->pdev || pci_is_root_bus(dev->pdev->bus))
> return -EINVAL;
>
> root = dev->pdev->bus->self;
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists