Skip to content

Commit e4f1861

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: [email protected] Fixes: 1f87f7d ("cfg80211: add rfkill support") Cc: [email protected] Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 68d1e28 commit e4f1861

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/wireless/core.c

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

480480
if (!rdev->rfkill) {
481-
kfree(rdev);
481+
wiphy_free(&rdev->wiphy);
482482
return NULL;
483483
}
484484

0 commit comments

Comments
 (0)