linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sg: increase sglist_len of the sg_scatter_hold structure
@ 2007-08-05 15:31 FUJITA Tomonori
  2007-08-05 16:55 ` Douglas Gilbert
  0 siblings, 1 reply; 11+ messages in thread
From: FUJITA Tomonori @ 2007-08-05 15:31 UTC (permalink / raw)
  To: linux-scsi; +Cc: dougg, James.Bottomley, jens.axboe, fujita.tomonori

unsigned short is too small for sizeof(struct scatterlist) *
min(q->max_hw_segments, q->max_phys_segments).

This fixes memory leak with 4096 segments since 16 (likely sg size
with x86) * 4096 sets sglist_len to zero.

This might not happen without sg chaining support.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/scsi/sg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2fc24e7..2c44bb0 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -114,7 +114,7 @@ static struct class_interface sg_interface = {
 
 typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
 	unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */
-	unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */
+	unsigned sglist_len; /* size of malloc'd scatter-gather list ++ */
 	unsigned bufflen;	/* Size of (aggregate) data buffer */
 	unsigned b_malloc_len;	/* actual len malloc'ed in buffer */
 	struct scatterlist *buffer;/* scatter list */
-- 
1.5.2.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-08-09 13:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-05 15:31 [PATCH] sg: increase sglist_len of the sg_scatter_hold structure FUJITA Tomonori
2007-08-05 16:55 ` Douglas Gilbert
2007-08-06  4:09   ` FUJITA Tomonori
2007-08-07 17:13     ` Mike Christie
2007-08-07 22:38       ` FUJITA Tomonori
2007-08-08  7:15         ` Jens Axboe
2007-08-08 16:58         ` Mike Christie
2007-08-08 17:20           ` Mike Christie
2007-08-09  7:33             ` Benny Halevy
2007-08-09 13:43             ` FUJITA Tomonori
2007-08-09 13:43           ` FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).