Received: by 10.223.185.116 with SMTP id b49csp1088646wrg; Sat, 3 Mar 2018 15:14:28 -0800 (PST) X-Google-Smtp-Source: AG47ELslwH1bKOyek/mwsoWwooQ6Syw2m3zG2OWVmQhDP0YF9Ak/C4NIPJB2jmjCyCYdz3O3BQiP X-Received: by 10.98.242.6 with SMTP id m6mr10286717pfh.230.1520118867930; Sat, 03 Mar 2018 15:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520118867; cv=none; d=google.com; s=arc-20160816; b=EkIYh5zjU89Gbu2LWJLAy44s0qmv/Z8tHs5lSPwSs1g2dlhWCBBfS8uKkmg4jToJAf 09E76whRdqtydwcmHYP4I3ifW+C916pmHkjr+htnIwA5QrbJftTdEGU6k/32NdGp38Ml kVlZ85ZiAb1pAHgsUGmFZSrYA5zD2VFIibPH9XEZotiA0QR89U4xfBhZfgBS+4u3dQ1g Z03yBjv/LGLpZ7saZxl60q6B+YYXiTLI5n48K0n4EadSKF18dGAweQH2r37fzSGKakTi HMH4oWev01XN41j+wwhNgOe00s+/ydgWWT0ErDqp/my6IolzeXU/PlwJDxeeLcgoRqNa 3xVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=As9Lo78e1k4mTTSnlPQ4cJtKCu1ZKKL/kOL578lu+DA=; b=WnIC2y8PKHCr26rE3NGPDvp6k94VIi53pwZzOAWyHx9eLvH6gIvyCCQIgPfZqIi+u5 npjvfryQGJG6oxEn8UecG3OEwH0fkYNAt1YB8udUf36SySitCtdQ9vOYJC1VGScJxaO8 5qpYbyVo/o/3xPonD2ijg9HCNbItOZjqw76blLIUpPDLz8SR25R0FUFAxk2XhVCe5g+L lINJg6GUMOUEm2eMDyX4NlJJnXKAhcbOO3dKmhb3ZczucIXZ/v0U2j5197j4AxEx3h7X JvF6JUsfgqdQkJEaaRFIwl63BuIJhWecj93T47UWarqFP0gzr+6vRy5OZtii2kHujgWN 3kig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TnVdsshs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r13si6073244pgp.504.2018.03.03.15.14.13; Sat, 03 Mar 2018 15:14:27 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TnVdsshs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933916AbeCCXM1 (ORCPT + 99 others); Sat, 3 Mar 2018 18:12:27 -0500 Received: from mail-by2nam01hn0231.outbound.protection.outlook.com ([104.47.34.231]:38014 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935046AbeCCWjR (ORCPT ); Sat, 3 Mar 2018 17:39:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=As9Lo78e1k4mTTSnlPQ4cJtKCu1ZKKL/kOL578lu+DA=; b=TnVdsshsuBfL1IFHAcU5roi+eKosqwKQCn0lwvswGLJxC38uxR8ikQVXizMvPFle3YEV3vpVtXjpQT01RRauTrIvHzJB7kwtLCiLtNJxWdjoJBO9k2s4xtsffSDmADB9O+BsWSC/xHHPavvLjuD620PjKpuq8Db6z8izlVd3rjQ= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0938.namprd21.prod.outlook.com (52.132.146.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:39:15 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:39:15 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Dan Carpenter , Samuel Ortiz , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 047/115] NFC: nfcmrvl: double free on error path Thread-Topic: [PATCH AUTOSEL for 4.4 047/115] NFC: nfcmrvl: double free on error path Thread-Index: AQHTsz9XTzoODMz9/kCtOXqzsbOEPQ== Date: Sat, 3 Mar 2018 22:31:16 +0000 Message-ID: <20180303223010.27106-47-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB0938;6:24mid5t8SV8Vt7ZI9/ttceLilzm1jeVTXE36gCmChB8/sfsd0lkatA7MtBHMW9CWKGp8ZilIKQ0VOpGQevBAIYBeFe6XeOhEBNnitflrBq7dWB7d2/j2066/7ehYwSkPR72ynglgd4C99VjHW0gSdD0j7Hm/FKxXBIosKhV4DQhZT5LMe/Y4aZd+OC/KsBu7oqTdlIGuEv761VS9WRvlsRsNbGqxolCTB2gZHd50QqjZ8knwDnEMwmTsBvjBXT91IRE3PcMyNnMSj2OEwcNhu1i0AM1ZWmCLWsQobkk98lfFyq+3Q/uus+E4ALjdMifGQydxJSMXQhkr2FjKA1XaGsUek5xLQpuRUwrcqq7iyPbttBiZNcgmB4lUonX/s/Aa;5:VOQZjzpMjFqW5e3nq2XA/m+/4fgC5FiilydZNG6roA8sqXP9LsdTyyIrmiMwSvQws7d2SX0KrnBPNxduE1O27MOJR8xMbAwn6i4iEfBFyEBTX/e6YILjED5WhdqYx18hg7PCmSezLDp4obAMUSaerzCbvRQdxYM2s43Jv7dTq2U=;24:BXZ02yjKAhyBPL0SjQ7NTUGS6fqY8qDcEcbFyWwsPZTgRR/jU3Nnc3C72H1rpDqyjfyh9hEZ3G+hAi5Ykoj2SQ==;7:q8PTDPFPSIOkRo2AGgQBb+opZ4IRD5lyFaox32BARAGWHqiOPuB6Xc/ZhbmfzDohGgDIPqjO+HHZrlaLIvF9lrDyEMHc4ol+uftiVJLPZqbSVbG7yEUuVk00L4KWG+ukwLRjDF8rCEIuvj9vt/RSoy4aKjD4TliySPLpS8KMc6G3d2636y8PEmUmtitablErPyYDFAL7QcCkzbY5DLISneWbSVUnXH7/sjxc9Ssyy0Z8GRpsefID9byk6pRSYjff x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 42f30c27-32ce-4fe1-4feb-08d5815797fd x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB0938; x-ms-traffictypediagnostic: MW2PR2101MB0938: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231220)(944501244)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB0938;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0938; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:SPM;SFS:(10019020)(39380400002)(39860400002)(366004)(396003)(346002)(376002)(199004)(189003)(54906003)(4326008)(72206003)(22452003)(478600001)(25786009)(66066001)(6436002)(6512007)(14454004)(53936002)(2906002)(6486002)(105586002)(99286004)(10290500003)(3846002)(106356001)(6116002)(305945005)(5660300001)(110136005)(1076002)(36756003)(316002)(2900100001)(2501003)(5250100002)(10090500001)(102836004)(68736007)(2950100002)(26005)(97736004)(186003)(6506007)(8676002)(107886003)(3660700001)(7736002)(575784001)(86362001)(81166006)(86612001)(81156014)(76176011)(8936002)(3280700002)(22906009)(290074003)(133343001);DIR:OUT;SFP:1501;SCL:5;SRVR:MW2PR2101MB0938;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: GZijPFdeuIrLosLodti+f0s6tW+8sSNkTT9MffpqIyZBJeeBe2UgsaODaRBgVVzYRiwt58dvRZfL8p1NiWLSpEaJ5Hjf/NFi2K9rJPXeTKkUfLXOvwjA/5YCHAbCG0ZHNe/e/7S8/44oVZb8K6TcO2g2TK0dA6/jSWoX1zOQEc8= spamdiagnosticoutput: 1:22 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42f30c27-32ce-4fe1-4feb-08d5815797fd X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:16.2915 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0938 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/nfc/nfcmrvl/spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index a7faa0bcc01e..fc8e78a29d77 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -96,10 +96,9 @@ static int nfcmrvl_spi_nci_send(struct nfcmrvl_private *= priv, /* Send the SPI packet */ err =3D nci_spi_send(drv_data->nci_spi, &drv_data->handshake_completion, skb); - if (err !=3D 0) { + if (err) nfc_err(priv->dev, "spi_send failed %d", err); - kfree_skb(skb); - } + return err; } =20 --=20 2.14.1