Commit ad251832 authored by Alexander Potapenko's avatar Alexander Potapenko Committed by Greg Kroah-Hartman

scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()

commit a45b599a upstream.

This shall help avoid copying uninitialized memory to the userspace when
calling ioctl(fd, SG_IO) with an empty command.

Reported-by: syzbot+7d26fc1eea198488deab@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e420d983
...@@ -1893,7 +1893,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) ...@@ -1893,7 +1893,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
num = (rem_sz > scatter_elem_sz_prev) ? num = (rem_sz > scatter_elem_sz_prev) ?
scatter_elem_sz_prev : rem_sz; scatter_elem_sz_prev : rem_sz;
schp->pages[k] = alloc_pages(gfp_mask, order); schp->pages[k] = alloc_pages(gfp_mask | __GFP_ZERO, order);
if (!schp->pages[k]) if (!schp->pages[k])
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment