Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1857294rwb; Fri, 19 Aug 2022 10:31:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7uoELXRIReb1fNZII0U4h6PBtSBU9w9qXbzBjBYpw5ox5OUOuQbVxlrYdzrYelP0wVcrYu X-Received: by 2002:a17:90b:2243:b0:1f4:e8a4:8c38 with SMTP id hk3-20020a17090b224300b001f4e8a48c38mr15472147pjb.136.1660930318806; Fri, 19 Aug 2022 10:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930318; cv=none; d=google.com; s=arc-20160816; b=s2v4Dl9QYxxu6PfEHkMzsWV7hqLMpdKJltIlYJlCKoH2ChjUPc8N/sFVVkvpEfj2Nk +4ogMJT7CNLlJ4jSn+8HqRjcqdf2dkR99oN06hq9hnwoyR8cisNPrNL/77xDm1lPtyJf SdzH9CTRisGom9gP1bhfcYMEoMtm7kxbfXYhC13dGY6nz1/YcYvsB3Vq31KoJ8+1RasX iaKJ1jzkoySmopVxzA8wE+y8DctH8AEZ5ta07ywW/Q9kLO+8Gb9nW5xfHWs7qzDMat7K lIbi/akimRlXWbhbIS8qbvHppQgBbGruN99HyNkcXo4MIPecZQa2dFk8Zj9dCUd10ISq Yg3Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sn/HGi2MxhlWepAg+xhjSinSesM5bELFswR5/ohq54s=; b=dy/SarhiZM7pUQb7bQBxFq2o6t4EH66vlcZE8jqFAcTvuT0+kZ7qRP3uCzs8Q6Qcf8 NCqYHTUV0KuwNcIaNwd6+ARsUEU9+CrMzd3nP19oRpB8apdoVs8BOS4fMyXxFOLSdaeI IxtW1dTgAAdmPspykGMivZhVdMzZcSTgwxL6E0id3ysDEcCuhCpIci0w2rhvuOI0tXNh yzvylUU0lT51arz/g8OPPRtmHytbQ+DYP4uwEFpkNCPVf2EW0zrDkfvdZqfDg33cq1pv piMoMKa49PptwciEEcdTyRrKD0+UNNU2akN3YixU8a/PmZ/JVKF9i7KdA8arX8n11FMC 9PUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="BYAXjzq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709026ac700b0016daa0c3ab5si4097056plt.406.2022.08.19.10.31.48; Fri, 19 Aug 2022 10:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b="BYAXjzq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351977AbiHSQSl (ORCPT + 99 others); Fri, 19 Aug 2022 12:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352005AbiHSQPD (ORCPT ); Fri, 19 Aug 2022 12:15:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E447D1F5; Fri, 19 Aug 2022 08:58:22 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id DD5C1B8281A; Fri, 19 Aug 2022 15:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25912C433C1; Fri, 19 Aug 2022 15:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924692; bh=nDvsOOKgXm6pVAIk6pb61ee3aQclJZHwOgFaeG1aU08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYAXjzq/ZA5oBzpHnTXcP8Vi6YPjohIIv+95VfZTTmwzskA2N2/RnEy2BBN0ovNCL alGtAPcoAknRSRttUDQKhjF2O5q4sKniKYWL3DGcTSACexArTfXN7WTbBbSE2wCvd0 Go1BK5l7qtyGg6hJ0V/1XpKReX3WljFThmj5V1Cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gergo Koteles , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.10 222/545] mt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg Date: Fri, 19 Aug 2022 17:39:52 +0200 Message-Id: <20220819153839.294719482@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit cffd93411575afd987788e2ec3cb8eaff70f0215 ] Free the skb if mt76u_bulk_msg fails in __mt76x02u_mcu_send_msg routine. Fixes: 4c89ff2c74e39 ("mt76: split __mt76u_mcu_send_msg and mt76u_mcu_send_msg routines") Co-developed-by: Gergo Koteles Signed-off-by: Gergo Koteles Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c index e43d13d7c988..2dad61fd451f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c @@ -108,7 +108,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, ret = mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500, MT_EP_OUT_INBAND_CMD); if (ret) - return ret; + goto out; if (wait_resp) ret = mt76x02u_mcu_wait_resp(dev, seq); -- 2.35.1