linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: linux-wireless@vger.kernel.org, pkshih@realtek.com,
	Stable <stable@vger.kernel.org>
Subject: Re: [PATCH V2] rtlwifi: rtl_pci: Fix problem of too small skb->len
Date: Sun, 20 Oct 2019 11:28:14 +0300	[thread overview]
Message-ID: <874l03lt29.fsf@codeaurora.org> (raw)
In-Reply-To: <20191020011153.29383-1-Larry.Finger@lwfinger.net> (Larry Finger's message of "Sat, 19 Oct 2019 20:11:53 -0500")

Larry Finger <Larry.Finger@lwfinger.net> writes:

> In commit 8020919a9b99 ("mac80211: Properly handle SKB with radiotap
> only"), buffers whose length is too short cause a WARN_ON(1) to be
> executed. This change exposed a fault in rtlwifi drivers, which is fixed
> by increasing the length of the affected buffer before it is sent to
> mac80211.

With what frames, or in what scenarios, do you get these warnings?

> Cc: Stable <stable@vger.kernel.org> # v5.0+
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> V2 - added missing usage of new len
> ---
> Please Apply to 5.4
> ---
>  drivers/net/wireless/realtek/rtlwifi/pci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
> index 6087ec7a90a6..3e9185162e51 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
> @@ -692,12 +692,15 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw,
>  		dev_kfree_skb_any(skb);
>  	} else {
>  		struct sk_buff *uskb = NULL;
> +		int len = skb->len;
>  
> +		if (unlikely(len <= FCS_LEN))
> +			len = FCS_LEN + 2;

I don't understand this change, I think this needs a comment in the
code, or better yet a proper define documenting the meaning of the
value. What does these two bytes contain? Or are you just working around
the mac80211 warning by increasing the length with a random value you
chose?

-- 
Kalle Valo

  reply	other threads:[~2019-10-20  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20  1:11 [PATCH V2] rtlwifi: rtl_pci: Fix problem of too small skb->len Larry Finger
2019-10-20  8:28 ` Kalle Valo [this message]
2019-10-20 20:13   ` Larry Finger

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=874l03lt29.fsf@codeaurora.org \
    --to=kvalo@codeaurora.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).