Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4802391rwb; Tue, 8 Aug 2023 14:14:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6UKoechL/jnFSTRVDNP+T+sBvvBEElOcQ7iX1pwnBKmOwFjRfihVrovlOhIVeJO4Sdkct X-Received: by 2002:a50:ed85:0:b0:522:21a1:516b with SMTP id h5-20020a50ed85000000b0052221a1516bmr781066edr.24.1691529266503; Tue, 08 Aug 2023 14:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691529266; cv=none; d=google.com; s=arc-20160816; b=O2iNzNVdvPLkeTVwbH9DzHLnZkElyWfyhixPTnkWGjtgfEmwgcvXegwRNzlejcuyXw MyP+eNIxaUZwoIX9A8jn4X0xYUOz8K4mnJVozE53F1ICJbvBfKhUzv88xQcHKOR494bC 0lbnBuzGPlLA+vaxm++h3gTnioBlGie/XHiya7jmGbgrySziEWMr5R9qSUPudNIK+jFj TVPpuc1W7TQpfbZMHAfSFZ+qRwUSnUwhH5nyVIvC77fK9L9NsXEv5nZbbpkRgcPgEGC5 0T2kSWEntaMvYLv+KWAy3wDzJ+NmYoXIuTD68WwZ7Xid+QXQqpsdROUkClGj4zcwTZEk YtzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AUKpE+oNE0/h0QGs7zyymgJyrDlWJCUBg0EB3+1xZK0=; fh=DXT3+S1dYZq2zPG99JY4daDI5KU91o+BEhdaTJWEbNE=; b=xjiahlX7Gf7wqHJPadHHr1g+nYZ14MqW5yQO7zmm69ix/oglDHEov14YdPshX0Zz+P AgsBts5OymaihO2VEAcOf76N7PdOR0vlo5FUeQ3JkiGFWCly/G2ORKSQNzopxbAkEUzY HuRvC+hYJImdnefwXzxKkDudiwhE65G5dWCh5vqFzna2RxOlmk0wKn+berGeu3yxJiTW bgt+G/t4QBZGZJXBkC1kTHLoq4a05ZxQsnB6i54YBRiWuaJ/bfylkefCwVrjWKmMm1++ Vj28oYjC+OA5CxW/TTsx4R7fl68NzPB8ZSD26MzIbxIvidL6F4VrgxbKxAlrGDopCzt7 FgXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q6iqfmiO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a25-20020aa7d919000000b0052329efb0b1si5983378edr.34.2023.08.08.14.14.09; Tue, 08 Aug 2023 14:14:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q6iqfmiO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236113AbjHHVNZ (ORCPT + 56 others); Tue, 8 Aug 2023 17:13:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236192AbjHHVNO (ORCPT ); Tue, 8 Aug 2023 17:13:14 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07331A5E3 for ; Tue, 8 Aug 2023 13:11:30 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1bbc87ded50so40202555ad.1 for ; Tue, 08 Aug 2023 13:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691525489; x=1692130289; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AUKpE+oNE0/h0QGs7zyymgJyrDlWJCUBg0EB3+1xZK0=; b=Q6iqfmiOrpTlN0MVMyg/J93jDJK62XjmqC1jPntTS3deq+9DqQOJK5OfwbRI9m++ld sS1kkZJQb0KZMvsfY8ytGzqDPd2xMeo6jYkIfoa2AsWUK1vafRQG83USTHTgtTkCk9j+ o3+sxX4S6R2+w/yWmkZUPHKuM4d0Z9faggDJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691525489; x=1692130289; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AUKpE+oNE0/h0QGs7zyymgJyrDlWJCUBg0EB3+1xZK0=; b=NWYmzzJrNjUk3HT8kssDWesWwBkHkWM1D3w8icEK7AQ9gaa4FSm5S+Af0r+hBLGkCa hHgd6NO+rdKPMdUhv1pgBLZXIy+1lSVGuwWMX+Mxx1QYQws0UPtOPnitOft7WzUq6QWZ i7lyM9U+zQ7QyZuvzhE4/No/H9AvUJuCAmRMgYgM7TUbGcxQv/HRSbM/SKgQQIidZdJP 9f0Pf5eOcuX2UOK9I0DZ9EQQUNexsvYOfJy9tp/Zdy/F34M6sFfFkFL5L6zVAbTcM+So vAl6y6yRwpdjCPfQ3map1xXQ1VYg3XYpqmQn2zK3BR24yFcnfFa3Bn6Of826svXEOmoM ATkw== X-Gm-Message-State: AOJu0Yyb27+pnNdDLZaMmDSl1JevUD6JFi1aYxxEho8DQoqTbn4Isceb DDoE9V9rSrHDQr2VUsElVhvGkQ== X-Received: by 2002:a17:902:f7cd:b0:1bc:2c58:ad97 with SMTP id h13-20020a170902f7cd00b001bc2c58ad97mr685047plw.22.1691525489554; Tue, 08 Aug 2023 13:11:29 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:800e:831a:c5f6:2dd0]) by smtp.gmail.com with ESMTPSA id d4-20020a170903230400b001b531e8a000sm9435065plh.157.2023.08.08.13.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Aug 2023 13:11:29 -0700 (PDT) Date: Tue, 8 Aug 2023 13:11:27 -0700 From: Brian Norris To: Dmitry Antipov Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH] wifi: mwifiex: avoid possible NULL skb pointer dereference Message-ID: References: <20230808084431.43548-1-dmantipov@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230808084431.43548-1-dmantipov@yandex.ru> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FSL_HELO_FAKE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, Aug 08, 2023 at 11:44:27AM +0300, Dmitry Antipov wrote: > In 'mwifiex_handle_uap_rx_forward()', always check the value > returned by 'skb_copy()' to avoid potential NULL pointer > dereference in 'mwifiex_uap_queue_bridged_pkt()', and drop > original skb in case of copying failure. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 838e4f449297 ("mwifiex: improve uAP RX handling") > Signed-off-by: Dmitry Antipov > --- > drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c > index 04ff051f5d18..454d1c11d39b 100644 > --- a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c > +++ b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c > @@ -252,7 +252,15 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, > > if (is_multicast_ether_addr(ra)) { > skb_uap = skb_copy(skb, GFP_ATOMIC); > - mwifiex_uap_queue_bridged_pkt(priv, skb_uap); > + if (likely(skb_uap)) { > + mwifiex_uap_queue_bridged_pkt(priv, skb_uap); > + } else { > + mwifiex_dbg(adapter, ERROR, > + "failed to copy skb for uAP\n"); > + priv->stats.tx_dropped++; This feels like it should be 'rx_dropped', since we're dropping it before we done any real "RX" (let alone getting to any forward/outbound operation). I doubt it makes a big difference overall, but it seems like the right thing to do. Otherwise, this looks good; feel free to carry this to a next revision if you're just changing tx_dropped to rx_dropped: Acked-by: Brian Norris > + dev_kfree_skb_any(skb); > + return -1; > + } > } else { > if (mwifiex_get_sta_entry(priv, ra)) { > /* Requeue Intra-BSS packet */ > -- > 2.41.0 >