Received: by 10.213.65.68 with SMTP id h4csp2116468imn; Sun, 8 Apr 2018 20:07:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+UnUj+hXgCWubyVPV9/ODoC9kYjoJ0ftyoAusBNePOxREIC4xQoVqqwawtJZLhzoImk4LC X-Received: by 2002:a17:902:51ce:: with SMTP id y72-v6mr36372811plh.157.1523243242592; Sun, 08 Apr 2018 20:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243242; cv=none; d=google.com; s=arc-20160816; b=hy8R1tWtFVVU9DR/5FZv3Jayc6EO/PHv8Ir+61+Sxk+kVCK6eMIdCqY0ge+NvhNcqN suGXG+DQJfdhtIT4PWTG2NxCcYoS1XB1Z8algnHHWYhM6UyxYPvNXIZQbB6g3Az+pu/u fYQrnPp9ZrJdGhO0eJz4YcII6Mq6DrUP26j/JJPlloAaSEQc9W1zgs3jV/d0cdZ+Y4Nf bDWSE/H1DSjX0sUjDow3/GLCYuZZtAb5KhyVxUbzNI/dSYOxD705vdfMosLbtMdUJjcp wbfZOKJsuE/ZKWj1rvklMfLy3Yu4+iSdNwKo1EEdv2wTfjHjqh/nGft9BjjfNlamgSM4 rHbQ== 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 :spamdiagnosticmetadata: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=PMh7TcrKyrl3BAqELtodm9eWigni+3eH3zn+ZIestcM=; b=ZoMbVZfO2ZCAk52YmV+0vvnX+0QNCWCVg4hhAR8NoououA9OVbLg+W1c8Fwe3Jd967 U4+AvXL11AYOo43do95izanQ7GfS13IJCs6kX/xC8H0z5WhlJnbvShiL8s7Iz3BHzT7t +P+q8o0OYWaj0wty75c1pP4wXOhDRbNJ99eg5Gu/DjJdFa9g3Bu7RK3WVfA4qUQMHcwo M4Lx7hTLT1IIIZ7T3UmA1/v4dDRB8QqTlScw2Hx0h2RD3ZK/HDNe+OEtQcO8P/Xtu+EZ zbVs4RgVUe+giYwVhoLNF7TWSQGvbcUAPF0zW03QECQlVMfdaMuIBzrvxQz2YRbgNQr+ 1QhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=QesipJ7c; 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 e63-v6si13724120plb.91.2018.04.08.20.06.46; Sun, 08 Apr 2018 20:07:22 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=QesipJ7c; 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 S932261AbeDIBXA (ORCPT + 99 others); Sun, 8 Apr 2018 21:23:00 -0400 Received: from mail-sn1nam02on0113.outbound.protection.outlook.com ([104.47.36.113]:53303 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932727AbeDIAhF (ORCPT ); Sun, 8 Apr 2018 20:37:05 -0400 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=PMh7TcrKyrl3BAqELtodm9eWigni+3eH3zn+ZIestcM=; b=QesipJ7cKpXvFEwOuzQ/4+2zfc9TKsQFgDmL/tlPMnM3BO/YvS6Ml1O98o4LRnRb9VWAk1HPOSMJWqI3Nl2TkjMzNOeZsX2szqBKZAvXRYJqmNs/Cs1yf5/+um+GQJSZ6Uz3KNN5xOGFTd73RwmU/1lzxvRPA5oxMqoduRWsJck= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:37:00 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:37:00 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Johan Hovold , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 078/162] scsi: sun_esp: fix device reference leaks Thread-Topic: [PATCH AUTOSEL for 4.4 078/162] scsi: sun_esp: fix device reference leaks Thread-Index: AQHTz5m1mPzBILJ5/EKmfT3f7bBSaA== Date: Mon, 9 Apr 2018 00:28:40 +0000 Message-ID: <20180409002738.163941-78-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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;DM5PR2101MB0885;7:ZmwHRLu4cWxBbakFfDvncGw2Ps/dQTWq7uGHK7PgLnl/uYTBIbj0PrZVxyulkLH55fQJm2Tv5D9SPthCtsQWdbvyCVD6ueCKmDXpyd0S1N87mitUjJiXGs//aZyq+tswIivzoRu/lksnBRWgB6scsFH892yOFc46XTsPjQ7En/Cv6aa6Fh3ATyOa3N5CXB0/zmCo7IJLCleHmHB3uPZOmh6aFKnQMdJeLOaakOFlV6Ip358jPCRXoicytlMqWxIG;20:l3UkblJmrruGQsc7/TVLsBEz5R3+XuwgmANjZB2/JhugXwDpxrovUweUdkuINONn36x3fkG1zqefXZnsTjJheWwRPLgELDf9SsHPYd+y/tfc+YwK3kaqXBIqlTTbq6WQbCeiUpqaoNHbEwgFUbsvEgYnFt77oxlGIAhLAzvRU1k= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: ecd1bb3e-8237-4d45-f085-08d59db201fd x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: 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); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0885;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0885; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(376002)(39860400002)(366004)(346002)(199004)(189003)(66066001)(3846002)(6116002)(59450400001)(86362001)(305945005)(10290500003)(6436002)(5250100002)(3280700002)(10090500001)(3660700001)(6506007)(2501003)(107886003)(446003)(53936002)(11346002)(2616005)(26005)(76176011)(7736002)(478600001)(476003)(81156014)(25786009)(8676002)(81166006)(186003)(8936002)(4326008)(97736004)(102836004)(99286004)(14454004)(36756003)(6512007)(316002)(2906002)(22452003)(68736007)(54906003)(110136005)(486006)(6486002)(6666003)(5660300001)(2900100001)(1076002)(72206003)(86612001)(105586002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0885;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 2Okpc6yXJ39zOnUrE9M3nbBclnjhPvcpBix8GeDzo1HVXENogQ5XDG+pQ4k0doj/DB5ig32szv3uyoQFslHgtyzVQe5kxSNxx44TUVtQhSDgwa24D0lZDibRHIy8HuIr/BLUEJQbQaAtUPRKZg89Pih+LxSDpUcGXsHo+V84U6AAnEs4rEzCT4Qenc+biVTNwY13lUkWrdD/YInEzOc8MTHv1JcsVHmAMJgj+qGlCw5jppgZXtB6bfk1vxPzIMYWZO4afEfj8ODdejPssXmrOurHOA4nuTneudRnlJzZcfoDtAIQ0F0HqSX7Casikcv2+gfMrxne2BVvOcBXvc8nka59v+PtR0kHMj0tQi8Cv2O/aRHh7ibm7H7WAEseWFpwsu9wvRgegRUiBP2K+p8h/I/ifmqTF+9nHw9NjwG2uBI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: ecd1bb3e-8237-4d45-f085-08d59db201fd X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:40.6458 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold [ Upstream commit f62f9ffdb5ef683ef8cffb43932fa72cc3713e94 ] Make sure to drop the reference to the dma device taken by of_find_device_by_node() on probe errors and on driver unbind. Fixes: 334ae614772b ("sparc: Kill SBUS DVMA layer.") Signed-off-by: Johan Hovold Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/sun_esp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index 7b6d4c2087d7..747ee64a78e1 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c @@ -566,6 +566,7 @@ static int esp_sbus_probe(struct platform_device *op) struct device_node *dp =3D op->dev.of_node; struct platform_device *dma_of =3D NULL; int hme =3D 0; + int ret; =20 if (dp->parent && (!strcmp(dp->parent->name, "espdma") || @@ -580,7 +581,11 @@ static int esp_sbus_probe(struct platform_device *op) if (!dma_of) return -ENODEV; =20 - return esp_sbus_probe_one(op, dma_of, hme); + ret =3D esp_sbus_probe_one(op, dma_of, hme); + if (ret) + put_device(&dma_of->dev); + + return ret; } =20 static int esp_sbus_remove(struct platform_device *op) @@ -613,6 +618,8 @@ static int esp_sbus_remove(struct platform_device *op) =20 dev_set_drvdata(&op->dev, NULL); =20 + put_device(&dma_of->dev); + return 0; } =20 --=20 2.15.1