From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6F307434409; Tue, 21 Jul 2026 21:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670228; cv=none; b=bECKUCWGZmZtBPmgoDDzJkSeQHI+QxArJGz1C0gH2FSnz302QL91E348qMIneldtwkoie0EOPczaiRn/b1ARldBPS5FU6Gz+tS9/T27uatkMAhZKAMXKrTipySZ67eD8Ty3VSRTdui7j/y09VbVbvj+qKAJ5aQQeOhQoHUUNxWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670228; c=relaxed/simple; bh=OqTwXbRNu2+hYRb98DIVJ5KtPxk8LH+RFiKG5Wi+xCo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vED2MHAUqJkXL19YkP/mDpyiF1OxshcTEbmTmNRP4mFis3IubriOtnUdhnTvqOepiCV129PGGyy4xG2tlUqeeAhEmOF/uggf+va5bBoToKlrAEPfMqkhqPeYztawaGwDhnQkjBL+sLwtDVAew63gM+iCX+MVZylrbYRBJaFgKK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QoaOnA6p; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QoaOnA6p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4DA61F000E9; Tue, 21 Jul 2026 21:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670227; bh=nI38BetpzVP2hN6PpYUU9TRAyoknLpZFpGUxialRG14=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QoaOnA6poOzaShA+lVDx6eKWjLm3eUyRrjHu5vNV33JAZwFd5Zv9Lrxml5CVv1BAr UWFk3uOUkqXKkA8CDS/+ZpOKOYUQMWGGDaiUF2Gsd2lNCnp4TJed6dOS/HbAxbZCbI ATfTWY+nyjti4JvdxP1EGXFtQO0OU9bkAuEBznAQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xu Rao , Bart Van Assche , "Martin K. Petersen" Subject: [PATCH 6.1 0854/1067] scsi: sg: Report request-table problems when any status is set Date: Tue, 21 Jul 2026 17:24:15 +0200 Message-ID: <20260721152443.647135530@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xu Rao commit 1d3a742afeb761eaead774691bde1ced699e9a5d upstream. SG_GET_REQUEST_TABLE reports per-request diagnostic state through sg_req_info::problem. The field is meant to indicate whether there is an error to report for a completed request. sg_fill_request_table() currently combines masked_status, host_status and driver_status with bitwise AND. This only reports a problem when all three status fields are non-zero at the same time. A normal target check condition, for example, has masked_status set while host_status and driver_status may both be zero, so the request is incorrectly reported as clean. Use the same condition as sg_new_read(), which sets SG_INFO_CHECK when any of the three status fields is non-zero. Cc: stable@vger.kernel.org Signed-off-by: Xu Rao Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/54B60C19F7DB8889+20260707030845.970018-1-raoxu@uniontech.com Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -866,10 +866,9 @@ sg_fill_request_table(Sg_fd *sfp, sg_req if (val >= SG_MAX_QUEUE) break; rinfo[val].req_state = srp->done + 1; - rinfo[val].problem = - srp->header.masked_status & - srp->header.host_status & - srp->header.driver_status; + rinfo[val].problem = srp->header.masked_status || + srp->header.host_status || + srp->header.driver_status; if (srp->done) rinfo[val].duration = srp->header.duration;