]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] scsi_debug: fix NULL pointer dereference with parameters dif=0 dix=1
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 29 Jun 2013 08:59:16 +0000 (17:59 +0900)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 9 Jul 2013 08:23:04 +0000 (09:23 +0100)
commit8cd1521ef4b31a2fc806fab2063a6b8713453ee8
treee0df6503fc02324d8606bc6bd63a9a6ec5258c31
parentdf92089e96f7b728f200a64c1ba2701f0cd9f7a5
[SCSI] scsi_debug: fix NULL pointer dereference with parameters dif=0 dix=1

The protection info dif_storep is allocated only when parameter dif is
not zero.  But it will be accessed when reading or writing to the storage
installed with parameter dix is not zero.

So kernel crashes if scsi_debug module is loaded with parameters dix=1 and
dif=0.

This fixes it by making dif_storep available if parameter dix is not zero
instead of checking if parameter dif is not zero.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/scsi_debug.c