All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Linux Memory Management <linux-mm@kvack.org>
Subject: [RFC][PATCH 4/8] Fix a bug in scsi_get_command
Date: Fri, 18 Nov 2005 11:41:17 -0800	[thread overview]
Message-ID: <437E2E5D.1050300@us.ibm.com> (raw)
In-Reply-To: <437E2C69.4000708@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

Testing this patch series uncovered a small bug in scsi_get_command.  This
patch fixes that bug.

-Matt

[-- Attachment #2: scsi_get_command-fix.patch --]
[-- Type: text/x-patch, Size: 958 bytes --]

scsi_get_command() attempts to write into a structure that may not have been
successfully allocated.  Move this write inside the if statement that ensures
we won't panic the kernel with a NULL pointer dereference.

Signed-off-by: Matthew Dobson <colpatch@us.ibm.com>

Index: linux-2.6.15-rc1+critical_pool/drivers/scsi/scsi.c
===================================================================
--- linux-2.6.15-rc1+critical_pool.orig/drivers/scsi/scsi.c	2005-11-15 13:45:38.000000000 -0800
+++ linux-2.6.15-rc1+critical_pool/drivers/scsi/scsi.c	2005-11-17 16:49:54.279656112 -0800
@@ -265,10 +265,10 @@ struct scsi_cmnd *scsi_get_command(struc
 		spin_lock_irqsave(&dev->list_lock, flags);
 		list_add_tail(&cmd->list, &dev->cmd_list);
 		spin_unlock_irqrestore(&dev->list_lock, flags);
+		cmd->jiffies_at_alloc = jiffies;
 	} else
 		put_device(&dev->sdev_gendev);
 
-	cmd->jiffies_at_alloc = jiffies;
 	return cmd;
 }				
 EXPORT_SYMBOL(scsi_get_command);

  parent reply	other threads:[~2005-11-18 19:41 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-18 19:32 [RFC][PATCH 0/8] Critical Page Pool Matthew Dobson
2005-11-18 19:32 ` Matthew Dobson
2005-11-18 19:36 ` [RFC][PATCH 1/8] Create " Matthew Dobson
2005-11-19  0:08   ` Paul Jackson
2005-11-19  0:08     ` Paul Jackson
2005-11-21  5:50     ` Matthew Dobson
2005-11-21  5:50       ` Matthew Dobson
2005-11-21  5:54       ` Paul Jackson
2005-11-21  5:54         ` Paul Jackson
2005-11-18 19:36 ` [RFC][PATCH 2/8] Create emergency trigger Matthew Dobson
2005-11-19  0:21   ` Paul Jackson
2005-11-19  0:21     ` Paul Jackson
2005-11-21  5:51     ` Matthew Dobson
2005-11-21  5:51       ` Matthew Dobson
2005-11-18 19:40 ` [RFC][PATCH 3/8] Slab cleanup Matthew Dobson
2005-11-18 19:41 ` Matthew Dobson [this message]
2005-11-18 19:43 ` [RFC][PATCH 5/8] get_object/return_object Matthew Dobson
2005-11-18 19:44 ` [RFC][PATCH 6/8] slab_destruct Matthew Dobson
2005-11-18 19:44 ` [RFC][PATCH 0/8] Critical Page Pool Avi Kivity
2005-11-18 19:44   ` Avi Kivity
2005-11-18 19:51   ` Matthew Dobson
2005-11-18 19:51     ` Matthew Dobson
2005-11-18 20:42     ` Avi Kivity
2005-11-18 20:42       ` Avi Kivity
2005-11-19  0:10       ` Paul Jackson
2005-11-19  0:10         ` Paul Jackson
2005-11-21  5:36       ` Matthew Dobson
2005-11-21  5:36         ` Matthew Dobson
2005-11-18 19:45 ` [RFC][PATCH 7/8] __cache_grow() Matthew Dobson
2005-11-18 19:47 ` [RFC][PATCH 8/8] Add support critical pool support to the slab allocator Matthew Dobson
2005-11-18 19:56 ` [RFC][PATCH 0/8] Critical Page Pool Chris Wright
2005-11-18 19:56   ` Chris Wright
2005-11-21  5:47   ` Matthew Dobson
2005-11-21  5:47     ` Matthew Dobson
2005-11-21 13:29     ` Pavel Machek
2005-11-21 13:29       ` Pavel Machek
2005-12-06 22:54       ` Matthew Dobson
2005-12-06 22:54         ` Matthew Dobson
2005-12-10  8:39         ` Pavel Machek
2005-12-10  8:39           ` Pavel Machek
2005-11-20  7:45 ` Keith Owens
2005-11-20  7:45   ` Keith Owens
2005-11-21  5:53   ` Matthew Dobson
2005-11-21  5:53     ` Matthew Dobson
2005-11-20 23:04 ` Pavel Machek
2005-11-20 23:04   ` Pavel Machek
2005-11-21  5:58   ` Matthew Dobson
2005-11-21  5:58     ` Matthew Dobson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=437E2E5D.1050300@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.