Re: [PATCH v4 linux-next] scsi: scsi_debug: fix type in min_t to avoid stack OOB

From: Martin K. Petersen
Date: Thu Nov 18 2021 - 23:16:58 EST


On Tue, 9 Nov 2021 13:57:27 -0500, George Kennedy wrote:

> Change min_t() to use type "u32" instead of type "int" to
> avoid stack out of bounds. With min_t() type "int" the values get
> sign extended and the larger value gets used causing stack out of bounds.
>
> BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline]
> BUG: KASAN: stack-out-of-bounds in sg_copy_buffer+0x1de/0x240 lib/scatterlist.c:976
> Read of size 127 at addr ffff888072607128 by task syz-executor.7/18707
>
> [...]

Applied to 5.16/scsi-fixes, thanks!

[1/1] scsi: scsi_debug: fix type in min_t to avoid stack OOB
https://git.kernel.org/mkp/scsi/c/36e07d7ede88

--
Martin K. Petersen Oracle Linux Engineering