Skip to content

Commit 71d6c50

Browse files
keesaxboe
authored andcommitted
libata: zpodd: Fix small read overflow in zpodd_get_mech_type()
Jeffrin reported a KASAN issue: BUG: KASAN: global-out-of-bounds in ata_exec_internal_sg+0x50f/0xc70 Read of size 16 at addr ffffffff91f41f80 by task scsi_eh_1/149 ... The buggy address belongs to the variable: cdb.48319+0x0/0x40 Much like commit 18c9a99 ("libata: zpodd: small read overflow in eject_tray()"), this fixes a cdb[] buffer length, this time in zpodd_get_mech_type(): We read from the cdb[] buffer in ata_exec_internal_sg(). It has to be ATAPI_CDB_LEN (16) bytes long, but this buffer is only 12 bytes. Reported-by: Jeffrin Jose T <[email protected]> Fixes: afe7595 ("libata: identify and init ZPODD devices") Link: https://lore.kernel.org/lkml/201907181423.E808958@keescook/ Tested-by: Jeffrin Jose T <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 7be2176 commit 71d6c50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/ata/libata-zpodd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
5656
unsigned int ret;
5757
struct rm_feature_desc *desc;
5858
struct ata_taskfile tf;
59-
static const char cdb[] = { GPCMD_GET_CONFIGURATION,
59+
static const char cdb[ATAPI_CDB_LEN] = { GPCMD_GET_CONFIGURATION,
6060
2, /* only 1 feature descriptor requested */
6161
0, 3, /* 3, removable medium feature */
6262
0, 0, 0,/* reserved */

0 commit comments

Comments
 (0)