[PATCH repost] aic94xx: sas_alloc_task

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check kmem_cache_alloc return prior to init of sas_task struct.

Signed-off-by: Mike Anderson <andmike@xxxxxxxxxx>

 include/scsi/sas/sas_task.h |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_task.h	2006-03-28 09:19:29.000000000 -0800
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h	2006-03-30 08:46:06.000000000 -0800
@@ -212,12 +212,14 @@ static inline struct sas_task *sas_alloc
 	extern kmem_cache_t *sas_task_cache;
 	struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags);
 
-	memset(task, 0, sizeof(*task));
-	INIT_LIST_HEAD(&task->list);
-	spin_lock_init(&task->task_state_lock);
-	task->task_state_flags = SAS_TASK_STATE_PENDING;
-	init_timer(&task->timer);
-	init_completion(&task->completion);
+	if (task) {
+		memset(task, 0, sizeof(*task));
+		INIT_LIST_HEAD(&task->list);
+		spin_lock_init(&task->task_state_lock);
+		task->task_state_flags = SAS_TASK_STATE_PENDING;
+		init_timer(&task->timer);
+		init_completion(&task->completion);
+	}
 
 	return task;
 }
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux