* memory leak in kobject_set_name_vargs
@ 2019-05-29 16:28 syzbot
2019-06-10 20:02 ` [PATCH] cfg80211: fix memory leak of wiphy device name Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2019-05-29 16:28 UTC (permalink / raw)
To: gregkh, linux-kernel, rafael, syzkaller-bugs
Hello,
syzbot found the following crash on:
HEAD commit: 9fb67d64 Merge tag 'pinctrl-v5.2-2' of git://git.kernel.or..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11929a5ca00000
kernel config: https://syzkaller.appspot.com/x/.config?x=64479170dcaf0e11
dashboard link: https://syzkaller.appspot.com/bug?extid=7fddca22578bc67c3fe4
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1260e44aa00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13014582a00000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com
ffffffffda RBX: 0000000000000003 RCX: 00000000004426c9
BUG: memory leak
unreferenced object 0xffff88811d8a84e0 (size 32):
comm "syz-executor542", pid 6993, jiffies 4294943975 (age 8.330s)
hex dump (first 32 bytes):
70 68 79 33 00 74 61 73 6b 2f 36 39 39 33 00 de phy3.task/6993..
33 33 ff aa aa 28 00 00 00 00 00 00 00 00 00 00 33...(..........
backtrace:
[<000000007298dac3>] kmemleak_alloc_recursive
include/linux/kmemleak.h:55 [inline]
[<000000007298dac3>] slab_post_alloc_hook mm/slab.h:439 [inline]
[<000000007298dac3>] slab_alloc mm/slab.c:3326 [inline]
[<000000007298dac3>] __do_kmalloc mm/slab.c:3658 [inline]
[<000000007298dac3>] __kmalloc_track_caller+0x15d/0x2c0 mm/slab.c:3675
[<000000002d35f1ca>] kvasprintf+0x6d/0xe0 lib/kasprintf.c:25
[<00000000a242e8c2>] kvasprintf_const+0x96/0xe0 lib/kasprintf.c:49
[<000000009923ecab>] kobject_set_name_vargs+0x40/0xe0 lib/kobject.c:289
[<0000000031da656f>] dev_set_name+0x63/0x90 drivers/base/core.c:1915
[<00000000cb933060>] wiphy_new_nm+0x2d9/0x820 net/wireless/core.c:470
[<00000000fe076c30>] ieee80211_alloc_hw_nm+0x158/0x770
net/mac80211/main.c:551
[<000000002d397aa1>] mac80211_hwsim_new_radio+0xad/0x1150
drivers/net/wireless/mac80211_hwsim.c:2655
[<00000000de4d0f50>] hwsim_new_radio_nl+0x369/0x50a
drivers/net/wireless/mac80211_hwsim.c:3490
[<00000000c2565b18>] genl_family_rcv_msg+0x2ab/0x5b0
net/netlink/genetlink.c:629
[<00000000dbd164a1>] genl_rcv_msg+0x54/0x9c net/netlink/genetlink.c:654
[<00000000cfe4f152>] netlink_rcv_skb+0x61/0x170
net/netlink/af_netlink.c:2486
[<000000001803b485>] genl_rcv+0x29/0x40 net/netlink/genetlink.c:665
[<000000008f236552>] netlink_unicast_kernel
net/netlink/af_netlink.c:1311 [inline]
[<000000008f236552>] netlink_unicast+0x1ec/0x2d0
net/netlink/af_netlink.c:1337
[<0000000030d22a07>] netlink_sendmsg+0x26a/0x480
net/netlink/af_netlink.c:1926
[<00000000b09b44f1>] sock_sendmsg_nosec net/socket.c:652 [inline]
[<00000000b09b44f1>] sock_sendmsg+0x54/0x70 net/socket.c:671
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] cfg80211: fix memory leak of wiphy device name
2019-05-29 16:28 memory leak in kobject_set_name_vargs syzbot
@ 2019-06-10 20:02 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2019-06-10 20:02 UTC (permalink / raw)
To: linux-wireless, Johannes Berg
Cc: gregkh, linux-kernel, rafael, syzkaller-bugs
From: Eric Biggers <ebiggers@google.com>
In wiphy_new_nm(), if an error occurs after dev_set_name() and
device_initialize() have already been called, it's necessary to call
put_device() (via wiphy_free()) to avoid a memory leak.
Reported-by: syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com
Fixes: 1f87f7d3a3b4 ("cfg80211: add rfkill support")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
net/wireless/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 037816163e70d..458f5e0906875 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -514,7 +514,7 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
&rdev->rfkill_ops, rdev);
if (!rdev->rfkill) {
- kfree(rdev);
+ wiphy_free(&rdev->wiphy);
return NULL;
}
--
2.22.0.rc2.383.gf4fbbf30c2-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-10 20:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 16:28 memory leak in kobject_set_name_vargs syzbot
2019-06-10 20:02 ` [PATCH] cfg80211: fix memory leak of wiphy device name Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).