mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()
@ 2022-11-23  8:12 YueHaibing
  2022-11-23 21:26 ` Philipp Hortmann
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2022-11-23  8:12 UTC (permalink / raw)
  To: gregkh, wlanfae, Larry.Finger, mikem
  Cc: linux-staging, linux-kernel, YueHaibing

The skb is delivered to netif_rx() in rtllib_monitor_rx(), which may free it,
after calling this, dereferencing skb may trigger use-after-free.
Found by Smatch.

Fixes: 94a799425eee ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 6a0f5bbb99ef..f8965afab767 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -1489,9 +1489,9 @@ static int rtllib_rx_Monitor(struct rtllib_device *ieee, struct sk_buff *skb,
 		hdrlen += 4;
 	}
 
-	rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen);
 	ieee->stats.rx_packets++;
 	ieee->stats.rx_bytes += skb->len;
+	rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen);
 
 	return 1;
 }
-- 
2.17.1


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

* Re: [PATCH] staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()
  2022-11-23  8:12 [PATCH] staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor() YueHaibing
@ 2022-11-23 21:26 ` Philipp Hortmann
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Hortmann @ 2022-11-23 21:26 UTC (permalink / raw)
  To: YueHaibing, gregkh, wlanfae, Larry.Finger, mikem
  Cc: linux-staging, linux-kernel

On 11/23/22 09:12, YueHaibing wrote:
> The skb is delivered to netif_rx() in rtllib_monitor_rx(), which may free it,
> after calling this, dereferencing skb may trigger use-after-free.
> Found by Smatch.
> 
> Fixes: 94a799425eee ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
> index 6a0f5bbb99ef..f8965afab767 100644
> --- a/drivers/staging/rtl8192e/rtllib_rx.c
> +++ b/drivers/staging/rtl8192e/rtllib_rx.c
> @@ -1489,9 +1489,9 @@ static int rtllib_rx_Monitor(struct rtllib_device *ieee, struct sk_buff *skb,
>   		hdrlen += 4;
>   	}
>   
> -	rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen);
>   	ieee->stats.rx_packets++;
>   	ieee->stats.rx_bytes += skb->len;
> +	rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen);
>   
>   	return 1;
>   }

I was able to set the driver to Monitor mode but I did not get any 
information from it. I think this happens due to the missing support for 
nl80211. Please give me a hint how to do this.

Thanks for your support.

Bye Philipp

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

end of thread, other threads:[~2022-11-23 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23  8:12 [PATCH] staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor() YueHaibing
2022-11-23 21:26 ` Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®