Skip to content

Commit

Permalink
ANDROID: scsi: Add segment checking in sg_read
Browse files Browse the repository at this point in the history
Bug: 65023233
Signed-off-by: Roberto Pereira <[email protected]>
Change-Id: Ib45f402cf304f9b8bf18884738f92b9c3db55573
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
robepereira authored and franciscofranco committed May 11, 2018
1 parent f3dbf1c commit be30e09
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
struct sg_header *old_hdr = NULL;
int retval = 0;

if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
return -EINVAL;

if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
return -ENXIO;
SCSI_LOG_TIMEOUT(3, printk("sg_read: %s, count=%d\n",
Expand Down

0 comments on commit be30e09

Please sign in to comment.