Commit 72e471e7 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] fix mismatched access_ok() checks in sg_io()

I found this while doing bio_map_user() changes.

Acked by Jens.
parent 3bec8a5a
......@@ -183,9 +183,11 @@ static int sg_io(request_queue_t *q, struct block_device *bdev,
}
uaddr = (unsigned long) hdr.dxferp;
if (writing && !access_ok(VERIFY_WRITE, uaddr, bytes))
/* writing to device -> reading from vm */
if (writing && !access_ok(VERIFY_READ, uaddr, bytes))
return -EFAULT;
else if (reading && !access_ok(VERIFY_READ, uaddr, bytes))
/* reading from device -> writing to vm */
else if (reading && !access_ok(VERIFY_WRITE, uaddr, bytes))
return -EFAULT;
/*
......
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