[PATCH] memory leak in scsi_proc.c (fixed patch error)

From: Mike Brown (mbrown@cs.uml.edu)
Date: Fri May 25 2001 - 05:19:05 EST


Hi,

fixed patch poster earlier. PINE's default editor munged it up. Also changed
the 8 spaces indentation to a tab character.

Sorry about that.

> If someone writes to a scsi adapter's /proc entry and that scsi adapter
> has not defined a proc_info() entry point, proc_scsi_write() will leak a
> page. Furthermore, no sense asking for a page if said proc_info() entry
> point does not exist. This patch fixes the above problem and patches
> cleanly against 2.4.4

--- drivers/scsi/scsi_proc.c.orig Fri May 25 06:01:20 2001
+++ drivers/scsi/scsi_proc.c Fri May 25 06:04:16 2001
@@ -99,6 +99,9 @@
         char * page;
         char *start;
     
+ if (hpnt->hostt->proc_info == NULL)
+ ret = -ENOSYS;
+
         if (count > PROC_BLOCK_SIZE)
                 return -EOVERFLOW;
 
@@ -106,11 +109,9 @@
                 return -ENOMEM;
         copy_from_user(page, buf, count);
 
- if (hpnt->hostt->proc_info == NULL)
- ret = -ENOSYS;
- else
- ret = hpnt->hostt->proc_info(page, &start, 0, count,
- hpnt->host_no, 1);
+ ret = hpnt->hostt->proc_info(page, &start, 0, count,
+ hpnt->host_no, 1);
+
         free_page((ulong) page);
         return(ret);
 }
-
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/



This archive was generated by hypermail 2b29 : Thu May 31 2001 - 21:00:23 EST