Yang Yingliang
59ef9eb171
net: bridge: fix memleak in br_add_if()
...
[ Upstream commit 519133debcc19f5c834e7e28480b60bdc234fe02 ]
I got a memleak report:
BUG: memory leak
unreferenced object 0x607ee521a658 (size 240):
comm "syz-executor.0", pid 955, jiffies 4294780569 (age 16.449s)
hex dump (first 32 bytes, cpu 1):
00 00 00 00 00 00 00 00 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:
[<00000000d830ea5a>] br_multicast_add_port+0x1c2/0x300 net/bridge/br_multicast.c:1693
[<00000000274d9a71>] new_nbp net/bridge/br_if.c:435 [inline]
[<00000000274d9a71>] br_add_if+0x670/0x1740 net/bridge/br_if.c:611
[<0000000012ce888e>] do_set_master net/core/rtnetlink.c:2513 [inline]
[<0000000012ce888e>] do_set_master+0x1aa/0x210 net/core/rtnetlink.c:2487
[<0000000099d1cafc>] __rtnl_newlink+0x1095/0x13e0 net/core/rtnetlink.c:3457
[<00000000a01facc0>] rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3488
[<00000000acc9186c>] rtnetlink_rcv_msg+0x369/0xa10 net/core/rtnetlink.c:5550
[<00000000d4aabb9c>] netlink_rcv_skb+0x134/0x3d0 net/netlink/af_netlink.c:2504
[<00000000bc2e12a3>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
[<00000000bc2e12a3>] netlink_unicast+0x4a0/0x6a0 net/netlink/af_netlink.c:1340
[<00000000e4dc2d0e>] netlink_sendmsg+0x789/0xc70 net/netlink/af_netlink.c:1929
[<000000000d22c8b3>] sock_sendmsg_nosec net/socket.c:654 [inline]
[<000000000d22c8b3>] sock_sendmsg+0x139/0x170 net/socket.c:674
[<00000000e281417a>] ____sys_sendmsg+0x658/0x7d0 net/socket.c:2350
[<00000000237aa2ab>] ___sys_sendmsg+0xf8/0x170 net/socket.c:2404
[<000000004f2dc381>] __sys_sendmsg+0xd3/0x190 net/socket.c:2433
[<0000000005feca6c>] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:47
[<000000007304477d>] entry_SYSCALL_64_after_hwframe+0x44/0xae
On error path of br_add_if(), p->mcast_stats allocated in
new_nbp() need be freed, or it will be leaked.
Fixes: 1080ab95e3c7 ("net: bridge: add support for IGMP/MLD stats and export them via netlink")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Link: https://lore.kernel.org/r/20210809132023.978546-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-26 08:37:22 -04:00
..
2020-01-29 10:24:22 +01:00
2020-11-10 10:23:54 +01:00
2021-08-04 11:58:02 +02:00
2020-01-12 11:24:27 +01:00
2021-04-07 12:05:39 +02:00
2020-10-01 20:40:12 +02:00
2020-07-31 16:44:06 +02:00
2021-06-30 08:49:13 -04:00
2021-08-15 13:01:02 +02:00
2021-08-26 08:37:22 -04:00
2021-07-28 09:14:27 +02:00
2021-08-08 08:38:54 +02:00
2020-11-10 10:23:59 +01:00
2021-08-08 08:38:53 +02:00
2021-01-23 15:38:18 +01:00
2021-04-07 12:05:38 +02:00
2021-07-28 09:14:27 +02:00
2018-07-22 14:27:39 +02:00
2020-04-13 10:32:53 +02:00
2020-01-12 11:24:19 +01:00
2021-05-22 10:40:20 +02:00
2021-08-26 08:37:22 -04:00
2021-07-28 09:14:26 +02:00
2021-07-28 09:14:26 +02:00
2017-05-25 15:44:41 +02:00
2018-09-15 09:43:01 +02:00
2020-12-11 13:37:56 +01:00
2019-04-17 08:36:44 +02:00
2021-02-23 13:59:14 +01:00
2021-01-09 13:35:49 +01:00
2016-09-10 23:12:53 -07:00
2021-02-10 09:09:25 +01:00
2021-08-04 11:58:03 +02:00
2021-07-20 16:21:09 +02:00
2021-04-16 11:59:10 +02:00
2021-03-17 16:10:13 +01:00
2021-01-12 19:49:01 +01:00
2021-08-04 11:58:03 +02:00
2021-07-20 16:21:02 +02:00
2021-06-16 11:36:33 +02:00
2021-07-28 09:14:27 +02:00
2021-06-16 11:36:32 +02:00
2021-05-22 10:40:19 +02:00
2021-06-30 08:49:20 -04:00
2019-03-23 13:19:44 +01:00
2021-03-30 14:41:42 +02:00
2021-06-30 08:49:13 -04:00
2020-01-12 11:24:23 +01:00
2020-12-11 13:37:56 +01:00
2021-01-23 15:38:19 +01:00
2021-07-20 16:21:03 +02:00
2021-08-04 11:58:02 +02:00
2018-04-29 11:32:02 +02:00
2021-07-20 16:20:57 +02:00
2016-10-19 10:58:04 -04:00
2021-08-04 11:58:03 +02:00
2021-08-04 11:58:01 +02:00
2021-05-22 10:40:28 +02:00
2021-08-04 11:58:03 +02:00
2021-06-30 08:49:12 -04:00
2021-07-20 16:21:07 +02:00
2021-06-30 08:49:12 -04:00
2021-08-04 11:58:01 +02:00
2020-08-21 11:02:04 +02:00
2016-10-06 09:52:23 -07:00