All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Avinash Patil <patila@marvell.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Amitkumar Karwar <akarwar@marvell.com>,
	Xinming Hu <huxm@marvell.com>, Marc Yang <yangyang@marvell.com>
Subject: Re: [PATCH 1/4] mwifiex: avoid processing RX packets with invalid length
Date: Thu, 28 Aug 2014 14:40:36 -0400	[thread overview]
Message-ID: <20140828184036.GO13758@tuxdriver.com> (raw)
In-Reply-To: <CBACCFA0AEB13A41977475BCF3E896FC4781147C21@SC-VEXCH2.marvell.com>

This patch does not apply...

On Mon, Aug 18, 2014 at 02:07:10AM -0700, Avinash Patil wrote:
> If rx_len received in interface header from FW is more than
> RX buffer size, skb_put for such length results into skb_panic.
> Avoid this by not processing such packets. We just print a warning
> for such packets and free skb.
> 
> Reviewed-by: Paul Stewart <pstew@chromium.org>
> Signed-off-by: Avinash Patil <patila@marvell.com>
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
> Signed-off-by: Bing Zhao <bzhao@marvell.com>
> Signed-off-by: Marc Yang <yangyang@marvell.com>
> ---
>  drivers/net/wireless/mwifiex/pcie.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
> index c16dd2c..fbb0550 100644
> --- a/drivers/net/wireless/mwifiex/pcie.c
> +++ b/drivers/net/wireless/mwifiex/pcie.c
> @@ -1271,12 +1271,20 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
>                  */
>                 pkt_len = *((__le16 *)skb_data->data);
>                 rx_len = le16_to_cpu(pkt_len);
> -               skb_put(skb_data, rx_len);
> -               dev_dbg(adapter->dev,
> -                       "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n",
> -                       card->rxbd_rdptr, wrptr, rx_len);
> -               skb_pull(skb_data, INTF_HEADER_LEN);
> -               mwifiex_handle_rx_packet(adapter, skb_data);
> +               if (WARN_ON(rx_len <= INTF_HEADER_LEN ||
> +                           rx_len > MWIFIEX_RX_DATA_BUF_SIZE)) {
> +                       dev_err(adapter->dev,
> +                               "Invalid RX len %d, Rd=%#x, Wr=%#x\n",
> +                               rx_len, card->rxbd_rdptr, wrptr);
> +                       dev_kfree_skb_any(skb_data);
> +               } else {
> +                       skb_put(skb_data, rx_len);
> +                       dev_dbg(adapter->dev,
> +                               "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n",
> +                               card->rxbd_rdptr, wrptr, rx_len);
> +                       skb_pull(skb_data, INTF_HEADER_LEN);
> +                       mwifiex_handle_rx_packet(adapter, skb_data);
> +               }
> 
>                 skb_tmp = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE);
>                 if (!skb_tmp) {
> -- 
> 1.8.1.4
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

      reply	other threads:[~2014-08-28 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18  9:07 [PATCH 1/4] mwifiex: avoid processing RX packets with invalid length Avinash Patil
2014-08-28 18:40 ` John W. Linville [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=20140828184036.GO13758@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=akarwar@marvell.com \
    --cc=huxm@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=patila@marvell.com \
    --cc=yangyang@marvell.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.