Skip to content

Commit 17d941d

Browse files
ebiggersgregkh
authored andcommitted
cfg80211: fix memory leak of wiphy device name
commit 4f488fb upstream. 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: 1f87f7d ("cfg80211: add rfkill support") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5293c79 commit 17d941d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/wireless/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
498498
&rdev->rfkill_ops, rdev);
499499

500500
if (!rdev->rfkill) {
501-
kfree(rdev);
501+
wiphy_free(&rdev->wiphy);
502502
return NULL;
503503
}
504504

0 commit comments

Comments
 (0)