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

Bartlomiej Zolnierkiewicz (B.Zolnierkiewicz@elka.pw.edu.pl)
Thu, 24 Apr 2003 17:47:58 +0200 (MET DST)


I've found this while doing bio_map_user() changes,
please forward to Linus.

--
Bartlomiej

--- linux-2.5.68/drivers/block/scsi_ioctl.c Sun Apr 20 04:51:16 2003 +++ linux/drivers/block/scsi_ioctl.c Thu Apr 24 17:36:15 2003 @@ -183,9 +183,11 @@ }

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;

/*

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/