]>
Commit | Line | Data |
---|---|---|
bb48b19a GKH |
1 | From 4f488fbca2a86cc7714a128952eead92cac279ab Mon Sep 17 00:00:00 2001 |
2 | From: Eric Biggers <ebiggers@google.com> | |
3 | Date: Mon, 10 Jun 2019 13:02:19 -0700 | |
4 | Subject: cfg80211: fix memory leak of wiphy device name | |
5 | ||
6 | From: Eric Biggers <ebiggers@google.com> | |
7 | ||
8 | commit 4f488fbca2a86cc7714a128952eead92cac279ab upstream. | |
9 | ||
10 | In wiphy_new_nm(), if an error occurs after dev_set_name() and | |
11 | device_initialize() have already been called, it's necessary to call | |
12 | put_device() (via wiphy_free()) to avoid a memory leak. | |
13 | ||
14 | Reported-by: syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com | |
15 | Fixes: 1f87f7d3a3b4 ("cfg80211: add rfkill support") | |
16 | Cc: stable@vger.kernel.org | |
17 | Signed-off-by: Eric Biggers <ebiggers@google.com> | |
18 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | net/wireless/core.c | 2 +- | |
23 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
24 | ||
25 | --- a/net/wireless/core.c | |
26 | +++ b/net/wireless/core.c | |
27 | @@ -498,7 +498,7 @@ use_default_name: | |
28 | &rdev->rfkill_ops, rdev); | |
29 | ||
30 | if (!rdev->rfkill) { | |
31 | - kfree(rdev); | |
32 | + wiphy_free(&rdev->wiphy); | |
33 | return NULL; | |
34 | } | |
35 |