aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2005-12-05 22:52:23 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-09 14:52:48 +1100
commitb41305a39a6966d8e8b1449d6b7c194923bfb451 (patch)
treee8d3368d06a3b900e16700481183bd92ec9c7d4f /arch/powerpc
parentd88cfffac0002c56c1a7a813cb885fa6b5fdcd0e (diff)
[PATCH] spufs: Fix oops when spufs module is not loaded
try_module_get returns true when NULL arguments, so we first need to check if there is a module loaded before getting the reference count. Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index 43e0b187ffd..91d564df944 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -37,11 +37,12 @@ asmlinkage long sys_spu_create(const char __user *name,
unsigned int flags, mode_t mode)
{
long ret;
+ struct module *owner = spufs_calls.owner;
ret = -ENOSYS;
- if (try_module_get(spufs_calls.owner)) {
+ if (owner && try_module_get(spufs_calls.owner)) {
ret = spufs_calls.create_thread(name, flags, mode);
- module_put(spufs_calls.owner);
+ module_put(owner);
}
return ret;
}
@@ -51,16 +52,17 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
long ret;
struct file *filp;
int fput_needed;
+ struct module *owner = spufs_calls.owner;
ret = -ENOSYS;
- if (try_module_get(spufs_calls.owner)) {
+ if (owner && try_module_get(owner)) {
ret = -EBADF;
filp = fget_light(fd, &fput_needed);
if (filp) {
ret = spufs_calls.spu_run(filp, unpc, ustatus);
fput_light(filp, fput_needed);
}
- module_put(spufs_calls.owner);
+ module_put(owner);
}
return ret;
}