]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
net: usb: fix possible use-after-free in smsc75xx_bind
authorDongliang Mu <mudongliangabcd@gmail.com>
Wed, 16 Jun 2021 02:48:33 +0000 (10:48 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:27:38 +0000 (19:27 +0200)
commit4fd10ae54804e137c0649fba9cc8615abb3fbad3
tree6c7b62f4de9ba37f202804e3f451106b69ae23cd
parentb8e642c5c9046dc002e07fe647aa2ffbb73c64d6
net: usb: fix possible use-after-free in smsc75xx_bind

BugLink: https://bugs.launchpad.net/bugs/1934179
[ Upstream commit 56b786d86694e079d8aad9b314e015cd4ac02a3d ]

The commit 46a8b29c6306 ("net: usb: fix memory leak in smsc75xx_bind")
fails to clean up the work scheduled in smsc75xx_reset->
smsc75xx_set_multicast, which leads to use-after-free if the work is
scheduled to start after the deallocation. In addition, this patch
also removes a dangling pointer - dev->data[0].

This patch calls cancel_work_sync to cancel the scheduled work and set
the dangling pointer to NULL.

Fixes: 46a8b29c6306 ("net: usb: fix memory leak in smsc75xx_bind")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/usb/smsc75xx.c