From patchwork Fri Jun 7 03:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shantanu Goel X-Patchwork-Id: 13689230 Received: from sonic301-20.consmr.mail.gq1.yahoo.com (sonic301-20.consmr.mail.gq1.yahoo.com [98.137.64.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B1A417571 for ; Fri, 7 Jun 2024 03:43:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=98.137.64.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717731788; cv=none; b=Hm1RPLQwJbehcDojUU6pqbofxbz/vRDAvaISXS6Yt4x2nVt+rf/NU6rYXmFnJtSbb6CVtsK18vuiSp85Cq2VdwebkxQ22ysv0gebmLIlVABEcV1ADknkIln5iDhth6aUOwdt2EZF1y2NnhSQZEJkis1Pdq4W7TkEIex5ya08z10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717731788; c=relaxed/simple; bh=IpJGEGr45jVuWDbw3eeBtBXtj8q1hpx003Vx0hbGImg=; h=From:To:Subject:cc:Date:Message-ID:MIME-Version:Content-Type: References; b=CBvbTpn65VRT9TtOsWBnFIZMmSnjmHBejdyO/XAHlnPmhh8HMhYyZXn2RrCD5MzWFqDo1AKWpt/EK+ID/jm/vJKMD75qioqUpulzV/AdJPQmxl6EVH1+vs5GZedbn2j2fT07ucuCYEM/3DgXFrrap5pZaiY1Bdvzo+UdR12Y9lw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=Bx5Qem+g; arc=none smtp.client-ip=98.137.64.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="Bx5Qem+g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1717731787; bh=Q6x70XqkxpQhjKlSSOz0uqzdL65rjXGnszv/ieyuSlY=; h=From:To:Subject:cc:Date:References:From:Subject:Reply-To; b=Bx5Qem+g1a96Ovwk6I1aObgCpsdWjd+c+iUEfdyQIK6qzVtaJplgGTwesoSXl6CXDvacuaQhzRLXC+YFLomLV/ox3Ei4DiYs+dXxiPs8lalFyNL1RIlT+I9awc2p9Uear1x5qgXcp+pEf5OSqqUis5a5O6ruGAlUX7S3qDz7QSGmLJXDzWfz0PyOwu2JgLmUsVRRcA4yrXiBw/UX50kTfsU8cHv1CONuriMXke7mfYjavaxjATA0AFmRUhw6pbYRxpMAZNsOOZkVQoSxvtZ3+BFMx9sShecTD70qgvxGR9wUVBefQXmNTLyO6X6qaZs16GUG1penMaguJukv/IsP5Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1717731787; bh=9M4JcK4joZ43GWID9+ApYgg/18zyLhRPeKRvNbAo9Xd=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=UQpT4jdmosBiauHncflhCeHWG0sDHSFAb/hXnQe/3r1vqdwj6DDIz6HtRa/xTqQ+FcYi9m4HmPl3tu06f5tlWqcZB8YUAP4k3M/zllCreS+ld8x9+osW3AkUyCbvwolqxZemdBi2AJw/DfqB7Gs3KcjdLlRQZ7N87QXNDV+BHmAMtChKftv6tc6pP7A9cq1+MgfiBiLpbekvKyWmbyeu2d/3DpDEpE1r3OGzTJO5bm9FgGCZpaMM+qitgqLiWiTCqGgeyrF+T0aG5iJ1JK7bRsR+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5sWL0rto9.gDNR.Yl23Mno1SoISLpy1M 7V2spgM8ftShBlomuNuIJgyVP8maP6KYu.YjqNA5KF9yPMRQIq3jy7H6c6G3rpk5OkHI6MwUjowN x0WnI7BNjbHnnKchzdXzlYD86TevV1Q_Hy2JDD3kyK0C3_C9Y4L8oiEhZsWfpnm1egmMvdqbcN0N OyrOF3wrLS1kaIHz6ucrnxxpZq8c4tmOMHwobsW_Zbco- X-Sonic-MF: X-Sonic-ID: ff8817ce-e8a5-4c36-8020-1cae7f60b75e Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Fri, 7 Jun 2024 03:43:07 +0000 Received: by hermes--production-bf1-5cc9fc94c8-lh7nk (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 30ff7e5fec496a63b87261d9bb8a5863; Fri, 07 Jun 2024 03:32:58 +0000 (UTC) From: Shantanu Goel To: Oliver Neukum Subject: [RESEND][PATCH] usb: uas: set host status byte on data completion error cc: linux-usb@vger.kernel.org , linux-scsi@vger.kernel.org Date: Thu, 06 Jun 2024 23:32:57 -0400 Message-ID: <87msnx4ec6.fsf@yahoo.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <87msnx4ec6.fsf.ref@yahoo.com> X-Mailer: WebService/1.1.22407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Set the host status byte when a data completion error is encountered otherwise the upper layer may end up using the invalid zero'ed data. The following output was observed from scsi/sd.c prior to this fix. [ 11.872824] sd 0:0:0:1: [sdf] tag#9 data cmplt err -75 uas-tag 1 inflight: [ 11.872826] sd 0:0:0:1: [sdf] tag#9 CDB: Read capacity(16) 9e 10 00 00 00 00 00 00 00 00 00 00 00 20 00 00 [ 11.872830] sd 0:0:0:1: [sdf] Sector size 0 reported, assuming 512. Signed-off-by: Shantanu Goel Acked-by: Oliver Neukum --- drivers/usb/storage/uas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 451d9569163a..f794cb39cc31 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -422,6 +422,7 @@ static void uas_data_cmplt(struct urb *urb) uas_log_cmd_state(cmnd, "data cmplt err", status); /* error: no data transfered */ scsi_set_resid(cmnd, sdb->length); + set_host_byte(cmnd, DID_ERROR); } else { scsi_set_resid(cmnd, sdb->length - urb->actual_length); }