Commit a708a057 authored by Damien Le Moal's avatar Damien Le Moal Committed by Li Nan
Browse files

scsi: sd: Fix sd_do_mode_sense() buffer length handling

mainline inclusion
from mainline-v5.16-rc1
commit c749301e
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9FNFK
CVE: CVE-2021-47182

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c749301ebee82eb5e97dec14b6ab31a4aabe37a6

--------------------------------

For devices that explicitly asked for MODE SENSE(10) use, make sure that
scsi_mode_sense() is called with a buffer of at least 8 bytes so that the
sense header fits.

Link: https://lore.kernel.org/r/20210820070255.682775-4-damien.lemoal@wdc.com


Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Fixes: 907ea672 ("scsi: core: Fix scsi_mode_sense() buffer length handling")
Conflicts:
	drivers/scsi/sd.c
[ Mianline commit 0610959f ("scsi: sd: Allow user to configure
command retries") use 'sdkp->device' intead of 'sdp'. ]
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 7d91c9c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment