Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5244421imu; Tue, 15 Jan 2019 13:58:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN5YoXzcOKdUXf6W5ikEvepwvvTZf/ltRTtOwIHNFGZCZiWvwyv+BP2iu1Aap2iRfCKQV1T/ X-Received: by 2002:a63:9256:: with SMTP id s22mr5602029pgn.224.1547589534309; Tue, 15 Jan 2019 13:58:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547589534; cv=none; d=google.com; s=arc-20160816; b=l3q7k2ThyIODAYCxqJZ8fOIxXpP/6rCvHB/GhRuKi/JWwyX38AOaSp9+h0cBGs39xF K/wzMpixEYDeK4dVbR+LoibHdW07Sc1Ql/6YyulkmvpDIxXJ01x2W4yURtlyU6T9KQFy KozGI7+kfnBi4AZc9k4jRBBkgbQdgNfzC6bsLvJ3M/cp+0I3tbhAgLYrfiuuPAiFeegK WT3jAJyu2uP8Epc/BZSNGgUbWkDzI6On/eVXgwXtmcMnelZVUo/QqmSZ7DsASWPd57o5 qMt4WBIBDZhpUD6yMkLxWqGgwTBcv1nORMnFMAY4BFDddejdK28+46ZWVHvX8MuSXHkn NVzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3K4OPetnUKz1GPq7Au2cKCh3ZwL/JH3ayPk25xNi5yM=; b=wQ5CH+VCaeYlkUjWVjn3tqBfTuDRinfSo9M4sG6sfTwyN9QzrQBW+MPXoY5G0yKnLo pkT55fNYTrYjiQagC4ykNSvnGKu8Lp6R2NP5+uhXcASHmL18FK2BX9vtGv8W1AcNnkvL P4P2gnwjOy1tZOnZRKIysEi1B4dMO2B+tNhE89Mm8uO6EHH17d9LOThbBHLl/+3dCpEd S7Z0dVYsu2bp70SLP16tfu32OWNamY+Spb0eaWtVKokk/0N3tgjU1wEzEp1cvGqFaIAC dZQWeMl75ioMHf3ydZroIWju5eLVEOlApdpEIZb/WDCO5hZ5HMvufOwjqOyTTvBHNyDv 4/4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dx9WxXDK; 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 g1si4226509pgu.149.2019.01.15.13.58.38; Tue, 15 Jan 2019 13:58:54 -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=@kernel.org header.s=default header.b=dx9WxXDK; 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 S2387533AbfAOQoX (ORCPT + 99 others); Tue, 15 Jan 2019 11:44:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:33964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387519AbfAOQoV (ORCPT ); Tue, 15 Jan 2019 11:44:21 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E28AB2054F; Tue, 15 Jan 2019 16:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570660; bh=qGPJZvt3j/ipzuNM2WkWmUsb19evjrHcR3MLpUz1AFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dx9WxXDKSAUQb7hdNqcd+YM/c+p2kXjVMzD/6XxfI/PCdukTTl9gtE9qpYi/4Rlve MFjXk+koP5EqWekvplXxNuZuDRnrqWTkaX860MJhWkCMqwlMBBqqHdjU+ipc3pMdDx +heluqtMn/WzP8ibTxp0998ki129IcZQS1gbDb1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Icenowy Zheng , Alan Stern Subject: [PATCH 4.20 24/57] USB: storage: dont insert sane sense for SPC3+ when bad sense specified Date: Tue, 15 Jan 2019 17:36:05 +0100 Message-Id: <20190115154912.063907661@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Icenowy Zheng commit c5603d2fdb424849360fe7e3f8c1befc97571b8c upstream. Currently the code will set US_FL_SANE_SENSE flag unconditionally if device claims SPC3+, however we should allow US_FL_BAD_SENSE flag to prevent this behavior, because SMI SM3350 UFS-USB bridge controller, which claims SPC4, will show strange behavior with 96-byte sense (put the chip into a wrong state that cannot read/write anything). Check the presence of US_FL_BAD_SENSE when assuming US_FL_SANE_SENSE on SPC4+ devices. Signed-off-by: Icenowy Zheng Cc: stable Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/scsiglue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -235,8 +235,12 @@ static int slave_configure(struct scsi_d if (!(us->fflags & US_FL_NEEDS_CAP16)) sdev->try_rc_10_first = 1; - /* assume SPC3 or latter devices support sense size > 18 */ - if (sdev->scsi_level > SCSI_SPC_2) + /* + * assume SPC3 or latter devices support sense size > 18 + * unless US_FL_BAD_SENSE quirk is specified. + */ + if (sdev->scsi_level > SCSI_SPC_2 && + !(us->fflags & US_FL_BAD_SENSE)) us->fflags |= US_FL_SANE_SENSE; /*