Received: by 10.213.65.68 with SMTP id h4csp13527imn; Mon, 19 Mar 2018 17:54:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELsmzvFnP1S6HzvgbEYV2aEurOL1AgJTx+qnAvGQCE+6dcddh3WVVijD2whg0XR5gpWWlkAy X-Received: by 10.99.164.18 with SMTP id c18mr1872577pgf.85.1521507271633; Mon, 19 Mar 2018 17:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521507271; cv=none; d=google.com; s=arc-20160816; b=N1W1Xo9wXCcKnCjUslHRO8nTDTaTvz74j3qJEXihoiAK2CfoZn7ySkbVsNkza+GTVA MUtJgssyk0CRVzEou5f5+Dd02REODdUsAiUMju9ieltmj2KHaLbq/rS45EJzmBA+YlVC LaV9xqSNkdeR9QLpfQgmKRhUjudxeZv4WRLNOngDzcUvCGoUFrQdxink/94grlxQm6JC 768ZI5snnyEHw98FFqDaFGlK/KS1J7NvBLQ34FWnL76wlEEeeqJ6xFCynMZogITECmqn UJC3qVtGVNNGozVhXUaDTticwDfFDGSMX/JqnJJxuvyjUXh3yzF13l5tSLrdgrtbh00n 47Zg== 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=pqI1J25N6eKNXxs+hXh0ILEHJlLh304pmOQDUmnGKFU=; b=TFAxRjZzrVgPbnxZvgsA9kLaP2b4mop+YaIc+zxmwAadToD95dGS9L9k6AJrnOR9Fh Bdfed/Xc9ipnFf9TiRA1PKKIJYZit2Ja90g9JYrosehokn6BZIH9E8MhmWTXPhvuVN+y bUYax1HjNa20Xh557JLcD6J0glI6a12Rvt73oJvd56TvKJ+M+qmC5zEy5bJtfrD5CYR/ r9zYypBqUqspMVfGoQbKoL1BMTWp2I4CCIXBfBFfvazqei9sTurPCsVhtsEVbwLQvNui Qx2j+eSFfPK9KRxxM5vBeBcpUqBzxr6nA4j+/LbtD9urHY6VAATMxRuX74UqvXYzjiq2 Lkow== 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 h1-v6si432039pli.645.2018.03.19.17.54.17; Mon, 19 Mar 2018 17:54:31 -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 S1031217AbeCSSWI (ORCPT + 99 others); Mon, 19 Mar 2018 14:22:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48346 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031178AbeCSSWA (ORCPT ); Mon, 19 Mar 2018 14:22:00 -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 A82CE1283; Mon, 19 Mar 2018 18:21:59 +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.9 091/241] NFC: nfcmrvl: double free on error path Date: Mon, 19 Mar 2018 19:05:56 +0100 Message-Id: <20180319180754.971032745@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@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.9-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; }