diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2008-03-21 23:41:05 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2008-03-24 02:55:49 -0400 |
| commit | 9560aea4e9d17cb75113c6051e800222fd5c71a4 (patch) | |
| tree | 88517a2a9d2380196b32b03f047eadf1602316c8 /arch/powerpc/sysdev/bestcomm | |
| parent | b8c19eb16a7e6df57d0f6d67e42ce026e5d5930b (diff) | |
[POWERPC] mpc5200: Fix null dereference if bestcomm fails to initialize
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>
Diffstat (limited to 'arch/powerpc/sysdev/bestcomm')
| -rw-r--r-- | arch/powerpc/sysdev/bestcomm/bestcomm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c index f589999361e..b18cab55a76 100644 --- a/arch/powerpc/sysdev/bestcomm/bestcomm.c +++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c | |||
| @@ -52,6 +52,10 @@ bcom_task_alloc(int bd_count, int bd_size, int priv_size) | |||
| 52 | int i, tasknum = -1; | 52 | int i, tasknum = -1; |
| 53 | struct bcom_task *tsk; | 53 | struct bcom_task *tsk; |
| 54 | 54 | ||
| 55 | /* Don't try to do anything if bestcomm init failed */ | ||
| 56 | if (!bcom_eng) | ||
| 57 | return NULL; | ||
| 58 | |||
| 55 | /* Get and reserve a task num */ | 59 | /* Get and reserve a task num */ |
| 56 | spin_lock(&bcom_eng->lock); | 60 | spin_lock(&bcom_eng->lock); |
| 57 | 61 | ||
