Received: by 10.213.65.68 with SMTP id h4csp1794038imn; Mon, 19 Mar 2018 13:26:56 -0700 (PDT) X-Google-Smtp-Source: AG47ELuz7h1hCPXzPEe6RlB7CdJ8C5guUZNUYF1CoTbfEo3WT0lzp2UgNk4t2lmvmCAHbh3xSAoH X-Received: by 2002:a17:902:1a4:: with SMTP id b33-v6mr13999481plb.321.1521491216285; Mon, 19 Mar 2018 13:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491216; cv=none; d=google.com; s=arc-20160816; b=nLciQsK96nfda237euXxgGoFhUgWVJmyVil+tmk9cKI5H6hf5FFmt/54k8N5wwYQ+K GSts/d3t8ZRuW7APkoycyUNLiPd9cFxBXd18+Js9LumlPfuDG58tNxsKrTdxhwAEiEqc +imS10O2DkhSJAmap/NaculOhEiVLxC9BuWwCDobFA4mamUfNj+91nbhu9ZUPv/ui0iK vrgaUj+T0rJlgO0J5euEeUx/+mBQAzRxyaEFxxuqByy0VHNqUc+U8+IcbNnLaKYfIFmx N7jrkytttlVujNxVQNxAT1KjQtz4mtuxTQGbMW9skm5ZHZc6x7M22U5GnEl1gyTByIT7 vj8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jyUtGWnLHAtnPjp6Rp5AjDqHozdB64dhUM/SDORUCgY=; b=og5OZjPpaQgAso5uCdWPhN84TwS7oCkmjiC52r3CmAFRj8uuitgB+naIEaxgkpgZvx CZy2/BlPUMSOgNMZ6lmqHsxZBqTqbcAX2Od/uP2Q/DCCul0G1b+/Q+68ZgWzCrehzQOB XD5Kyp/+1IV1ei6HkDNmX9w0YlCkLKInBlGgYDpE0mfSCuGFsqMXAJGsMnWSF/YRG3k9 H3VaZKjFaP7V0Qden4tZ1Vd+srgPdx3o03BVoLwIPuNKwohCDozYyUH3f8BA+fBDmSIz auJehK0oSrzoa8g1QNtRtiqvbXMq3gFmKf7wzALz4A9jT0WTY1NIFnpnUEAj4LLeXTos 4UBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si17514plo.746.2018.03.19.13.26.42; Mon, 19 Mar 2018 13:26:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030613AbeCSSN5 (ORCPT + 99 others); Mon, 19 Mar 2018 14:13:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43836 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968801AbeCSSNp (ORCPT ); Mon, 19 Mar 2018 14:13:45 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 087A388D; Mon, 19 Mar 2018 18:13:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Samuel Ortiz , Sasha Levin Subject: [PATCH 4.4 046/134] NFC: nfcmrvl: double free on error path Date: Mon, 19 Mar 2018 19:05:29 +0100 Message-Id: <20180319171856.024098991@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit ca42fb9e52d155547e6cf18cf26bce3e1a6af4ea ] The nci_spi_send() function calls kfree_skb(skb) on both error and success so this extra kfree_skb() is a double free. Fixes: caf6e49bf6d0 ("NFC: nfcmrvl: add spi driver") Signed-off-by: Dan Carpenter Signed-off-by: Samuel Ortiz Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/nfc/nfcmrvl/spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -96,10 +96,9 @@ static int nfcmrvl_spi_nci_send(struct n /* Send the SPI packet */ err = nci_spi_send(drv_data->nci_spi, &drv_data->handshake_completion, skb); - if (err != 0) { + if (err) nfc_err(priv->dev, "spi_send failed %d", err); - kfree_skb(skb); - } + return err; }