Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2657484pxa; Mon, 17 Aug 2020 15:43:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL639vuOqQGAdD7fbM/OyYCDBM4dsrWj519T5ToZquLrZKwvZw881LoAGaWHac/QiZk0mV X-Received: by 2002:a17:906:eceb:: with SMTP id qt11mr16751895ejb.519.1597704215718; Mon, 17 Aug 2020 15:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704215; cv=none; d=google.com; s=arc-20160816; b=CfdSanRU3hKsbGQtJpv67SbSRlfxY5vuydPTMysBBWwMbWkVB3ikuw6frmhtbs9ARj YG550nlI23XMawvVjhScv7FEpPoi1+wOXU8pNYjb7JsfGx73EGJWMA7sb1puhCp35WFF 927gJL316TatVDoMBvRlHnZ7mC+3oFHFgm3Now2yEruUsOYg532bC/j9xnrVvA1ENgch emH4eTESsnNO4Xbq06Uh8toHJHNI+KcCeyBa9xljeg+LcAZSIKx4nvLRrqFPr0Aza2/4 BAXmjCDNLCHQgznWDBOV6iAqv3KM3MMjvrPe5kRDTu0jgt/qKgcwVtNkiKagMGaJ84W1 8aug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w5IC8dZ+gkqxbsVwEAQxAOTxZYIfrlnGBUO2d24c0Po=; b=eLXUTMJi8kmv4WOUpvGDSbKTiwXX8alOha6APMYcQpR4QbPqX7gDZICXXB/rmFkKYs 4mVPXgkIpXDv++w0K4OquhaUqGoQcNgouXmMDYoI6cj8AwE6fP66o0Jcq2wASAt89bL6 qyWFDZJEfP5jxw101g7U7qQ3tNWuDM2054lS0ZtAX4O4LEUa9XhlELqxlupxFTANCdTT ktjkVffMDxfebYLbEPt1NsNzqgSt+ABwuUJMp8vdNv2RbNTuMUwEgeD03tsLv4oWOXWr D/8AY/LNE1CssqxPp04HdK4z1H4CDXBWsL508W+XsHQVgImrOxtU0m1bpDn6op/4gSFj zYQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kl95fow5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si11746092edv.600.2020.08.17.15.43.12; Mon, 17 Aug 2020 15:43:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kl95fow5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388075AbgHQSyN (ORCPT + 99 others); Mon, 17 Aug 2020 14:54:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:37038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387684AbgHQPvi (ORCPT ); Mon, 17 Aug 2020 11:51:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 50A6920888; Mon, 17 Aug 2020 15:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679497; bh=QZcpCo9ScGW3+oAFSbob6JjjsEdCo+0uTrz+AhIOvko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kl95fow5pkoF2LhltzsXO71uoUMUxtgkQPMgrLxyHSUAXrOi6QLhE/+qZRYoRFD+O 4pHm2jIi0nxCJMcyYnMorwsQd1QyAyfdVBjin6weR/6srkYXmqllCv0OTFLIz3EBEg KF071q4wt32IbiI1CerwZPTfx1/hfc1l4OFducyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.7 233/393] mt76: mt7615: fix potential memory leak in mcu message handler Date: Mon, 17 Aug 2020 17:14:43 +0200 Message-Id: <20200817143830.924540128@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang [ Upstream commit 9248c08c3fc4ef816c82aa49d01123f4746d349f ] Fix potential memory leak in mcu message handler on error condition. Fixes: 0e6a29e477f3 ("mt76: mt7615: add support to read temperature from mcu") Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 29a7aaabb6da1..9c55424962522 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -167,8 +167,10 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, struct mt7615_mcu_rxd *rxd = (struct mt7615_mcu_rxd *)skb->data; int ret = 0; - if (seq != rxd->seq) - return -EAGAIN; + if (seq != rxd->seq) { + ret = -EAGAIN; + goto out; + } switch (cmd) { case MCU_CMD_PATCH_SEM_CONTROL: @@ -182,6 +184,7 @@ mt7615_mcu_parse_response(struct mt7615_dev *dev, int cmd, default: break; } +out: dev_kfree_skb(skb); return ret; -- 2.25.1