Commit 2420c3f5 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Luo Gengkun
Browse files

net: usb: fix memory leak in smsc75xx_bind

mainline inclusion
from mainline-v5.13-rc4
commit 46a8b29c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9BHNM
CVE: CVE-2021-47171

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46a8b29c6306d8bbfd92b614ef65a47c900d8e70



--------------------------------

Syzbot reported memory leak in smsc75xx_bind().
The problem was is non-freed memory in case of
errors after memory allocation.

backtrace:
  [<ffffffff84245b62>] kmalloc include/linux/slab.h:556 [inline]
  [<ffffffff84245b62>] kzalloc include/linux/slab.h:686 [inline]
  [<ffffffff84245b62>] smsc75xx_bind+0x7a/0x334 drivers/net/usb/smsc75xx.c:1460
  [<ffffffff82b5b2e6>] usbnet_probe+0x3b6/0xc30 drivers/net/usb/usbnet.c:1728

Fixes: d0cad871 ("smsc75xx: SMSC LAN75xx USB gigabit ethernet adapter driver")
Cc: stable@kernel.vger.org
Reported-and-tested-by: default avatar <syzbot+b558506ba8165425fee2@syzkaller.appspotmail.com>
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLuo Gengkun <luogengkun2@huawei.com>
parent 4bb88ba3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment