From patchwork Fri Jul 7 09:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 700350 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 9D4CFEB64DA for ; Fri, 7 Jul 2023 09:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232785AbjGGJvk (ORCPT ); Fri, 7 Jul 2023 05:51:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232730AbjGGJvj (ORCPT ); Fri, 7 Jul 2023 05:51:39 -0400 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F841BEE; Fri, 7 Jul 2023 02:51:35 -0700 (PDT) Received: from ed3e173716be.home.arpa (unknown [124.16.138.129]) by APP-03 (Coremail) with SMTP id rQCowAB3l2Qd4KdkZ0rOCA--.27075S2; Fri, 07 Jul 2023 17:51:26 +0800 (CST) From: Jiasheng Jiang To: amitkarwar@gmail.com, ganapathi017@gmail.com, sharvari.harisangam@nxp.com, huxinming820@gmail.com, kvalo@kernel.org, dkiran@marvell.com, patila@marvell.com, bzhao@marvell.com, linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] mwifiex: Add check for skb_copy Date: Fri, 7 Jul 2023 17:51:21 +0800 Message-Id: <20230707095121.10453-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowAB3l2Qd4KdkZ0rOCA--.27075S2 X-Coremail-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mh5UUUUU== X-Originating-IP: [124.16.138.129] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add check for the return value of skb_copy in order to avoid NULL pointer dereference. Fixes: 838e4f449297 ("mwifiex: improve uAP RX handling") Signed-off-by: Jiasheng Jiang --- drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c index e495f7eaea03..9cfa5de57207 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c @@ -243,6 +243,8 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, if (is_multicast_ether_addr(ra)) { skb_uap = skb_copy(skb, GFP_ATOMIC); + if (!skb_uap) + return -ENOMEM; mwifiex_uap_queue_bridged_pkt(priv, skb_uap); } else { if (mwifiex_get_sta_entry(priv, ra)) {