scsi: sr: Sanity check returned mode data
authorMartin K. Petersen <martin.petersen@oracle.com>
Fri, 17 Mar 2017 12:47:14 +0000 (08:47 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 7 Apr 2017 21:07:14 +0000 (17:07 -0400)
commita00a7862513089f17209b732f230922f1942e0b9
tree29baba18a5643a8a3eae10a6e4db79e4642c4112
parent6780414519f91c2a84da9baa963a940ac916f803
scsi: sr: Sanity check returned mode data

Kefeng Wang discovered that old versions of the QEMU CD driver would
return mangled mode data causing us to walk off the end of the buffer in
an attempt to parse it. Sanity check the returned mode sense data.

Cc: <stable@vger.kernel.org>
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sr.c