mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
nr_attrs should start counting from zero, otherwise we will end up
dereferencing an invalid memory address.
$ targetcli /loopback create
general protection fault
RIP: 0010:configfs_create_file+0x12/0x70
Call Trace:
<TASK>
configfs_attach_item.part.0+0x5f/0x150
configfs_attach_group.isra.0+0x49/0x120
configfs_mkdir+0x24f/0x4d0
vfs_mkdir+0x192/0x240
do_mkdirat+0x131/0x160
__x64_sys_mkdir+0x48/0x70
do_syscall_64+0x5c/0x90
Fixes: 31177b7479 ("scsi: target: core: Add RTPI attribute for target port")
Signed-off-by: Maurizio Lombardi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Acked-by: Dmitry Bogdanov <[email protected]>
Reviewed-by: Mike Christie <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>