diff options
author | Matthew Dobson <colpatch@us.ibm.com> | 2005-11-22 00:32:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-22 12:13:44 -0500 |
commit | 79e448bf2d71d52d28c99be4faff9cc51928f90b (patch) | |
tree | b3c8255d2384e7e8d529dc368b42563a0a1f6e0b /drivers/scsi/scsi.c | |
parent | e738cf6d03786486b7e1adbaed1c5c4e14d23626 (diff) |
[PATCH] Fix a bug in scsi_get_command
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>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 0be60bba58d3..180676d7115a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -265,10 +265,10 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask) | |||
265 | spin_lock_irqsave(&dev->list_lock, flags); | 265 | spin_lock_irqsave(&dev->list_lock, flags); |
266 | list_add_tail(&cmd->list, &dev->cmd_list); | 266 | list_add_tail(&cmd->list, &dev->cmd_list); |
267 | spin_unlock_irqrestore(&dev->list_lock, flags); | 267 | spin_unlock_irqrestore(&dev->list_lock, flags); |
268 | cmd->jiffies_at_alloc = jiffies; | ||
268 | } else | 269 | } else |
269 | put_device(&dev->sdev_gendev); | 270 | put_device(&dev->sdev_gendev); |
270 | 271 | ||
271 | cmd->jiffies_at_alloc = jiffies; | ||
272 | return cmd; | 272 | return cmd; |
273 | } | 273 | } |
274 | EXPORT_SYMBOL(scsi_get_command); | 274 | EXPORT_SYMBOL(scsi_get_command); |