Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1384810pxa; Sun, 23 Aug 2020 00:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVo+xiCMIiON1B5uG6qhNSUmrBvZ+DjiWrh/EMmALqiqDmzi80chCZxMrPZJwwH+ijLCpI X-Received: by 2002:a17:906:8614:: with SMTP id o20mr436462ejx.308.1598167505466; Sun, 23 Aug 2020 00:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598167505; cv=none; d=google.com; s=arc-20160816; b=WjtvQWBk8ndnfBEOweVl5TLUfXSeyBMrTW4J1O54LAaJutwAb6WbafQiiNL5BqMm+z PUDGlYHTKQLCF83bPQusvRD3JKanrbxKNfU+hVVPshUPm41GlWEsn/5zUk+UrEjE3vQq Fgf6Rvd17oAc6rm8C5zJ+wRGvrB+6kw4Wy7ufb5eCrn0XA/xso6sSx0wG3+sVIZOZdIM bsOiw9TPpFtcQ4hWQNueqQaxQjmhHj65bHaWK6jwufD5zSNlBI5v0WySDYyo00m0J4Oi inuu2VC1qcZwBZqQOe4QeREKras4fzUTXJ0F7UZ7zYjLyEsft4IgQ0g7om04lZxLt4H6 fYLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=raPViFIGCaknd7cjUVXxr+UPrJnK1h24rt8yyRmqq+A=; b=ygJWxXGoXD5h+k3vJYJ36eLVSqYcq51ok0h4nsglhi/hF6QOK3/k8XDkg2MMft6N+C fUXPNj8MC2/BbgMRBkVorwpS7ryOWQRhZpQfPXYr7Wl0LkjCTSoyrRWTB49GrIibOL7v awnYZAA1CL7ny/N7DSBtU5i+HycPmzhzEmgj7koHAK0B8ygFtPLKieGQLToPhPoF3PCd PT0YrNwyfOeWeHHBHifNMAxwmxv4+4ilSrwkP+8Wqbn2y16Zx8n3f/G6UOa0jRyaYJE5 Qk3wpcmcf9XqaUm7pVQXjqXEX2lKM/xRlMYbq/7Z9t66iqkcRhGd3seiUf3jcIxYKwtJ sJbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si576150edr.55.2020.08.23.00.24.41; Sun, 23 Aug 2020 00:25:05 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727902AbgHWHYD (ORCPT + 99 others); Sun, 23 Aug 2020 03:24:03 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:20876 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725981AbgHWHYD (ORCPT ); Sun, 23 Aug 2020 03:24:03 -0400 Received: from localhost.localdomain (unknown [210.32.144.184]) by mail-app2 (Coremail) with SMTP id by_KCgCHL2CCGUJf3g4cAg--.13666S4; Sun, 23 Aug 2020 15:23:50 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Colin Ian King , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] NFC: st95hf: Fix memleak in st95hf_in_send_cmd Date: Sun, 23 Aug 2020 15:23:43 +0800 Message-Id: <20200823072346.17140-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgCHL2CCGUJf3g4cAg--.13666S4 X-Coremail-Antispam: 1UD129KBjvdXoW7XryxZr15Zw43tryDtr1fZwb_yoW3XFg_Kr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.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When down_killable() fails, skb_resp should be freed just like when st95hf_spi_send() fails. Signed-off-by: Dinghao Liu --- 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 9642971e89ce..457854765983 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c @@ -966,7 +966,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.17.1