Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11650531rwl; Tue, 3 Jan 2023 02:37:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXsu3A55iV4XlhxeestTjDrED5d53BaL0EjEhhnstOPToHkdnugY9ttg75g2a/se/YzCi8dx X-Received: by 2002:a17:90a:7341:b0:225:f7b3:aebf with SMTP id j1-20020a17090a734100b00225f7b3aebfmr29428489pjs.30.1672742274665; Tue, 03 Jan 2023 02:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672742274; cv=none; d=google.com; s=arc-20160816; b=ekc7ZtBXv0Lm2U9zQJyMnB9U1B3JQIHvuk2NizHj2dPJmT40yO1Ow7SUAmnRTfmiC0 WJrEIAUzwNvwG/Hhf1KPzO91JfwZ7IQQRB03mDubk/OPAZktbM2RMvU94kQfc6TDpb2n 58fVQz0oW86INkaw+r299KjVEoQbe79d8rXVHcerybvgAug+Jf/vmRh5ewm21+1SA2Hj Cj1ARO15l9HnwWlP0kBpEiueaDYcJCoDuKzy6NuHcmU/IlHlyt0ZQkCW40lumByQUHBD 3SwQ+BsXBsLYuOrLYUrtHz7V1++fiD+Uh9a6qEptoSxLgJ+l1g+pTYRJV15+/dZg/KVN +Z1A== 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:dkim-signature; bh=KA6xRikIRmuprtADrqaBj11wJxc4svLe7ATeyT1zIVA=; b=kM18rzPI5hJpXdO9b5BmeJtXEBQR0qqX4oIn0YLK4Lp+morWGv2qR+Fnj+wum0nEwh pwu9FTyMaeM7cjkjMRuZy4ZD/L5OMwrpMqrEYWZvY8jhkxmIDLkbGXh+0+jNt3gZCxQc UtODB/YwSf7mm06HVZq921eOK/dC6fIFoOCnSG8h0vXkDUV1QWjWJOC1yXKz0DM3UO5g K8s7QaxEqr1udmtxWdFvQg+cg/Kk1CVg6La2uMovhdbR138Vpj2m/w5sLH/HJ4Hij8hs wg1t9PYnFxPyWMK0L29XOKw6fvJw1npEwbs9U/Fgn7yRxjhxHWwLkf2s9IV5JrW37sSK +rVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dlhvUTmF; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a17090a7e8600b0022695223cdcsi2054936pjl.178.2023.01.03.02.37.43; Tue, 03 Jan 2023 02:37:54 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=dlhvUTmF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236794AbjACKg1 (ORCPT + 67 others); Tue, 3 Jan 2023 05:36:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237238AbjACKgS (ORCPT ); Tue, 3 Jan 2023 05:36:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CAAA18D for ; Tue, 3 Jan 2023 02:36:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CFC961240 for ; Tue, 3 Jan 2023 10:36:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4184CC433D2; Tue, 3 Jan 2023 10:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672742176; bh=C2IskYc5ws2i+sc3p5we5h2PwpfKRXY7xdvTMtjgOyM=; h=From:To:Cc:Subject:Date:From; b=dlhvUTmFSL1Z89YEOfJb4+unOiMOjsukpwB4bzHrFaYp73Gt4Us7S4qWowDc3M7a+ XHms27ag274Mtyt9fbVXVniCWM+Hr2N6y1PsUJvOU16XPcCx/llLZB83rak9JGYyBC iyj1L7CK6HYVXKm/gQUKO7ULijQB7HNG2W/CDFURRikEITINV5CMuzupv/Kpcs4Lnq kHspngDLh9j0JNiVuTv+R+uL57grki183iRxOmQm4tOqzjxjCeJ2B17iprEu3WzSXx 9E+1OisFv1QECsalPIidJKZ4rAzO0UwwFu/0bwdLwiCwSWa5MQO4/tX5LJmDYKne8r NlU+FwtEHLtvg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH] wifi: mt76: mt7921: fix memory leak in mt7921_check_offload_capability Date: Tue, 3 Jan 2023 11:36:02 +0100 Message-Id: <39ebf05085dd3069412c001ca9a31aa259de5a74.1672742135.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Fix possible memory leak in mt7921_check_offload_capability routine relasing fw data. Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 542dfd425129..5ec0caa23c23 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -175,7 +175,7 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm) if (!fw || !fw->data || fw->size < sizeof(*hdr)) { dev_err(dev, "Invalid firmware\n"); - return -EINVAL; + goto out; } data = fw->data; @@ -205,7 +205,7 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm) data += le16_to_cpu(rel_info->len) + rel_info->pad_len; } - +out: release_firmware(fw); return features ? features->data : 0; -- 2.39.0