[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MW2PR2101MB1052402E702FC16A342E048FD7CF1@MW2PR2101MB1052.namprd21.prod.outlook.com>
Date: Sun, 6 Dec 2020 17:23:10 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: "Andrea Parri (Microsoft)" <parri.andrea@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
Juan Vazquez <juvazq@...rosoft.com>,
Saruhan Karademir <skarade@...rosoft.com>
Subject: RE: [PATCH 4/6] Drivers: hv: vmbus: Avoid use-after-free in
vmbus_onoffer_rescind()
From: Andrea Parri (Microsoft) <parri.andrea@...il.com> Sent: Wednesday, November 18, 2020 6:37 AM
>
> When channel->device_obj is non-NULL, vmbus_onoffer_rescind() could
> invoke put_device(), that will eventually release the device and free
> the channel object (cf. vmbus_device_release()). However, a pointer
> to the object is dereferenced again later to load the primary_channel.
> The use-after-free can be avoided by noticing that this load/check is
> redundant if device_obk is non-NULL: primary_channel must be NULL if
> device_obj is non-NULL, cf. vmbus_add_channel_work().
>
> Reported-by: Juan Vazquez <juvazq@...rosoft.com>
> Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@...il.com>
> ---
> drivers/hv/channel_mgmt.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index 5bc5eef5da159..4072fd1f22146 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -1116,8 +1116,7 @@ static void vmbus_onoffer_rescind(struct
> vmbus_channel_message_header *hdr)
> vmbus_device_unregister(channel->device_obj);
> put_device(dev);
> }
> - }
> - if (channel->primary_channel != NULL) {
> + } else if (channel->primary_channel != NULL) {
> /*
> * Sub-channel is being rescinded. Following is the channel
> * close sequence when initiated from the driveri (refer to
> --
> 2.25.1
Taking into the account the separate comments from Wei Liu,
Reviewed-by: Michael Kelley <mikelley@...rosoft.com>
Powered by blists - more mailing lists