]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Drivers: hv: vmbus: Use after free in __vmbus_open()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 13 Apr 2021 10:50:04 +0000 (13:50 +0300)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:27 +0000 (17:46 -0600)
BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit 3e9bf43f7f7a46f21ec071cb47be92d0874c48da ]

The "open_info" variable is added to the &vmbus_connection.chn_msg_list,
but the error handling frees "open_info" without removing it from the
list.  This will result in a use after free.  First remove it from the
list, and then free it.

Fixes: 6f3d791f3006 ("Drivers: hv: vmbus: Fix rescind handling issues")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/YHV3XLCot6xBS44r@mwanda
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/hv/channel.c

index 6fb0c76bfbf813bc62748541a42016393e48acf8..a59ab2f3d68e1a7fa19efaed059e9a5de37b129e 100644 (file)
@@ -653,7 +653,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel,
 
        if (newchannel->rescind) {
                err = -ENODEV;
-               goto error_free_info;
+               goto error_clean_msglist;
        }
 
        err = vmbus_post_msg(open_msg,