From nobody Thu Apr 16 02:17:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32E08C433FE for ; Wed, 23 Nov 2022 08:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235915AbiKWINK (ORCPT ); Wed, 23 Nov 2022 03:13:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235705AbiKWING (ORCPT ); Wed, 23 Nov 2022 03:13:06 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B88541E72C for ; Wed, 23 Nov 2022 00:13:03 -0800 (PST) Received: from canpemm500007.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NHDPj1sHnzHw5J; Wed, 23 Nov 2022 16:12:25 +0800 (CST) Received: from localhost (10.174.179.215) by canpemm500007.china.huawei.com (7.192.104.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 16:13:01 +0800 From: YueHaibing To: , , , CC: , , YueHaibing Subject: [PATCH] staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor() Date: Wed, 23 Nov 2022 16:12:53 +0800 Message-ID: <20221123081253.22296-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500007.china.huawei.com (7.192.104.62) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The skb is delivered to netif_rx() in rtllib_monitor_rx(), which may free i= t, after calling this, dereferencing skb may trigger use-after-free. Found by Smatch. Fixes: 94a799425eee ("From: wlanfae [PATCH 1/8] rtl81= 92e: Import new version of driver from realtek") Signed-off-by: YueHaibing --- 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/rtl8192= e/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 *ie= ee, struct sk_buff *skb, hdrlen +=3D 4; } =20 - rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen); ieee->stats.rx_packets++; ieee->stats.rx_bytes +=3D skb->len; + rtllib_monitor_rx(ieee, skb, rx_stats, hdrlen); =20 return 1; } --=20 2.17.1