[PATCH] usb: gadget: mass_storage: add READ_TOC cmd mask check

Neal Liu neal_liu at aspeedtech.com
Wed Jan 26 21:08:56 AEDT 2022


READ_TOC cmnd[2] specifies Format Field which is defined
in SCSI-3 spec. Add command mask to avoid marking this
sense data as invalid.

Signed-off-by: Neal Liu <neal_liu at aspeedtech.com>
---
 drivers/usb/gadget/function/f_mass_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 46dd11dcb3a8..14d51695b8ae 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -1944,7 +1944,7 @@ static int do_scsi_command(struct fsg_common *common)
 		common->data_size_from_cmnd =
 			get_unaligned_be16(&common->cmnd[7]);
 		reply = check_command(common, 10, DATA_DIR_TO_HOST,
-				      (7<<6) | (1<<1), 1,
+				      (7<<6) | (1<<1) | (1<<2), 1,
 				      "READ TOC");
 		if (reply == 0)
 			reply = do_read_toc(common, bh);
-- 
2.25.1



More information about the Linux-aspeed mailing list