Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: Andrew Morton <akpm@...>, Linus Torvalds <torvalds@...>, linux-scsi <linux-scsi@...>, linux-kernel <linux-kernel@...>
Date: Sunday, April 27, 2008 - 10:51 pm

On Mon, 2008-04-28 at 03:34 +0200, Ingo Molnar wrote:
 
sigh, every time I fix this free list stuff in one place, it breaks in
another.  This one is caused by the alloc->put sequence for the host (it
never got to scsi_add_host() where the freelist is allocated, so we need
to not release it in that case).

Try this; the signature for an uninitialised free list is easy (both
list pointers NULL), so the patch detects that and doesn't try to run
over the uninitialised list head.

James

---

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 12d69d7..dc36321 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -481,6 +481,14 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
  */
 void scsi_destroy_command_freelist(struct Scsi_Host *shost)
 {
+	if (shost->free_list.next == NULL && shost->free_list.prev == NULL)
+		/*
+		 * If the next and prev pointers are NULL, that
+		 * means the list was never initialised, so it
+		 * doesn't need freeing
+		 */
+		return;
+
 	while (!list_empty(&shost->free_list)) {
 		struct scsi_cmnd *cmd;
 


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT PATCH] another tranche of SCSI updates for 2.6.26, James Bottomley, (Sun Apr 27, 2:14 pm)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, James Bottomley, (Sun Apr 27, 10:51 pm)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, Linus Torvalds, (Mon Apr 28, 12:05 pm)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, James Bottomley, (Mon Apr 28, 2:25 pm)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, James Bottomley, (Mon Apr 28, 8:13 am)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, FUJITA Tomonori, (Mon Apr 28, 4:34 am)
Re: [GIT PATCH] another tranche of SCSI updates for 2.6.26, Kamalesh Babulal, (Mon Apr 28, 3:15 am)