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: 13689235 Received: from sonic307-8.consmr.mail.gq1.yahoo.com (sonic307-8.consmr.mail.gq1.yahoo.com [98.137.64.32]) (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 00DD717BB4 for ; Fri, 7 Jun 2024 04:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=98.137.64.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717733002; cv=none; b=Ty2Y8EpJzsOgcMdGwkd5iOYqkxDsXlKkgdKAn2MqShKNlYTKJTPoMMiEvD9c3Io6fMaaArvhTR4uNRv/rmcABNPlCvMzP1b+HWnGMyLBquRzE26RXd/scezEBy6tN57XkWPOV6PVSyz/G4swB6MaZLTv8LP2tHIvDXEJbQkZtJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717733002; c=relaxed/simple; bh=IpJGEGr45jVuWDbw3eeBtBXtj8q1hpx003Vx0hbGImg=; h=From:To:Subject:cc:Date:Message-ID:MIME-Version:Content-Type: References; b=aEb2/i64dQwR0K3keNBIYbPeXLZpg8L1dlxItCMAEGxRvojLZlRBlI0oxy0vu0FQ4LSed4mnj9N9mOqTrPrILpwnJ4LdujZGzTpHFJMmsI4pKykJlJWX4Vi2k6YrTSvos42MTglXHYrJmVoFx2qmRFvHOogANRHIFTE6fPwTLd0= 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=ODLD69Ca; arc=none smtp.client-ip=98.137.64.32 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="ODLD69Ca" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1717733000; bh=Q6x70XqkxpQhjKlSSOz0uqzdL65rjXGnszv/ieyuSlY=; h=From:To:Subject:cc:Date:References:From:Subject:Reply-To; b=ODLD69CaO1ajr9WDfhoO044tHjuTVpBcoTnO3XwGrla2wkpJ3izo7/2COFEY3ncqbt/YbAsWQv5sDxwa/LrBuQ3SfoPG/zbJzN0Uu17X4enHk/4ZO2m1RPTHTSWPm8b9ZhBTygJJYVoUc6OgysnD598J881GUIRTTtbwwEd3lhcDXQFfV1XTg+3qiCWz8x4g3Wkh9StgWlwWwWGRRceT5X6sGEQfXJRByqbAL1BN+OY1G7IQDtqK0SrsvL6dmDwSS6SUpiERwIKy+4nbXMDyfv7vWoHguXfvQJoPbpq32pvwu34/ZSHePZajACuQPDqUstHAOQz4P6A02YW8KuMnfg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1717733000; bh=pp0sU89dv4b6Usst2HYOe5Cac/3QEQSOh3vo5u4Qvoq=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=WIwr3Nk1dwpYMpxrydxdN+UKJwQwE2d6Hl1/Ve3A1h/nbCX93zwB+gtVVd2FR5/VlxWEVtxy5Gvv4d4XYr77czNgIWE3wKXxl8etL6vFpMRHrXr3Gy6bhcVmnB3/stY1LJeXt1yIwEPMd1M9Xlpuw50MkKi/FHYe9LoYcu66QDXpOABqDUP/U6NraC1L7cMuSBzMnT/CWOWGOfDv7QENI8vk5QUvQfC+lFFteqJ64Wu+Ainj0sg0LHn4RFYXv97GDYAQQ0iaAapRPJy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spcfU.43VJbmOYr5sWL0rto9.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 sonic307.consmr.mail.gq1.yahoo.com with HTTP; Fri, 7 Jun 2024 04:03:20 +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-usb@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); }