From: Dan Carpenter <dan.carpenter@oracle.com>
To: Brett Rudley <brudley@broadcom.com>
Cc: "Arend van Spriel" <arend@broadcom.com>,
"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
"Hante Meuleman" <meuleman@broadcom.com>,
"John W. Linville" <linville@tuxdriver.com>,
"Julia Lawall" <Julia.Lawall@lip6.fr>,
"Pieter-Paul Giesberts" <pieterpg@broadcom.com>,
"Markus Elfring" <elfring@users.sourceforge.net>,
"Rafał Miłecki" <zajec5@gmail.com>,
linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com,
kernel-janitors@vger.kernel.org
Subject: [patch] brcmsmac: NULL dereferences in brcms_c_detach_mfree()
Date: Fri, 28 Nov 2014 12:43:40 +0300 [thread overview]
Message-ID: <20141128094340.GA10364@mwanda> (raw)
The brcms_c_attach_malloc() function can call this with a NULL
"wlc->corestate" or "wlc->hw".
Also I threw in a bonus cleanup by deleting an obvious comment and a
no-op NULL assignment. :)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 738cfac..a104d7a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -445,18 +445,18 @@ static void brcms_c_detach_mfree(struct brcms_c_info *wlc)
kfree(wlc->protection);
kfree(wlc->stf);
kfree(wlc->bandstate[0]);
- kfree(wlc->corestate->macstat_snapshot);
+ if (wlc->corestate)
+ kfree(wlc->corestate->macstat_snapshot);
kfree(wlc->corestate);
- kfree(wlc->hw->bandstate[0]);
+ if (wlc->hw)
+ kfree(wlc->hw->bandstate[0]);
kfree(wlc->hw);
if (wlc->beacon)
dev_kfree_skb_any(wlc->beacon);
if (wlc->probe_resp)
dev_kfree_skb_any(wlc->probe_resp);
- /* free the wlc */
kfree(wlc);
- wlc = NULL;
}
static struct brcms_bss_cfg *brcms_c_bsscfg_malloc(uint unit)
next reply other threads:[~2014-11-28 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 9:43 Dan Carpenter [this message]
2014-11-28 10:08 ` [patch] brcmsmac: NULL dereferences in brcms_c_detach_mfree() Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141128094340.GA10364@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Julia.Lawall@lip6.fr \
--cc=arend@broadcom.com \
--cc=brcm80211-dev-list@broadcom.com \
--cc=brudley@broadcom.com \
--cc=elfring@users.sourceforge.net \
--cc=frankyl@broadcom.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=meuleman@broadcom.com \
--cc=pieterpg@broadcom.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox