From patchwork Fri Feb 10 11:12:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natalia Petrova X-Patchwork-Id: 13135693 X-Patchwork-Delegate: kvalo@adurom.com 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 F2C09C05027 for ; Fri, 10 Feb 2023 11:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232350AbjBJLNY (ORCPT ); Fri, 10 Feb 2023 06:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbjBJLNU (ORCPT ); Fri, 10 Feb 2023 06:13:20 -0500 Received: from exchange.fintech.ru (e10edge.fintech.ru [195.54.195.159]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8806272DCC; Fri, 10 Feb 2023 03:12:38 -0800 (PST) Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.169) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 10 Feb 2023 14:12:31 +0300 Received: from KANASHIN1.fintech.ru (10.0.253.125) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 10 Feb 2023 14:12:31 +0300 From: Natalia Petrova To: Larry Finger CC: Natalia Petrova , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , , , Subject: [PATCH] b43legacy: Add checking for null for ssb_get_devtypedata(dev) Date: Fri, 10 Feb 2023 14:12:28 +0300 Message-ID: <20230210111228.370513-1-n.petrova@fintech.ru> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.0.253.125] X-ClientProxiedBy: Ex16-01.fintech.ru (10.0.10.18) To Ex16-01.fintech.ru (10.0.10.18) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Function ssb_get_devtypedata(dev) may return null (next call B43legacy_WARN_ON(!wl) is used for error handling, including null-value). Therefore, a check is added before calling b43legacy_wireless_exit(), where the argument containing this value is expected to be dereferenced. Found by Linux Verification Center (linuxtesting.org) with SVACE Fixes: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices") Signed-off-by: Natalia Petrova Acked-by: Larry Finger --- drivers/net/wireless/broadcom/b43legacy/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c index 760136638a95..1ae65679d704 100644 --- a/drivers/net/wireless/broadcom/b43legacy/main.c +++ b/drivers/net/wireless/broadcom/b43legacy/main.c @@ -3871,7 +3871,7 @@ static int b43legacy_probe(struct ssb_device *dev, return err; err_wireless_exit: - if (first) + if (first && wl) b43legacy_wireless_exit(dev, wl); return err; }