From: Arend van Spriel <arend@broadcom.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Arend van Spriel <arend@broadcom.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
Pontus Fuchs <pontusf@broadcom.com>
Subject: Re: [PATCH] brcmfmac: Perform bound checking on vendor command buffer
Date: Fri, 6 Mar 2015 16:20:24 +0100 [thread overview]
Message-ID: <54F9C5B8.9080004@broadcom.com> (raw)
In-Reply-To: <1425655123-18916-1-git-send-email-arend@broadcom.com>
On 03/06/15 16:18, Arend van Spriel wrote:
> From: Pontus Fuchs<pontusf@broadcom.com>
>
> A short or malformed vendor command buffer could cause reads outside
> the command buffer.
>
> Cc: stable@vger.kernel.org # v3.19
> Signed-off-by: Pontus Fuchs<pontusf@broadcom.com>
> [arend@broadcom.com: slightly modified debug trace output]
> Signed-off-by: Arend van Spriel<arend@broadcom.com>
> ---
Hi Kalle,
Forgot to mention this is for v4.0 kernel.
Regards,
Arend
> drivers/net/wireless/brcm80211/brcmfmac/vendor.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c
> index 50cdf70..8eff275 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c
> @@ -39,13 +39,22 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy,
> void *dcmd_buf = NULL, *wr_pointer;
> u16 msglen, maxmsglen = PAGE_SIZE - 0x100;
>
> - brcmf_dbg(TRACE, "cmd %x set %d len %d\n", cmdhdr->cmd, cmdhdr->set,
> - cmdhdr->len);
> + if (len< sizeof(*cmdhdr)) {
> + brcmf_err("vendor command too short: %d\n", len);
> + return -EINVAL;
> + }
>
> vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
> ifp = vif->ifp;
>
> - len -= sizeof(struct brcmf_vndr_dcmd_hdr);
> + brcmf_dbg(TRACE, "ifidx=%d, cmd=%d\n", ifp->ifidx, cmdhdr->cmd);
> +
> + if (cmdhdr->offset> len) {
> + brcmf_err("bad buffer offset %d> %d\n", cmdhdr->offset, len);
> + return -EINVAL;
> + }
> +
> + len -= cmdhdr->offset;
> ret_len = cmdhdr->len;
> if (ret_len> 0 || len> 0) {
> if (len> BRCMF_DCMD_MAXLEN) {
next prev parent reply other threads:[~2015-03-06 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 15:18 [PATCH] brcmfmac: Perform bound checking on vendor command buffer Arend van Spriel
2015-03-06 15:20 ` Arend van Spriel [this message]
2015-03-07 8:54 ` Kalle Valo
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=54F9C5B8.9080004@broadcom.com \
--to=arend@broadcom.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pontusf@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.