Skip to contentSkip to conversation

sg negative size: 2.4.23-pre9

PATCH New Douglas Gilbert 1 participant 1 message Nov 9, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sg negative size: 2.4.23-pre9

Marcelo,
Thanks to work by Pat LaVarre <[email protected]> one of sg's ioctls [SG_SET_RESERVED_SIZE] was found to allow negative sizes. This causes the kernel pain. This patch fixes that (, a similar patch was recently put into lk 2.6.0-test8).

Doug Gilbert

drivers/scsi/sg.c2423pre9dpg renamed from drivers/scsi/sg.c +2 -0
@@ -871,6 +871,8 @@
     case SG_SET_RESERVED_SIZE:
         result = get_user(val, (int *)arg);
         if (result) return result;
+        if (val < 0)
+            return -EINVAL;
         if (val != sfp->reserve.bufflen) {
             if (sg_res_in_use(sfp) || sfp->mmap_called)
                 return -EBUSY;