scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()

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

Change-Id: Ifb94a9a9e9b39a96308f2c0acb6fd0c9d56bbac6
Reported-by: syzbot+7d26fc1eea198488deab@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
CVE-2018-1000204
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
This commit is contained in:
Alexander Potapenko 2018-05-18 16:23:18 +02:00 committed by Francescodario Cuzzocrea
parent 8b22632a5c
commit 5f72c29b29
1 changed files with 1 additions and 1 deletions

View File

@ -1840,7 +1840,7 @@ retry:
num = (rem_sz > scatter_elem_sz_prev) ?
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])
goto out;