From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 63709C433E2 for ; Mon, 7 Sep 2020 16:46:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C5C3215A4 for ; Mon, 7 Sep 2020 16:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599497164; bh=+ZCX40SIB3C8UjN8xU0IOoWXxCKcI5Kh/UgQQx8xTVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WrR1/B4TDTRGGEwt4bw72fwceXo/qHr2zcKaxqbolm3MH8AAiUSDWYrzVPuGSHs7g wvAZq8r/HJxeoxRYsxVswFtf2D0HJtWctuHTL5AyXpARo68c0z6jSFcx8TUgxKeLUd UAbjYwsuDnSPLKyUK/3pMlMjKjJbhDW+AlBn5QSg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731102AbgIGQqC (ORCPT ); Mon, 7 Sep 2020 12:46:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:48940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729995AbgIGQf2 (ORCPT ); Mon, 7 Sep 2020 12:35:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C67A221E5; Mon, 7 Sep 2020 16:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599496528; bh=+ZCX40SIB3C8UjN8xU0IOoWXxCKcI5Kh/UgQQx8xTVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKObs8IXo8hh7idw5asu6qvA6s9mwQelNYV0Nh4YG+mNTUgRH36weD3Mw3YI4hNLs au7DKth1RuFQ34qHW6So5tpJOE1AJyFJs0BLZJ2ppXRPhBEhCu6fJcBaEhZ0xKeLOW k2MuN/yhjwBYg6uri+nw97V7v5q8v5Qts/fbueIc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 02/13] NFC: st95hf: Fix memleak in st95hf_in_send_cmd Date: Mon, 7 Sep 2020 12:35:13 -0400 Message-Id: <20200907163524.1281734-2-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907163524.1281734-1-sashal@kernel.org> References: <20200907163524.1281734-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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 850e75571c8ee..bb1e878913f3a 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