Skip to content

Commit

Permalink
[POWERPC] mpc5200: Fix null dereference if bestcomm fails to initialize
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Grant Likely authored and Paul Mackerras committed Mar 24, 2008
1 parent b8c19eb commit 9560aea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/sysdev/bestcomm/bestcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9560aea

Please sign in to comment.