Commit 3208795e authored by Selvan Mani's avatar Selvan Mani Committed by Jens Axboe

mtip32xx: fix potential crash on SEC_ERASE_UNIT

The mtip driver lifted this code from elsewhere and then added a special
handling check for SEC_ERASE_UNIT. If the caller tries to do a security
erase but passes no output data for the command then outbuf is not
allocated and the driver duly explodes.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarSelvan Mani <smani@micron.com>
Signed-off-by: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a8c32a5c
...@@ -2218,8 +2218,8 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2218,8 +2218,8 @@ static int exec_drive_taskfile(struct driver_data *dd,
fis.device); fis.device);
/* check for erase mode support during secure erase.*/ /* check for erase mode support during secure erase.*/
if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) && outbuf &&
&& (outbuf[0] & MTIP_SEC_ERASE_MODE)) { (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
erasemode = 1; erasemode = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment