Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1086403imm; Wed, 25 Jul 2018 11:14:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdUhd3KxfLBYivLq+YxDr3iAGCRioE7DQsrI8dSq2v/pHJidXRQc/tuySPrqSkL5xveKXmM X-Received: by 2002:a17:902:aa87:: with SMTP id d7-v6mr21962457plr.215.1532542452172; Wed, 25 Jul 2018 11:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532542452; cv=none; d=google.com; s=arc-20160816; b=zDQIJwSwSgiBzpp5S7dWODWdEVaB9dOiru0qRQVkjvt2A8KwpfKs+2ttxI6dMDaqGM ZeUTj57kjJ090sfHcIsZEACzVceDvUtVpRAJcQ6aSJDmMiqPuHZq+a+G9bG483BlHVvE zkuhlADPl6g8RFBAYPzJfurqDSIpCcbkeyRfPl2pMkr4RXWWWCG+6lJQqE9ZYejqlDBN ivZ3pvS6fG5mLAO9qM5hUknIz4VKwG61PgUAwzqolTgpW5mZBHGjIibWvvb+L/nXV1sy Il03e+ln47YBQ+MuldUBX4AbHA9qS1qfurdvQn31KRjs8mO/PSrNVmIZGpx0z5EQLKhk TB1Q== 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 :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :wdcipoutbound:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:dkim-signature:arc-authentication-results; bh=YFJxO/BQ4d9uWZERaRt9R+9TkFXX4TmyD/GFRMUm/hE=; b=Z6wkWf3op0dc/jz2UkaT2xHH/xFEdtnwBDBRpA6NO/tI9cw+jmlprucUPj0Oc+3EYg ugSkvufO7/lKemhGXNq7L0TlAJQXPa6CW6ER4CZ0pnGXiuL8P8/IcQ2HSmY0zSgU9cgF Fc4qpSTgfJyt2DTBtT8/XnKvC8JM9Z5sHVH5QhkP/ci6Fhzi+JZHxL3LZzjfiQq1KOwf /jCtxP7/JFU8RJr6k938E2NfsasryIvNQYqsRp7BbJ8V+BufLSnzTaS7X4MMiI98kzRd v/kWVmHP5eOFl6iqZ/ONO6T0SUBbb+kTzLSqbn1KVmNvFV+KoRDGr0ltHHP4gPkj14kC 3iZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=o4BslouZ; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector1-wdc-com header.b=KLA00tM5; 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 b8-v6si13844626plb.125.2018.07.25.11.13.56; Wed, 25 Jul 2018 11:14:12 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=o4BslouZ; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector1-wdc-com header.b=KLA00tM5; 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 S1730265AbeGYTZx (ORCPT + 99 others); Wed, 25 Jul 2018 15:25:53 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:45766 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729514AbeGYTZx (ORCPT ); Wed, 25 Jul 2018 15:25:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1532542923; x=1564078923; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=K8MbWoLWqIDG6vwJHvXcFxNWI83uHWt88nSOabb8vQU=; b=o4BslouZNmVBx96fN0xdBDBMyks4afGCVymaiXcGVnKinYChuQLMfITF ErgahSQnPj/JOn9ssCn62xjs+YGCSaYaGl84vs0zr7GhUWCHtgvjFHd5T 37oZ7tWBzV3jZTclXt0LYQrlX3wAujchELsOYz6OMJSjiRmWbHl0VHzwu bcEi8Gr9HQgw1iPJ7eqKqtLKqVUe05dok8urI5rpXE9ayoMn3SJg1dyVl itLM9zBHFinWhzjbGmurI0EGVIHpUkFkhDJH5Tf+pz5vonxXHSpAuYFrr PCwRDwX6Zm557a+FBoOIHuTQlc/CwonkZZ2AIkfEMnvjc0S83Wh9JuvK0 w==; X-IronPort-AV: E=Sophos;i="5.51,401,1526313600"; d="scan'208";a="182126521" Received: from mail-bl2nam02lp0080.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.80]) by ob1.hgst.iphmx.com with ESMTP; 26 Jul 2018 02:22:00 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YFJxO/BQ4d9uWZERaRt9R+9TkFXX4TmyD/GFRMUm/hE=; b=KLA00tM5M4tzNJM4qJjlsqK+ce9+1qPENpr2VGkVgGXbL0rveyGjrDx3TCZzwjvVzr4Y9L6xEPdb0cksW/O1lUpzqvip5FTcy4Ed5lRRJXDFM0NSt78KFklm4JKnvdek6ef9Knxb6Rn6beUWALXT2e7hoc+jN5V0X2JOtLaCpyk= Received: from MWHPR04MB1198.namprd04.prod.outlook.com (10.173.48.151) by MWHPR04MB0944.namprd04.prod.outlook.com (10.174.174.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.21; Wed, 25 Jul 2018 18:13:02 +0000 Received: from MWHPR04MB1198.namprd04.prod.outlook.com ([fe80::29a0:6668:ccc3:c397]) by MWHPR04MB1198.namprd04.prod.outlook.com ([fe80::29a0:6668:ccc3:c397%3]) with mapi id 15.20.0973.022; Wed, 25 Jul 2018 18:13:02 +0000 From: Bart Van Assche To: "ps@pks.im" , "axboe@kernel.dk" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "ming.lei@redhat.com" Subject: Re: [PATCH] block: fix NPE when resuming SCSI devices using blk-mq Thread-Topic: [PATCH] block: fix NPE when resuming SCSI devices using blk-mq Thread-Index: AQHUGq56yXYBAcJcykKCTi0snJ4SPaSgUOAA Date: Wed, 25 Jul 2018 18:13:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [199.255.44.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR04MB0944;7:svgipxt4+eN1hUGDHBRYKTJbFEF9sffxERoLau18t+APNMoPCtRVmIj3ehpP3puHls2soZ+9S31qk0Xg/bjf3XSNa/otNrMKfcIugyos8kDQhdNq869uw9/qsi6ny/4Syk+D8dHr8TVfAiMehLB1Klcb/27xT3agfn+b+r28ZoHpV/39ee17lVoUfQRf+8MiKy5Q1QpTJehAZ1EIuk8ubDZXrSIkQ9t1ICmfN8vyYLIHzpXMUo+un7bIeNgJB3GQ;20:jgm8kQsvDmMP3pMtYYhKNXrKZLU0Kdgh5VNNCEPBvOjji+GX4VzlmQDUdA+HuBr4Zx5In9SUVOAY8K+GxFVu41PanyhiXfQ8oCvfaxXRRK2RWJvO5X58WZuv3JK8DzlDdl6YuhSTjqWl2ic6lzzWZuxavLYq86AF29s1EE+iSQE= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: cacea4e1-ac55-4fa2-6248-08d5f25a42bb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:MWHPR04MB0944; x-ms-traffictypediagnostic: MWHPR04MB0944: wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:MWHPR04MB0944;BCL:0;PCL:0;RULEID:;SRVR:MWHPR04MB0944; x-forefront-prvs: 0744CFB5E8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39860400002)(136003)(366004)(346002)(396003)(189003)(51234002)(199004)(6512007)(81156014)(8676002)(81166006)(2906002)(14454004)(72206003)(4326008)(76176011)(54906003)(229853002)(5250100002)(14444005)(6246003)(2900100001)(66066001)(86362001)(486006)(53936002)(68736007)(316002)(110136005)(2616005)(7736002)(186003)(26005)(6506007)(105586002)(118296001)(97736004)(11346002)(6486002)(25786009)(478600001)(8936002)(6116002)(2501003)(99286004)(6436002)(102836004)(476003)(106356001)(3846002)(305945005)(256004)(36756003)(5660300001)(446003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR04MB0944;H:MWHPR04MB1198.namprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-microsoft-antispam-message-info: QN/iCR6TOdl0Gg/GKeQf1IID0TdKy0SmQBoywFjrobdUzG7ZMNzsUcBSNrBXYUimW0YiV/Z7vV9NVKqMFhtAqkHkBUy5P/VVyg/EzlEU3rZ6ejobeNMASdyhZVOBL69dhNNbp58Wb4pc/lh9STZRpeYRLdY6640gB/tJTWL8kIs0Fjfxtg+L+EWG5mnHbhzno0EHazz4oUYcza6hOWwLSL5hYBPr1slvJ0lIfOpNe6riSiQfyG56NcMSsxHcW0irkZ7X2HXmRud7jHAKfM9WOKtTe72kbG1BRFlGTNnwXJo7SQIT+rfvjvPM9fCWf1nVOIpv+lZx8YcrS/RunrPCy8qqnIeaNwD+rkSSxNr9CZo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-7" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: cacea4e1-ac55-4fa2-6248-08d5f25a42bb X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jul 2018 18:13:02.2254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0944 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-13 at 15:29 +-0200, Patrick Steinhardt wrote: +AD4- When power management for SCSI is enabled and if a device uses blk-mq= , +AD4- it is possible to trigger a +AGA-NULL+AGA- pointer exception when res= uming that +AD4- device. The NPE is triggered when trying to dereference the +AGA-requ= est+AF8-fn+AGA- +AD4- function pointer of the device's +AGA-request+AF8-queue+AGA-: +AD4-=20 +AD4- +AF8AXw-blk+AF8-run+AF8-queue+AF8-uncond:470 +AD4- +AF8AXw-blk+AF8-run+AF8-queue:490 +AD4- blk+AF8-post+AF8-runtime+AF8-resume:3889 +AD4- sdev+AF8-runtime+AF8-resume:263 +AD4- scsi+AF8-runtime+AF8-resume:275 +AD4-=20 +AD4- When the SCSI device is being allocated by +AGA-scsi+AF8-alloc+AF8-sd= ev+AGA-, the +AD4- device's request queue will either be initialized via +AD4- +AGA-scsi+AF8-mq+AF8-alloc+AF8-queue+AGA- or +AGA-scsi+AF8-old+AF8-al= loc+AF8-queue+AGA-. But the +AGA-request+AF8-fn+AGA- +AD4- member of the request queue is in fact only being set in +AD4- +AGA-scsi+AF8-old+AF8-alloc+AF8-queue+AGA-, which will then later cau= se the mentioned NPE. +AD4-=20 +AD4- Fix the issue by checking whether the +AGA-request+AF8-fn+AGA- is set= in +AD4- +AGAAXwBf-blk+AF8-run+AF8-queue+AF8-uncond+AGA-. In case it is unset,= we'll silently return and +AD4- not try to invoke the callback, thus fixing the NPE. Which kernel version are you using? Can you check whether the following two commits are in your kernel tree? +ACo- 4fd41a8552af (+ACI-SCSI: Fix NULL pointer dereference in runtime PM+A= CIAOw- December 2015). +ACo- 765e40b675a9 (+ACI-block: disable runtime-pm for blk-mq+ACIAOw- July = 2017). Thanks, Bart.