Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2926796ybx; Fri, 8 Nov 2019 11:21:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyP6f++gdkJOtUoj60/cNpeJVE300vtUJeI0TDqI+tVigLNeSR/9wYeIqaG+tTiZHopDS1r X-Received: by 2002:a50:b5e3:: with SMTP id a90mr11885803ede.201.1573240918662; Fri, 08 Nov 2019 11:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573240918; cv=none; d=google.com; s=arc-20160816; b=BVJIR8wbZXefaTWJAckqQ39cm0UKKI64l0N4Iny/Ki0wRviFTu551r871+qvG6ieVF TVeFcRTPZK6huXmikVdWbysXnJKDGLJaY3RxFAIgEbVS1pSgX+eEFdgomGMSGQgUGPMx 0/xzrOWGaJ0QrJoUj0lWlAdXn0KTK7/CJ864CICR6jAubkWdVNGXYhoTLkY+JZ73rBSI WrpkwW3siFVg9LFBGAwsG4hPyvy1G6ryXtompfAcBv7eZoCk55s142Sq2LX7GcCLenXf V4rvxjcon9Kq2mq30LKd6kNSZlP8hcDFp3RAO55YGVw8YPA9VjA5l/z7O+iuuZ3zNRnJ GKQg== 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=Jg0pqpRW9/qyXmcojkxCA0DTtKwOPtVJHtJTYj4TZjU=; b=nO01SelJCWnjrC/Ekhu4vJ/M9B3SPxjSovmismlBj8mQIPP1/MbPu7f7yOpBAj54Zx fdLW+wU6alKaAlYcbqaRNN8bxT0aKzbff9YIkmVDjnXtBgtD9hkJgJuVQhlEs9WWCJ4S 8jNisMrKF+js1sx44TNZXRfgMM2ms1bgrLp3qS83kRh1WOKojxsmFGsC4sHRwKrolNBH OOW09rIAFwBV5yIb6Q5eBdg33KJ62WOwyYyPdQC5wCh8FUMekKCnEP4mTKOOKvBozpc4 GP3TtKG2MIio36H6srEOFvgvlJ4FlsFhPFuLJGbGEK3dl2brkQVCB8/I+OwCtswqSBzc Aj4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P0C76ROC; 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 s21si545319eju.82.2019.11.08.11.21.35; Fri, 08 Nov 2019 11:21:58 -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=P0C76ROC; 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 S1732922AbfKHTUw (ORCPT + 99 others); Fri, 8 Nov 2019 14:20:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:57182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389367AbfKHTAF (ORCPT ); Fri, 8 Nov 2019 14:00:05 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 D64F3222CE; Fri, 8 Nov 2019 18:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573239470; bh=9FLjLiH7v5XHJHv+NXNnLPQ7INHN9b6L2M7gM2XWXIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0C76ROC0Gc5LwPww+1vM1ezykap3b1SfVFXiZLl30/OVFZDM+D1J7Pvp7Alew8kQ 9GFappxg5+No7jC/Nz7Zigh6AZl4YXOLjrf3t/ZJTndokKNJ3twYqGE9MuJoz0JyAY BXgWFCGQxgdOwa+K59FRpA8uPkNhqK7ohjLnt4WE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bodo Stroesser , Bart Van Assche , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 16/62] scsi: target: core: Do not overwrite CDB byte 1 Date: Fri, 8 Nov 2019 19:50:04 +0100 Message-Id: <20191108174733.613259615@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174719.228826381@linuxfoundation.org> References: <20191108174719.228826381@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Bodo Stroesser [ Upstream commit 27e84243cb63601a10e366afe3e2d05bb03c1cb5 ] passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to reset the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1). The current code is wrong as for newer commands not having the LUN field it overwrites relevant command bits (e.g. for SECURITY PROTOCOL IN / OUT). We think this code was unnecessary from the beginning or at least it is no longer useful. So we remove it entirely. Link: https://lore.kernel.org/r/12498eab-76fd-eaad-1316-c2827badb76a@ts.fujitsu.com Signed-off-by: Bodo Stroesser Reviewed-by: Bart Van Assche Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/target_core_device.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 84742125f7730..92b52d2314b53 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -1151,27 +1151,6 @@ passthrough_parse_cdb(struct se_cmd *cmd, struct se_device *dev = cmd->se_dev; unsigned int size; - /* - * Clear a lun set in the cdb if the initiator talking to use spoke - * and old standards version, as we can't assume the underlying device - * won't choke up on it. - */ - switch (cdb[0]) { - case READ_10: /* SBC - RDProtect */ - case READ_12: /* SBC - RDProtect */ - case READ_16: /* SBC - RDProtect */ - case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ - case VERIFY: /* SBC - VRProtect */ - case VERIFY_16: /* SBC - VRProtect */ - case WRITE_VERIFY: /* SBC - VRProtect */ - case WRITE_VERIFY_12: /* SBC - VRProtect */ - case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ - break; - default: - cdb[1] &= 0x1f; /* clear logical unit number */ - break; - } - /* * For REPORT LUNS we always need to emulate the response, for everything * else, pass it up. -- 2.20.1