[patch 01/13] spufs snapshot against 2.6.14-rc5
Arnd Bergmann
arnd at arndb.de
Tue Nov 8 04:11:43 EST 2005
On Freedag 28 Oktober 2005 04:39, arnd at arndb.de wrote:
> The SPU file system, base
>
First of two updates against this.
---
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 <arnd at arndb.de>
Index: linux-cg/arch/ppc64/kernel/spu_syscalls.c
===================================================================
--- linux-cg.orig/arch/ppc64/kernel/spu_syscalls.c
+++ linux-cg/arch/ppc64/kernel/spu_syscalls.c
@@ -37,11 +37,12 @@ asmlinkage long sys_spu_create_thread(co
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, __u3
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;
}
More information about the Linuxppc64-dev
mailing list