[POWERPC] mpc5200: Fix null dereference if bestcomm fails to initialize
authorGrant Likely <grant.likely@secretlab.ca>
Sat, 22 Mar 2008 03:41:05 +0000 (14:41 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 24 Mar 2008 06:55:49 +0000 (17:55 +1100)
If the bestcomm initialization fails, calls to the task allocate
function should fail gracefully instead of oopsing with a NULL deref.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/sysdev/bestcomm/bestcomm.c

index f589999361e060958c145ac199eec85ae466f24a..b18cab55a76d8351a1833334475c9883d0bd303d 100644 (file)
@@ -52,6 +52,10 @@ bcom_task_alloc(int bd_count, int bd_size, int priv_size)
        int i, tasknum = -1;
        struct bcom_task *tsk;
 
+       /* Don't try to do anything if bestcomm init failed */
+       if (!bcom_eng)
+               return NULL;
+
        /* Get and reserve a task num */
        spin_lock(&bcom_eng->lock);