Linux virtualization list
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Pavel Machek <pavel@denx.de>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org,
	Xie Yongji <xieyongji@bytedance.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 4.4 08/31] drm/virtio: Fixes a potential NULL pointer dereference on probe failure
Date: Wed, 14 Jul 2021 12:49:18 -0400	[thread overview]
Message-ID: <YO8VjgdgHXoAcOMY@sashalap> (raw)
In-Reply-To: <20210712215937.GA9488@amd>

On Mon, Jul 12, 2021 at 11:59:37PM +0200, Pavel Machek wrote:
>Hi!
>
>> From: Xie Yongji <xieyongji@bytedance.com>
>>
>> [ Upstream commit 17f46f488a5d82c5568e6e786cd760bba1c2ee09 ]
>>
>> The dev->dev_private might not be allocated if virtio_gpu_pci_quirk()
>> or virtio_gpu_init() failed. In this case, we should avoid the cleanup
>> in virtio_gpu_release().
>
>The check is in wrong place at least in 4.4:
>
>> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
>> @@ -257,6 +257,9 @@ int virtio_gpu_driver_unload(struct drm_device *dev)
>>  	flush_work(&vgdev->config_changed_work);
>>  	vgdev->vdev->config->del_vqs(vgdev->vdev);
>>
>> +	if (!vgdev)
>> +		return;
>> +
>
>Pointer is dereferenced before being tested.

Heh, yes, thanks for catching that. I'll drop it for now and rework it
next week.

-- 
Thanks,
Sasha
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-07-14 16:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210706112931.2066397-1-sashal@kernel.org>
2021-07-06 11:29 ` [PATCH AUTOSEL 4.4 08/31] drm/virtio: Fixes a potential NULL pointer dereference on probe failure Sasha Levin
     [not found]   ` <20210712215937.GA9488@amd>
2021-07-14 16:49     ` Sasha Levin [this message]
2021-07-06 11:29 ` [PATCH AUTOSEL 4.4 09/31] drm/virtio: Fix double free " Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YO8VjgdgHXoAcOMY@sashalap \
    --to=sashal@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@denx.de \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox