aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/bestcomm/bestcomm.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2008-03-22 14:41:05 +1100
committerPaul Mackerras <paulus@samba.org>2008-03-24 17:55:49 +1100
commit9560aea4e9d17cb75113c6051e800222fd5c71a4 (patch)
tree88517a2a9d2380196b32b03f047eadf1602316c8 /arch/powerpc/sysdev/bestcomm/bestcomm.c
parent[POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver (diff)
downloadlinux-dev-9560aea4e9d17cb75113c6051e800222fd5c71a4.tar.xz
linux-dev-9560aea4e9d17cb75113c6051e800222fd5c71a4.zip
[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 '')
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index f589999361e0..b18cab55a76d 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)
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);