• Mao Wenan's avatar
    net: sit: fix memory leak in sit_init_net() · 07f12b26
    Mao Wenan authored
    If register_netdev() is failed to register sitn->fb_tunnel_dev,
    it will go to err_reg_dev and forget to free netdev(sitn->fb_tunnel_dev).
    
    BUG: memory leak
    unreferenced object 0xffff888378daad00 (size 512):
      comm "syz-executor.1", pid 4006, jiffies 4295121142 (age 16.115s)
      hex dump (first 32 bytes):
        00 e6 ed c0 83 88 ff ff 00 00 00 00 00 00 00 00  ................
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
        [<00000000d6dcb63e>] kvmalloc include/linux/mm.h:577 [inline]
        [<00000000d6dcb63e>] kvzalloc include/linux/mm.h:585 [inline]
        [<00000000d6dcb63e>] netif_alloc_netdev_queues net/core/dev.c:8380 [inline]
        [<00000000d6dcb63e>] alloc_netdev_mqs+0x600/0xcc0 net/core/dev.c:8970
        [<00000000867e172f>] sit_init_net+0x295/0xa40 net/ipv6/sit.c:1848
        [<00000000871019fa>] ops_init+0xad/0x3e0 net/core/net_namespace.c:129
        [<00000000319507f6>] setup_net+0x2ba/0x690 net/core/net_namespace.c:314
        [<0000000087db4f96>] copy_net_ns+0x1dc/0x330 net/core/net_namespace.c:437
        [<0000000057efc651>] create_new_namespaces+0x382/0x730 kernel/nsproxy.c:107
        [<00000000676f83de>] copy_namespaces+0x2ed/0x3d0 kernel/nsproxy.c:165
        [<0000000030b74bac>] copy_process.part.27+0x231e/0x6db0 kernel/fork.c:1919
        [<00000000fff78746>] copy_process kernel/fork.c:1713 [inline]
        [<00000000fff78746>] _do_fork+0x1bc/0xe90 kernel/fork.c:2224
        [<000000001c2e0d1c>] do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
        [<00000000ec48bd44>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
        [<0000000039acff8a>] 0xffffffffffffffff
    Signed-off-by: 's avatarMao Wenan <maowenan@huawei.com>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    07f12b26
Name
Last commit
Last update
..
6lowpan Loading commit data...
802 Loading commit data...
8021q Loading commit data...
9p Loading commit data...
appletalk Loading commit data...
atm Loading commit data...
ax25 Loading commit data...
batman-adv Loading commit data...
bluetooth Loading commit data...
bpf Loading commit data...
bpfilter Loading commit data...
bridge Loading commit data...
caif Loading commit data...
can Loading commit data...
ceph Loading commit data...
core Loading commit data...
dcb Loading commit data...
dccp Loading commit data...
decnet Loading commit data...
dns_resolver Loading commit data...
dsa Loading commit data...
ethernet Loading commit data...
hsr Loading commit data...
ieee802154 Loading commit data...
ife Loading commit data...
ipv4 Loading commit data...
ipv6 Loading commit data...
iucv Loading commit data...
kcm Loading commit data...
key Loading commit data...
l2tp Loading commit data...
l3mdev Loading commit data...
lapb Loading commit data...
llc Loading commit data...
mac80211 Loading commit data...
mac802154 Loading commit data...
mpls Loading commit data...
ncsi Loading commit data...
netfilter Loading commit data...
netlabel Loading commit data...
netlink Loading commit data...
netrom Loading commit data...
nfc Loading commit data...
nsh Loading commit data...
openvswitch Loading commit data...
packet Loading commit data...
phonet Loading commit data...
psample Loading commit data...
qrtr Loading commit data...
rds Loading commit data...
rfkill Loading commit data...
rose Loading commit data...
rxrpc Loading commit data...
sched Loading commit data...
sctp Loading commit data...
smc Loading commit data...
strparser Loading commit data...
sunrpc Loading commit data...
switchdev Loading commit data...
tipc Loading commit data...
tls Loading commit data...
unix Loading commit data...
vmw_vsock Loading commit data...
wimax Loading commit data...
wireless Loading commit data...
x25 Loading commit data...
xdp Loading commit data...
xfrm Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
compat.c Loading commit data...
socket.c Loading commit data...
sysctl_net.c Loading commit data...