Skip to content

Commit

Permalink
staging: brcm80211: fix potential null pointer access handling ucode …
Browse files Browse the repository at this point in the history
…buffer

Allocation of buffer in function wl_ucode_init_buf can fail. This was
signalled by an error message, but code continued to access the null
pointer. This is now avoided by jumping to failure label.

Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Brett Rudley <brudley@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Arend van Spriel authored and Greg Kroah-Hartman committed Feb 18, 2011
1 parent 0bef774 commit 8746e2b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx)
if (*pbuf == NULL) {
WL_ERROR("fail to alloc %d bytes\n",
hdr->len);
goto fail;
}
bcopy(pdata, *pbuf, hdr->len);
return 0;
Expand All @@ -1715,6 +1716,7 @@ int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx)
}
WL_ERROR("ERROR: ucode buf tag:%d can not be found!\n", idx);
*pbuf = NULL;
fail:
return -1;
}

Expand Down

0 comments on commit 8746e2b

Please sign in to comment.