From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 025BCC282DD for ; Tue, 23 Apr 2019 20:35:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2478218B0 for ; Tue, 23 Apr 2019 20:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556051750; bh=vNCQXaCeLWXO8xOs5Vi6tQfqC7K5J+rxlP0UsPBYquA=; h=Subject:To:Cc:From:Date:List-ID:From; b=12E4bOtP4Kq0vZo4ZvXzESe51IHsaVVHBKyiZbuaPZZOj4QLtcXCz3MoHdtZGC17D DlnJuW0vi7jvSnYEqQp3lkEzZM+4MyEv9nbFnDBaTt0iKlurkt3BEDoCukETkvAant u0VzSCwLlwQpLgOQZvZgNLi9UqcsKixdGIzJhnr4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbfDWUfu (ORCPT ); Tue, 23 Apr 2019 16:35:50 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:45861 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfDWUfu (ORCPT ); Tue, 23 Apr 2019 16:35:50 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 10A5321FAE; Tue, 23 Apr 2019 16:35:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 23 Apr 2019 16:35:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=7TRQCA r7NeZoC8DifD43XWSxInj3M1ROnbZRtBWec1k=; b=ih6Ifoxp5XSWLYr1J7n1Nw Gkpvz/iJpO/OjVcan6KoqNcrmmEST08Zu5b0JdP3aORmCT1iyxLAn+OrqSWY5Xs7 PK+eg52DzstYDhFScEUFjhBv7S0z/bCUnjrpuRM/WXNw/TwttPUudMu7S8RLuSiS yxgsEBlG6D9udOWKs8IO0Y0uHunTWI4S/mPTd+qupX15JNYGTRhtdXEO+VaOHkWJ ZgGLPHk4AQ9LRuNrvyW3VtGYCZ0sx00R+Q2LXuio/EId7EUHN2o3h0Y4KyCERL98 JjIu3m7V0T5D/q3n5k6iM0Ll/e1izBmT0VGTrEx/WPRGZeAzWA0gkIMk6TyNezrQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrgeekgddufeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeeivddrudelfedrhedtrddvvdelnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) by mail.messagingengine.com (Postfix) with ESMTPA id 635CCE4393; Tue, 23 Apr 2019 16:35:48 -0400 (EDT) Subject: FAILED: patch "[PATCH] scsi: core: set result when the command cannot be dispatched" failed to apply to 4.4-stable tree To: jalee@purestorage.com, bvanassche@acm.org, hare@suse.com, martin.petersen@oracle.com, stable@vger.kernel.org Cc: From: Date: Tue, 23 Apr 2019 22:35:39 +0200 Message-ID: <1556051739159173@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From be549d49115422f846b6d96ee8fd7173a5f7ceb0 Mon Sep 17 00:00:00 2001 From: Jaesoo Lee Date: Tue, 9 Apr 2019 17:02:22 -0700 Subject: [PATCH] scsi: core: set result when the command cannot be dispatched When SCSI blk-mq is enabled, there is a bug in handling errors in scsi_queue_rq. Specifically, the bug is not setting result field of scsi_request correctly when the dispatch of the command has been failed. Since the upper layer code including the sg_io ioctl expects to receive any error status from result field of scsi_request, the error is silently ignored and this could cause data corruptions for some applications. Fixes: d285203cf647 ("scsi: add support for a blk-mq based I/O path.") Cc: Signed-off-by: Jaesoo Lee Reviewed-by: Hannes Reinecke Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 601b9f1de267..07dfc17d4824 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1706,8 +1706,12 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, ret = BLK_STS_DEV_RESOURCE; break; default: + if (unlikely(!scsi_device_online(sdev))) + scsi_req(req)->result = DID_NO_CONNECT << 16; + else + scsi_req(req)->result = DID_ERROR << 16; /* - * Make sure to release all allocated ressources when + * Make sure to release all allocated resources when * we hit an error, as we will never see this command * again. */