From patchwork Thu Sep 10 02:23:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Xue X-Patchwork-Id: 7150071 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC6F79F1D3 for ; Thu, 10 Sep 2015 02:27:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BCE620997 for ; Thu, 10 Sep 2015 02:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B988320991 for ; Thu, 10 Sep 2015 02:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893AbbIJC1r (ORCPT ); Wed, 9 Sep 2015 22:27:47 -0400 Received: from mail-bn1bon0078.outbound.protection.outlook.com ([157.56.111.78]:26945 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752666AbbIJC1p (ORCPT ); Wed, 9 Sep 2015 22:27:45 -0400 Received: from CY1PR1201CA0011.namprd12.prod.outlook.com (10.169.17.149) by CY1PR12MB0715.namprd12.prod.outlook.com (10.163.238.21) with Microsoft SMTP Server (TLS) id 15.1.262.15; Thu, 10 Sep 2015 02:27:43 +0000 Received: from BY2NAM03FT008.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::207) by CY1PR1201CA0011.outlook.office365.com (2a01:111:e400:5b9a::21) with Microsoft SMTP Server (TLS) id 15.1.262.15 via Frontend Transport; Thu, 10 Sep 2015 02:27:43 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; intel.com; dkim=none (message not signed) header.d=none; intel.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2NAM03FT008.mail.protection.outlook.com (10.152.84.101) with Microsoft SMTP Server id 15.1.274.4 via Frontend Transport; Thu, 10 Sep 2015 02:27:42 +0000 X-WSS-ID: 0NUFW62-08-4H7-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 23A5CD16036; Wed, 9 Sep 2015 22:27:37 -0400 (EDT) Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 9 Sep 2015 21:28:02 -0500 Received: from SCYBEXDAG01.amd.com (10.34.11.11) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 9 Sep 2015 22:27:40 -0400 Received: from [10.237.74.14] (10.237.74.14) by SCYBEXDAG01.amd.com (10.34.11.11) with Microsoft SMTP Server id 14.3.195.1; Thu, 10 Sep 2015 10:27:36 +0800 Message-ID: <1441851826.5845.105.camel@kxue-X58A-UD3R> Subject: [PATCH 1/2]Revert "SCSI: Fix NULL pointer dereference in runtime PM" From: Ken Xue To: CC: , , , , , , Date: Thu, 10 Sep 2015 10:23:46 +0800 In-Reply-To: <1441782131.5845.73.camel@kxue-X58A-UD3R> References: <1441782131.5845.73.camel@kxue-X58A-UD3R> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(77096005)(189998001)(46102003)(106466001)(5001830100001)(23676002)(87936001)(5007970100001)(50226001)(229853001)(2351001)(92566002)(5820100001)(105586002)(110136002)(97736004)(5001860100001)(62966003)(64706001)(76176999)(86362001)(68736005)(575784001)(50986999)(33716001)(47776003)(4001540100001)(101416001)(50466002)(2950100001)(77156002)(19580405001)(19580395003)(2171001)(103116003)(33646002)(11100500001)(99106002)(3940600001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0715; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0715; 2:3RNEU3bUxEbDyNXTVNqg50AVsFqg39YjyFI2tJOspONlFHoG6WVD6wJWO2X9h4z/NH6S2Z9PfKGaURZGBAPG1CqwrxjsiSYslqNRNLTl1KVFHIc26fDxcjX5CBRxTNL6WWxKdx0VhW9RLKs3miltibZJqJGiDHY3QqmofGiqndk=; 3:AXhVpR8omTQ/MEdwvIm8DZAkm8CCMp4fIJ8nSPP65A9+D0zdFW5yJe++DkQmm/+qTvHuqAfdqIk41Ndm8BFDs4wvwJrUegLgx8vWGDVulpeotQzd32G1pawMSOUG1xmKQnAk6LtHYyPDgir+BVe8Y8dg4z0gdu7cPuQ/w6PtJ6l0VP+q+fiowJrpETlTj/5foDRdl/5vYte3ISQ9ib8cOoQ3OZDLL4fT9oWmk+9ZrgXXxSmjBpFCKpLPSZi9yFHz; 25:hIekOCqo0qUbu6xSwIhGoqmMPEvOe0xyjdjWfHCVAT5kulKcWevGUt3/RxQXtCVoY8tRrezkRi6up28YzeZgPmmxvyiRwhIK7mmDM390KusguC070ZbCkmW++SfFgx9yh043hGyuiftI4614P5SeFJCTRB4eFJvzQ7h3LZ6TBARjYBLwRU+5bv/jXbbXasrVy/OwQd3f8hamcAmEg1kt0q3GbQg0Wn+8kWXQCYWnlEp99jWG7vntD0gzf74/IyOunnECpHzKw9wyUbhw7iCE+Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0715; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0715; 20:XzYEAC0pwftL3mqspTPzPWVw96/v9er2xoAhyHiujCPB1zAsv0c6q/j5WYM89VXEtsWcDihEtInUzjsnngjkS8vrUO7ivt9OW4lRbirA1EQ1PuA7RJCW7iE3RONuQct6PP/aZOqRVztRy0rCmYCaZzwJP5/aSkDRtgNE+tmlTYZvgPw+FxRCsex+EBzLfTzL7ZsKi6W7SPA0zc6dWisuzqwLBomkXFYN+526qtIwrkpQB2WEIRr343vG6uuztBJFkPver1zlOgVNLMm+ZRthjtJrX4G1iiaz9MsvQCCv7N3PKiqKOBi1CzdS6MbptkEHmv/lw/8EA8gZgvqNaIUVJfrB2fPK1hIaJYjBVQYRgLnMozdUpNPfic2ErBsmAEZEKoT/0tAYRNhmfFQ8bS8INQkmbORk67+Gx0nO6dAGgBe52iHHXueNrbeyERaZ3tibLSgSmrkr5vhv0AW9yTG2rRXcWITTGmqRq+YmnUnzzV9/4zUJXlgdMVtyeYGcoe7R; 4:B9QzuOWrN+KlNyem2TtEePSwY1ixCr63AL167u39B80i43g6eu0Xd51R6X3AGGAXlLCz2pUcLlDOZ9bbujVbfpXq2NNo7SKkAa5B8vQ1SVV9A4AF1+hORm/Yzu/8pz1ScdVR7Jw6qMazaI5S+m9VDv2OtnFYt7gLAcdi2MvtsEyIvZ8uR7/GogDicHjkVyY95KWP3zc3hIKlhFt9XttfLNBuB0lDuYGcOZwLNceGo0XoB71m8f3f6tVi/JkhWQ7Vq+EBqpCrlUgzxHZHq8+xGYnahEfk6FOAbwjH7BWPn8nCZ0Gejc3OH122nBh9FZIc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(3002001); SRVR:CY1PR12MB0715; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0715; X-Forefront-PRVS: 06952FC175 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWT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03miGdmTo6R/f2ojsHhoDhyf9AWmQNGR1/bmAW78LubDbv4KamHOV72Ba3DWPpnA0JnY1aEdGluwJq0dBos=; 20:BI5yAN3zu3tnrPjRog6DwQb682JqMakG6SqG8APcDDlwDhVzaGK5JgbmDUZ8WAu6ccDrBOO5aaxydVpzdT9lsg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2015 02:27:42.8188 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0715 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Revert "SCSI: Fix NULL pointer dereference in runtime PM" This reverts commit 49718f0fb8c9 ("SCSI: Fix NULL pointer dereference in runtime PM") The old commit may lead to a issue that blk_{pre|post}_runtime_suspend and blk_{pre|post}_runtime_resume can not be called in pairs. Take sr device as example, when sr device goes to runtime suspend, blk_{pre|post}_runtime_suspend will be called since sr device defined pm->runtime_suspend. But blk_{pre|post}_runtime_resume will not be called since sr device doesn't have pm->runtime_resume. Then sr device can not resume correctly anymore. Signed-off-by: Ken Xue Acked-by: Alan Stern Cc: stable@vger.kernel.org --- drivers/scsi/scsi_pm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index e4b7998..459abe1 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -219,13 +219,13 @@ static int sdev_runtime_suspend(struct device *dev) struct scsi_device *sdev = to_scsi_device(dev); int err = 0; - if (pm && pm->runtime_suspend) { - err = blk_pre_runtime_suspend(sdev->request_queue); - if (err) - return err; + err = blk_pre_runtime_suspend(sdev->request_queue); + if (err) + return err; + if (pm && pm->runtime_suspend) err = pm->runtime_suspend(dev); - blk_post_runtime_suspend(sdev->request_queue, err); - } + blk_post_runtime_suspend(sdev->request_queue, err); + return err; } @@ -248,11 +248,11 @@ static int sdev_runtime_resume(struct device *dev) const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; int err = 0; - if (pm && pm->runtime_resume) { - blk_pre_runtime_resume(sdev->request_queue); + blk_pre_runtime_resume(sdev->request_queue); + if (pm && pm->runtime_resume) err = pm->runtime_resume(dev); - blk_post_runtime_resume(sdev->request_queue, err); - } + blk_post_runtime_resume(sdev->request_queue, err); + return err; }