Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930174rwb; Mon, 15 Aug 2022 14:16:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7wytMUxXTl4ymoyhnBZaQ4UToqKEMti0jKgOttsqaYMoiXBsDyfP+gvU6VZwIC/tGj9zy2 X-Received: by 2002:a17:907:6095:b0:731:87a0:b9e8 with SMTP id ht21-20020a170907609500b0073187a0b9e8mr11692141ejc.124.1660598160868; Mon, 15 Aug 2022 14:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598160; cv=none; d=google.com; s=arc-20160816; b=XfIWKj4gnOkou6hi3D36gTme5ULFRncCDEcnPTgpOYrNYi948miQVW6JaLHrqQ+Yvl 3uM/K2+Jm6rezmzuiQCHSJ6ydCJMqeTy9q24+ek7f+SWlmTEoiy4pICb6JN6dQTIaBJ6 CCgkqmNb3ahvjIBYr3QIyPnpcJ74iL9QZiVBwM4kyv/AT6eC08JQJSjraWCXd2cBYcGD OmTRcljp8AJx+CHej3njLW/1EKIIHtdSZwaPg5GOzyAkJvLcmgu0/arVTt8P2F6gstW4 O/e0Em/NDDeUywg+MyzLk/RBnWTtWIl8SqiEPxTra7ketZIysG7S/h47dWIueR4dlljW Z7lw== 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=mIc0nFmK7oxC6PGrwdNilAEilzxe+qWIbfB1oTdt5vg=; b=zTKML/aBMQ7D2/V7THl7UE8JOaFIRNCRWHDxFJ1+38KW2uSd14rC5eCdFfcBlRedLS 82JzJ7XG9iHbHKBJQkuocMXSFuelTjktMiZVIFo/gkNdiTz+YovpAzj0/KmzHD3JEDm4 IZ+p+BXqMqD7Jq8lLlp1ZJDNNsawMFaByaskfmYtITblBWmaWg/Fc/pMgismsu4E/HkZ KBFmUGn5GfUa97xG/li4BkrrxqD57Euxoaj0Q9kkH1pOs0KTmnjlmWYPo6BO2t10VjPp y4pAY/9kPgMPncUnwDUhWl3rkZxU+LpIBY8eGzQZCKXDm2RzqoFlUXCPBNUgIVJFIQNA AHVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QPvTjG42; 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 e41-20020a056402332900b004437a69282csi5115905eda.167.2022.08.15.14.15.32; Mon, 15 Aug 2022 14:16:00 -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=QPvTjG42; 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 S240339AbiHOVNS (ORCPT + 99 others); Mon, 15 Aug 2022 17:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347926AbiHOVHq (ORCPT ); Mon, 15 Aug 2022 17:07:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405663C8C0; Mon, 15 Aug 2022 12:16:43 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D369B60F68; Mon, 15 Aug 2022 19:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4F13C433C1; Mon, 15 Aug 2022 19:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591002; bh=b7hS5d454oaulv4KcfZU56i0AKfffymxFdCbBxiLZoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPvTjG42Ksy1wyr1HvbLuQ64IpIFN7qTuPMN2FUr4kJ2s8g7lfRUqmGpXsb4TnJCe qQCYwTtXvBZekClXowBmJcF+0rcKb4CtmZi279YCzYe9NRaC70G/QDntF77RIY2LsP loUu8iopxNm5JSHM8UGgLBmrpXT/b40pmDninzFM= 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.18 0441/1095] mt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg Date: Mon, 15 Aug 2022 19:57:20 +0200 Message-Id: <20220815180447.895110264@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 2953df7d8388..c6c16fe8ee85 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