From: Eric Biggers Date: Mon, 10 Jun 2019 20:02:19 +0000 (-0700) Subject: cfg80211: fix memory leak of wiphy device name X-Git-Tag: v5.4-rc1~783^2~21^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f488fbca2a86cc7714a128952eead92cac279ab;p=platform%2Fkernel%2Flinux-rpi.git cfg80211: fix memory leak of wiphy device name 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 Signed-off-by: Johannes Berg --- diff --git a/net/wireless/core.c b/net/wireless/core.c index 4e83892..c58acca 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -513,7 +513,7 @@ use_default_name: &rdev->rfkill_ops, rdev); if (!rdev->rfkill) { - kfree(rdev); + wiphy_free(&rdev->wiphy); return NULL; }