From patchwork Mon Sep 21 16:26:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 263569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0ADAC43468 for ; Mon, 21 Sep 2020 17:03:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C243720758 for ; Mon, 21 Sep 2020 17:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600707822; bh=XbwKwVJGhjg2g05fL+HKZshm0QMK9+MQv21YwmNwFIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=upcasaOv/VQD7x8sFw+4Ec6krjue7h58X7gGi29AU3HRgHA/Rpb+wLWkBA/9Z846O sjIUosCsOJgeJVm8dMROsZhnv0KuNKKH8UZQ2oSGZKeO0+mck1+AgZP+ew2R1xzWlm ZS8NW7QT3NjrwR1duMSD9Gn+bucmSvOx8EgGP5JA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbgIURDd (ORCPT ); Mon, 21 Sep 2020 13:03:33 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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,