Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3303475pxk; Mon, 21 Sep 2020 10:07:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK9kDLYZsfPCHIzs/kDxv9yjLQ1mZoH7qtydEmtuMM1ue2gm7Yc0taxmpLZoM24uloVseW X-Received: by 2002:a05:6402:6c9:: with SMTP id n9mr608187edy.297.1600708036078; Mon, 21 Sep 2020 10:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600708036; cv=none; d=google.com; s=arc-20160816; b=Sl+rCiuOpWS1ePIle+Sp7V437ANXColOewpNqZPFBX6/tGcYAzihS3lqOdzrU8meOt PRnVw51JxxMBKw+dlW+sbpx6ihPJ2HK6YoSPlrtSQcTovcrr6wFrVJHa4OzdoKCAFpCn 8B9suaErXjWKU0PAhyk7z3H3y8CuGH1xADLiYpDjUj6BgJ1+ng6ZWTBacOYeAWRZDQJe MTyRQ/FCt3cqurzqzaZtbC8pgMga1Rrs83GI0CWEtKTGjj76HCjjJ3uF0x2NON5FaH/q rB1F02nBEj2pdDfh5frr8dSEmOga3BN124Cyu4782bds8yW1e2V1feT8etfZeGyvwnJc HQDA== 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=IEfTKzCSfehB2b1FzPm48BXeOPWW6CBUJoUmlXWE1jE=; b=yAkUDbITY0vZJNAW5YP2+mas6Wdgvx6BbSUwH//TM6u0lszPDnxsGMaOP++NkQMfjT MKERMNlxHSfrdilfqOw8b8hMRwzc8HoPxgpdayynsHnQKFDEHuP420QE07OOi9DTWdTC /7HglI9KeUYgOHjW2UiMkQCXM7qewrppNdGD4mr6ux1tzwPNhz4H4ILIeA9BVKTEBEyw xlpuj8hz/eLQrAdo/GHggjJZdL3m2BFuJ/F6DzSbkjSJ7Z5EVpYYnAdY5IxqvcNjZKUg qqMZUmnFcnb8BbvTnTzpgaFrrHf6yXysmwyeGWvo3Ypg1jR5q+0lOCBmjUuni83+QngW IJjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fh+8J3II; 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 pj4si8679374ejb.628.2020.09.21.10.06.51; Mon, 21 Sep 2020 10:07:16 -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=fh+8J3II; 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 S1730481AbgIURDf (ORCPT + 99 others); Mon, 21 Sep 2020 13:03:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:36950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbgIUQgz (ORCPT ); Mon, 21 Sep 2020 12:36:55 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 320A9238E6; Mon, 21 Sep 2020 16:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706214; bh=XbwKwVJGhjg2g05fL+HKZshm0QMK9+MQv21YwmNwFIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fh+8J3IIs7ovWUa5LqPqNFS96CP+z+udElWR+UNTIFWXFxKZKA3pEVpO8QpofM4Lp MfqFUe3TWdSHnvwPUY56/f2MIjpASJs9KIuEgiLp2nq+k0Ph0VtvMFVLp7nPyOxdsz VwTXFRJyF3ecrPDdRSvHxr+U63UYSNGyJ3Wp/xaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 12/94] NFC: st95hf: Fix memleak in st95hf_in_send_cmd Date: Mon, 21 Sep 2020 18:26:59 +0200 Message-Id: <20200921162036.100599806@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit f97c04c316d8fea16dca449fdfbe101fbdfee6a2 ] When down_killable() fails, skb_resp should be freed just like when st95hf_spi_send() fails. Signed-off-by: Dinghao Liu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/nfc/st95hf/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index 01acb6e533655..c4b6e29c07192 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -981,7 +981,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev, rc = down_killable(&stcontext->exchange_lock); if (rc) { WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n"); - return rc; + goto free_skb_resp; } rc = st95hf_spi_send(&stcontext->spicontext, skb->data, -- 2.25.1