From patchwork Fri Apr 23 18:29:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 12221381 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 X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,PDS_BAD_THREAD_QP_64,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6703C433ED for ; Fri, 23 Apr 2021 18:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A20F613C8 for ; Fri, 23 Apr 2021 18:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243662AbhDWSaW (ORCPT ); Fri, 23 Apr 2021 14:30:22 -0400 Received: from esa.microchip.iphmx.com ([68.232.154.123]:44321 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhDWSaV (ORCPT ); Fri, 23 Apr 2021 14:30:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1619202585; x=1650738585; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=RmIWU2X9Whmv6D9wjWB1/bvpHtPm1W74MxWZmUTQbzU=; b=E/N78u+AnUt7r805OPeZiBcBXCL7+ECdWvnbNZgbInfCzi1g7CKAkjyl KSIE25xDdahRO9csTNGzcBS6sBReanSlAA9NpERzTfeYPc77jUfobrh/S VD/jb/v8Jh7i73mP2Z1j6ao/kpNMDDSPVijxGHeEywAh7FjIJYaEHG8HJ EM523bpOv/+IlfQvbKXHMfZ9Dmgd0dvXZwa5E8LigbPhblnD0uIFsmFjG p78b4AG6JcyptrXKQGt/kwY5LbPEYf++r4HIyPA0+K95N1hHctmInu5Uz HxFv4bd9F+Rcb3R7HblIjbAp527xIyu/7TtpmGkpvpfxdkvRBw9G3ggz9 A==; IronPort-SDR: aiqDIWRBZgQJ51LRqtDxnBATZlHjCWDdvAqymeVUZt1pbsPUKILPFC/J+qXxsbT2nebg9TAiUj /oBpa51+2YqwAsyiPFg1wsQK1i8ZskM+inIxRAFs52Q4zSKcGN5wfG6ClkD2JUZ4RE/yiFnZg0 nM5LiUH8HHkSyj61v6gJ34eZu3Ggq9q7PEQ/w2I0yoSRKl+SX7GnoWI9/9qzBgW0bjFLRZGPUK g3+rEOjpARRLEMBrHREcc/y8XR6UwuJDFKuw7bklLuVjueUR9kxiqZC+YdcJ62wAlbBNW6BIGY rG8= X-IronPort-AV: E=Sophos;i="5.82,246,1613458800"; d="scan'208";a="111995807" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Apr 2021 11:29:43 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 23 Apr 2021 11:29:43 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2 via Frontend Transport; Fri, 23 Apr 2021 11:29:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F0c7YMYG5od63JzdALz5kMEL2hb6MY3W1UVGhIeHHfWPcI8JaFUqz0In1RaAJPZ4/RkQcWoH6b2yY4+SQLPPra/By1KuKcMRcZX6qr8cvoowhHur5t3WyoKTPvLh/2caQ4pEkwrWj+IscuojrQPih8LaWUYj8trNRXr1xE59ud/zbCc+N9h7JEiYdWZXmFOrrwUr98aglni0aKcAqNCPbuBo1lEafzemkygWlkVZUY7hcsFjqxo3B2SSthPl8M32ICN4a9Imm+T4ZI77YvCTRYEpFk5m4VD1oJGfbFjPm7ra2MmiqFVvFqlEkBneqMSkPfSu7T/ZHLhefGDH6i7NUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PtydGo0iCW7MIr4I35vBj5An+woqggA49G96qn1Hrt4=; b=MY4NceISp1MghA/iAwPgCGW7ZAXcOkoB7RSktFaoK/yNEYKOpWJF7dUvzY9ZKUGUZ4pOeSzRhpmwZyjwOrWAZhJUzjiFuGZiVKF7STZz28kXd4iW6z6+sg54oy2I/H9MIx/TEZnCccZVV70n7zn2ENqSlyA3MRDIgt4a3vykVEr/WheCnnG3DYKw0yPapGdohIjz8iXgtBgmvBNQ6RWpCDE5XfXkvn7DDTTh2Zi+bwt0SVGgY1uvSmoDCHoBzEpddZ5EI2dpEP1zhtMGQNiq8YJpTx0PVMdvIds3Tshwf0wU1Go/MrLAf0yXWZ0c3JLnORxg58HYrlLZHwqgiKGzOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PtydGo0iCW7MIr4I35vBj5An+woqggA49G96qn1Hrt4=; b=tfdccl+LnihvXD7J/u0WtCWH//UKM6HEWvR4u6bCnyyH1dq+NJhGguA7H/zP8KcF6MILR3N0mSvws+NE8NMZx41+Kmy2FvR0AshtJcoFzKx/MHj6RDCVUNIKltlEiXbfNF3+ziD+0M69vCh64V9kdfYveDGZbRXBs4fB0dKzTWA= Received: from SJ0PR11MB4943.namprd11.prod.outlook.com (2603:10b6:a03:2ad::17) by BYAPR11MB3318.namprd11.prod.outlook.com (2603:10b6:a03:7d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Fri, 23 Apr 2021 18:29:42 +0000 Received: from SJ0PR11MB4943.namprd11.prod.outlook.com ([fe80::5da7:92e6:d6c9:64b3]) by SJ0PR11MB4943.namprd11.prod.outlook.com ([fe80::5da7:92e6:d6c9:64b3%7]) with mapi id 15.20.4065.024; Fri, 23 Apr 2021 18:29:41 +0000 From: To: CC: , Subject: [PATCH 02/12] wilc1000: fix possible memory leak in cfg_scan_result() Thread-Topic: [PATCH 02/12] wilc1000: fix possible memory leak in cfg_scan_result() Thread-Index: AQHXOG6gXo9GfYFCakC9oss6XqjFTA== Date: Fri, 23 Apr 2021 18:29:41 +0000 Message-ID: <20210423182925.5865-3-ajay.kathat@microchip.com> References: <20210423182925.5865-1-ajay.kathat@microchip.com> In-Reply-To: <20210423182925.5865-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [106.51.107.119] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 376e3913-8271-4fa5-ebae-08d90685c2d1 x-ms-traffictypediagnostic: BYAPR11MB3318: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:569; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +MfPRWrlcii26gR7zZCRlYzZw7xWJBEe3xUD3AjT6PhZms72r9PCHW2WQOmskChM3EsHzYZ8nN4FnVym95Ild/glnB2WWtEZCAQZQmRtwbj2B4w0KTbJCIKL9r+/xGyoNgl6493YgakmxKhqRNacOp6clk0B/LE1cppzBCy+CRPAZwvV9mcwQAam2LR3xFH8/kdZCYHXT5E/vSDC5rQwpbxKWuYaj8QwKtcGnIm6iB9J010xwjNsG0D50s6nN46mJIbrcyggJe21XmJM3mdoJQrUES4sbQ3AZJzd9+sLJYA5uEUqplR7G7b9jYXw2geyr8tHeymTGHSee5Jdarylo6xMeGj8zbqnNhAnQOXOdSTg7A041QVHYQ5fY1VOHfWd5tph2okMIJVqOO+BfZk7wgIlgeZkX2OTo5sBY+zVIqmMkSWhisbsQwgGFND1tX5/GHQ3RQ3Qs24xyvVdPK3hvWOV6tLV8oy86lHkFMv/8M2LzzcMfaZ9gTbW5m3NfCcd+DVF+bAO0Ii0UzchTR1DuD+ciMr0QU/U2euJha+x/3N1S0JwwJw90yIpWf/HaEX6tVz9p6a1Hb0RqNNdapyJ0Xum5mNVFgswr4io7GvlC48= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB4943.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(136003)(39860400002)(346002)(366004)(8676002)(478600001)(55236004)(5660300002)(54906003)(6506007)(71200400001)(1076003)(4326008)(2616005)(6486002)(86362001)(316002)(107886003)(6916009)(66476007)(66446008)(186003)(66946007)(36756003)(122000001)(26005)(66556008)(91956017)(83380400001)(38100700002)(8936002)(64756008)(76116006)(6512007)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-mess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kg4KnYWp4fyEsts?= =?iso-8859-1?q?50u0O4qXKbT+rpk8xf8snlcNRX3l8TpboGDGOFfHEIx6NSjeTsvLF5GTlOg/?= =?iso-8859-1?q?rcKFqV0PgIJau33fFP6g4d9OKnND/msc2v+/gHn9szlk2tY7A0BTDGSqr8oN?= =?iso-8859-1?q?fxJgIhgn40eiHerh/3ktuAQ06LVZmE5XL/GXpYJEMlS10K0LS4ISTuCOkU8q?= =?iso-8859-1?q?Pgp4YPZ+3Wftykjcb9+v1vfJ8/nACpBhSP5hW8E8J8T6UFqzh4+q/W8A8w1b?= =?iso-8859-1?q?Jt4yMkMMQXNtQm0/ge980lKrf8bE+8XX43plkQAXgoTcqpduFY9csuyNGVGV?= =?iso-8859-1?q?toDAwhX8svrYEmPdghp13BDeeFcRJWe27NGNcXVP2v0zJR6QFZe0R6s4iKcq?= =?iso-8859-1?q?VS2xnyOjFXdaqPRZk4GqWfpKO84Sj5Eltqzn5y3WF8g44Jn0HZ6aWdBixQa4?= =?iso-8859-1?q?YCx2pL0K13aGbpr8J1E6uKXWqV0OzbaoPGw5l18hu+Q7hYy6K1N/+glsA0n4?= =?iso-8859-1?q?CTw0V4cQuqhEpo+5K9sXQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB4943.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 376e3913-8271-4fa5-ebae-08d90685c2d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2021 18:29:41.7475 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Bv7/gORLXdwvesBP/6nDtM1y3daom8+K5ZjfBT1s/My6XhcSt64cnnlANITS/cEeyY9z3XZHzCsWAiFU1tUaG7gI1noda/kp6fSd3Mqg54U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3318 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Free 'cg80211_bss' reference when 'bss' handler is valid. 'if' condition is incorrect because it calls 'cfg80211_put_bss' when bss is NULL(i.e 'if (!bss) is used instead of 'if (bss)') Remove 'if' condition because 'cfg80211_put_bss' API already takes care of NULL check. Fixes: 6cd4fa5ab691 ("staging: wilc1000: make use of cfg80211_inform_bss_frame()") Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c index 530a768547cc..36b87ed38092 100644 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -129,8 +129,7 @@ static void cfg_scan_result(enum scan_event scan_event, info->frame_len, (s32)info->rssi * 100, GFP_KERNEL); - if (!bss) - cfg80211_put_bss(wiphy, bss); + cfg80211_put_bss(wiphy, bss); } else if (scan_event == SCAN_EVENT_DONE) { mutex_lock(&priv->scan_req_lock);