All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: rtl_pci: Fix problem of too small skb->len
@ 2019-10-19 19:02 Larry Finger
  2019-10-19 22:23 ` ian.schram
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2019-10-19 19:02 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, pkshih, Larry Finger, Stable

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.

Cc: Stable <stable@vger.kernel.org> # v5.0+
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Kalle,

Please send to v5.4.

Larry
---

 drivers/net/wireless/realtek/rtlwifi/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 6087ec7a90a6..bb5144b7c64f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -692,7 +692,10 @@ 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;
 		uskb = dev_alloc_skb(skb->len + 128);
 		if (likely(uskb)) {
 			memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtlwifi: rtl_pci: Fix problem of too small skb->len
  2019-10-19 19:02 [PATCH] rtlwifi: rtl_pci: Fix problem of too small skb->len Larry Finger
@ 2019-10-19 22:23 ` ian.schram
  2019-10-20  1:13   ` Larry Finger
  0 siblings, 1 reply; 3+ messages in thread
From: ian.schram @ 2019-10-19 22:23 UTC (permalink / raw)
  To: Larry Finger, kvalo; +Cc: linux-wireless, pkshih, Stable

Hi,


This patch doesn't appear to do anything? The increased length is not actually
used, is a part of the patch missing?


ps: superficial reading, i am not hampered by any specific knowledge of this driver.

On 2019-10-19 21:02, Larry Finger wrote:
> 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.
> 
> Cc: Stable <stable@vger.kernel.org> # v5.0+
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> 
> Kalle,
> 
> Please send to v5.4.
> 
> Larry
> ---
> 
>   drivers/net/wireless/realtek/rtlwifi/pci.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
> index 6087ec7a90a6..bb5144b7c64f 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
> @@ -692,7 +692,10 @@ 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;
>   		uskb = dev_alloc_skb(skb->len + 128);
>   		if (likely(uskb)) {
>   			memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtlwifi: rtl_pci: Fix problem of too small skb->len
  2019-10-19 22:23 ` ian.schram
@ 2019-10-20  1:13   ` Larry Finger
  0 siblings, 0 replies; 3+ messages in thread
From: Larry Finger @ 2019-10-20  1:13 UTC (permalink / raw)
  To: ian.schram, kvalo; +Cc: linux-wireless, pkshih, Stable

On 10/19/19 5:23 PM, ian.schram wrote:
> Hi,
> 
> 
> This patch doesn't appear to do anything? The increased length is not actually
> used, is a part of the patch missing?
> 
> 
> ps: superficial reading, i am not hampered by any specific knowledge of this 
> driver.
> 
> On 2019-10-19 21:02, Larry Finger wrote:
>> 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.
>>
>> Cc: Stable <stable@vger.kernel.org> # v5.0+
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> ---
>>
>> Kalle,
>>
>> Please send to v5.4.
>>
>> Larry
>> ---
>>
>>   drivers/net/wireless/realtek/rtlwifi/pci.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c 
>> b/drivers/net/wireless/realtek/rtlwifi/pci.c
>> index 6087ec7a90a6..bb5144b7c64f 100644
>> --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
>> @@ -692,7 +692,10 @@ 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;
>>           uskb = dev_alloc_skb(skb->len + 128);
>>           if (likely(uskb)) {
>>               memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status,
>>

Ian,

Yes, I debugged using a different tree and missed one use of the new len. V2 
submitted.

Thanks for noticing.

Larry


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-20  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19 19:02 [PATCH] rtlwifi: rtl_pci: Fix problem of too small skb->len Larry Finger
2019-10-19 22:23 ` ian.schram
2019-10-20  1:13   ` Larry Finger

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.