From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E95821882B; Mon, 2 Jun 2025 14:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874780; cv=none; b=io0guIS4u2zxbf3Pd2o30Na9QD4bRww2wSUYgtbPJxKoBVLUacOsJslUcH3p3G1VLzALvopzLIltypepgtGfD0JST+sOF8xjtlvTAl8BdA/mDqYtlpd5kbP2sP1mG/H9Q/Q6jZ+YBAtdpA0tSPh0+qFdjoF8K9bMOdjam51vFGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874780; c=relaxed/simple; bh=HU7HTt4EGikjshpirHO029ynR1FwZBlSgJdB/plR4S0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pANsUxpy7BKS7VfCn15Uq/E5u4Ry0E77faqBfh9ZSz/ofN6ypqGm2Mt/CMcKvVniBrIjFgelSuk3yHKZxxePzXzTxM/r4BO7+rlrGkEXgbcH0QJJPxbVxSXHCxAryfUBdRYuuFjedXVFEPYZbmm2V0vmUHZPQWB0OlRAMMIrmgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yugXi2ro; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yugXi2ro" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FFD8C4CEEB; Mon, 2 Jun 2025 14:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748874780; bh=HU7HTt4EGikjshpirHO029ynR1FwZBlSgJdB/plR4S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yugXi2roxoOZF19hngmTPpD0XWqG4/m0D94PN6jy8gT3zWOCgQKQmxE4UgBl9Wq64 aB4zz8RqvYBUQRd9+nAEVUoxu91GGXd7Je0ShsEdU2tZ8hjaRzdDCCIoGImH9dGho0 c8cBM01r17zVeVhJ6AMLu+QabdCI4FSa741huk24= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Kai=20M=C3=A4kisara?= , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 106/204] scsi: st: Tighten the page format heuristics with MODE SELECT Date: Mon, 2 Jun 2025 15:47:19 +0200 Message-ID: <20250602134259.830399745@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134255.449974357@linuxfoundation.org> References: <20250602134255.449974357@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kai Mäkisara [ Upstream commit 8db816c6f176321e42254badd5c1a8df8bfcfdb4 ] In the days when SCSI-2 was emerging, some drives did claim SCSI-2 but did not correctly implement it. The st driver first tries MODE SELECT with the page format bit set to set the block descriptor. If not successful, the non-page format is tried. The test only tests the sense code and this triggers also from illegal parameter in the parameter list. The test is limited to "old" devices and made more strict to remove false alarms. Signed-off-by: Kai Mäkisara Link: https://lore.kernel.org/r/20250311112516.5548-4-Kai.Makisara@kolumbus.fi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 2b5e3e2ba3b8b..8f927851ccf86 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3076,7 +3076,9 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon cmd_in == MTSETDRVBUFFER || cmd_in == SET_DENS_AND_BLK) { if (cmdstatp->sense_hdr.sense_key == ILLEGAL_REQUEST && - !(STp->use_pf & PF_TESTED)) { + cmdstatp->sense_hdr.asc == 0x24 && + (STp->device)->scsi_level <= SCSI_2 && + !(STp->use_pf & PF_TESTED)) { /* Try the other possible state of Page Format if not already tried */ STp->use_pf = (STp->use_pf ^ USE_PF) | PF_TESTED; -- 2.39.5