Linux wireless drivers development
 help / color / mirror / Atom feed
From: Arend van Spriel <arend@broadcom.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Brett Rudley <brudley@broadcom.com>
Cc: "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: Re: [patch] brcmsmac: NULL dereferences in brcms_c_detach_mfree()
Date: Fri, 28 Nov 2014 11:08:14 +0100	[thread overview]
Message-ID: <5478498E.3070508@broadcom.com> (raw)
In-Reply-To: <20141128094340.GA10364@mwanda>

On 28-11-14 10:43, Dan Carpenter wrote:
> 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.  :)

Thanks for the patch+bonus

Acked-by: Arend van Spriel <arend@broadcom.com>
> 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)
> 


      reply	other threads:[~2014-11-28 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  9:43 [patch] brcmsmac: NULL dereferences in brcms_c_detach_mfree() Dan Carpenter
2014-11-28 10:08 ` Arend van Spriel [this message]

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=5478498E.3070508@broadcom.com \
    --to=arend@broadcom.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=brudley@broadcom.com \
    --cc=dan.carpenter@oracle.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