Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1194374rwo; Wed, 2 Aug 2023 10:03:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdDZEP1E+T4B5DoZppItmCGnxjx6NgIhK6tL8BXdLiAR9UBxWFB5CqfnJ4Sn0IBJr7jkxE X-Received: by 2002:a05:6a00:3a0d:b0:67a:8fc7:1b61 with SMTP id fj13-20020a056a003a0d00b0067a8fc71b61mr17609097pfb.11.1690995781598; Wed, 02 Aug 2023 10:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690995781; cv=none; d=google.com; s=arc-20160816; b=VFqps60JzLDW6JhbjUGQTPqzwbis43IosztiqddQzuM9hQiu/eV1hmNwOjVzmCfR6Q 9KZRtJuJjDoha3x5CJaPChpak+CPUyzxZMdt9mkbN5mHp5/reDEvDp/SGSMP1Wgi+y1Z 7KysnI8uTThtnucBbOdaopiYXNfRBMJsb6K9b+k2fOcjXYA8mzUDiEs6j5350xUyhatN ToTfLmoV6gm+2WpRh78vKSMoBdNaavkngiRvoLZMQT4Fan1n0C100Dm6NTIkTBn0CQ2R /oFn9V6I+kG29Y+kjT7qcsuBo36x05af8UNaSiUgxKADMIDjvymdkAC0JziTHZ7E2C7q e79Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=OYnnIubJaG/6uIX2A9p+sZivFNU/Mo5w7xSdyH1ambY=; fh=Dr9V3UVZyWfhYYXTCAKATfwOJEH525c17tU5RBJSr34=; b=cDOw9ZRcs2A5Cnpi0MJoNY/WyeY14lCM7XIcfwRs+DgDabdI1bMLSJtO7mjmGDXbp7 47P8WJt1nEIvJU7ENU6SY4dwVg40o8i+BoUkUjgWv1MjvXRKZIsd4D0ThdLf4GHURljm 62Z4Ych4qXj+sZStBRbmXSPiZlqmh+QvYWOqwY/tBfFzpV/bKNlIGLgkqul5aiE0m/Rf UTYooDKzdO6Q4d7gmmew0QfpgZawqDcbAqp7PbhFmnb2e0/rfvmpP+FTmcYEfbKBa1z6 slfDZTTmdstGy/qn2UK4cCtLAieE+/TedzRKGIfjIqsqJrlNNKhJjXzpw7fxxYFr4fNL QSkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g123-20020a636b81000000b0056385a32757si8964324pgc.797.2023.08.02.10.02.45; Wed, 02 Aug 2023 10:03:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234148AbjHBQgP (ORCPT + 58 others); Wed, 2 Aug 2023 12:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234203AbjHBQf6 (ORCPT ); Wed, 2 Aug 2023 12:35:58 -0400 Received: from frasgout11.his.huawei.com (ecs-14-137-139-23.compute.hwclouds-dns.com [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9CD30CA; Wed, 2 Aug 2023 09:35:35 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4RGHNJ4Kykz9xGgQ; Thu, 3 Aug 2023 00:23:44 +0800 (CST) Received: from A2101119013HW2.china.huawei.com (unknown [10.81.207.228]) by APP1 (Coremail) with SMTP id LxC2BwBXC7uhhcpkkN4sAA--.50378S2; Wed, 02 Aug 2023 17:34:53 +0100 (CET) From: Petr Tesarik To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , Chi-hsien Lin , Ian Lin , Wright Feng , Hector Martin , Prasanna Kerekoppa , Hans de Goede , Ramesh Rangavittal , Linus Walleij , linux-wireless@vger.kernel.org (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), brcm80211-dev-list.pdl@broadcom.com (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), SHA-cyfmac-dev-list@infineon.com (open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER), linux-kernel@vger.kernel.org (open list) Cc: Roberto Sassu , petr@tesarici.cz Subject: [PATCH] wifi: brcm80211: handle params_v1 allocation failure Date: Wed, 2 Aug 2023 18:34:30 +0200 Message-Id: <20230802163430.1656-1-petrtesarik@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: LxC2BwBXC7uhhcpkkN4sAA--.50378S2 X-Coremail-Antispam: 1UD129KBjvJXoWxJr47Aw4fJF4xAr4ktFWxtFb_yoW8Gw4rp3 WxXa4qyr1UWr4a9r4jgrZ7AFyFka17G34qkrWjywn3uFn8Cr18JFy0kFy2krW5C39ay3y2 qFyvqrW7Grs3JrDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBv14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1I6r4UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4j6F4UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr 0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E 8cxan2IY04v7MxkF7I0En4kS14v26r1q6r43MxkF7I0Ew4C26cxK6c8Ij28IcwCF04k20x vY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I 3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIx AIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF 0xvE42xK8VAvwI8IcIk0rVW3JVWrJr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z2 80aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU7GYLUUUUU= X-CM-SenderInfo: hshw23xhvd2x3n6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,RDNS_DYNAMIC, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Petr Tesarik Return -ENOMEM from brcmf_run_escan() if kzalloc() fails for v1 params. Fixes: 398ce273d6b1 ("wifi: brcmfmac: cfg80211: Add support for scan params v2") Signed-off-by: Petr Tesarik --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index de8a2e27f49c..2a90bb24ba77 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -1456,6 +1456,10 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, params_size -= BRCMF_SCAN_PARAMS_V2_FIXED_SIZE; params_size += BRCMF_SCAN_PARAMS_FIXED_SIZE; params_v1 = kzalloc(params_size, GFP_KERNEL); + if (!params_v1) { + err = -ENOMEM; + goto exit_params; + } params_v1->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); brcmf_scan_params_v2_to_v1(¶ms->params_v2_le, ¶ms_v1->params_le); kfree(params); @@ -1473,6 +1477,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, bphy_err(drvr, "error (%d)\n", err); } +exit_params: kfree(params); exit: return err; -- 2.25.1