lkml.org 
[lkml]   [2003]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Re: [CHECKER] 112 potential memory leaks in 2.5.48
On Wed, 5 Feb 2003, Rik van Riel wrote:
> On Tue, 4 Feb 2003, Andy Chou wrote:

Thanks for the checker output. First patch below...

> > [BUG]
> > u1/acc/linux/2.5.48/drivers/scsi/sr_ioctl.c:188:sr_do_ioctl:
> > ERROR:LEAK:85:188:Memory leak [Allocated from:
> > /u1/acc/linux/2.5.48/drivers/scsi/sr_ioctl.c:85:scsi_allocate_request]
>
> Bug indeed, I've created a patch to fix the possible leak of
> a scsi request, but can't figure out the bounce buffer logic...

The patch below fixes the scsi request leak. I'm not sure
how the bounce buffer thing is supposed to work (Christoph?
James?) so I'm not touching that at the moment.

Linus, could you please apply this patch (against today's
bk tree) ?

thank you,

Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/ http://guru.conectiva.com/
Current spamtrap: <a href=mailto:"october@surriel.com">october@surriel.com</a>


===== drivers/scsi/sr_ioctl.c 1.27 vs edited =====
--- 1.27/drivers/scsi/sr_ioctl.c Sat Jan 4 14:21:59 2003
+++ edited/drivers/scsi/sr_ioctl.c Tue Feb 4 23:37:02 2003
@@ -99,7 +99,7 @@
if (bounce_buffer == NULL) {
printk("SCSI DMA pool exhausted.");
err = -ENOMEM;
- goto out;
+ goto out_free;
}
memcpy(bounce_buffer, cgc->buffer, cgc->buflen);
cgc->buffer = bounce_buffer;
@@ -107,7 +107,7 @@
retry:
if (!scsi_block_when_processing_errors(SDev)) {
err = -ENODEV;
- goto out;
+ goto out_free;
}

scsi_wait_req(SRpnt, cgc->cmd, cgc->buffer, cgc->buflen,
@@ -179,6 +179,7 @@
memcpy(cgc->sense, SRpnt->sr_sense_buffer, sizeof(*cgc->sense));

/* Wake up a process waiting for device */
+ out_free:
scsi_release_request(SRpnt);
SRpnt = NULL;
out:
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.124 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site