summaryrefslogtreecommitdiff
path: root/fs/exec.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2002-12-29 00:40:46 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-12-29 00:40:46 -0800
commitafe0458b256d78a37ba9f244cce29e141e1c658a (patch)
tree274954c06695edfd75cc761366ec38c413276dce /fs/exec.c
parent2cdea2157dfbe0ea2a28bf6d4dc6c53013e4088f (diff)
[PATCH] avoid deprecated module functions in core code
A second start at removing them from kernel/*.c and fs/*.c. Note that module_put is fine for a NULL argument.
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 1699f5bdf92e..901b8e12388f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -102,8 +102,7 @@ int unregister_binfmt(struct linux_binfmt * fmt)
static inline void put_binfmt(struct linux_binfmt * fmt)
{
- if (fmt->module)
- __MOD_DEC_USE_COUNT(fmt->module);
+ module_put(fmt->module);
}
/*
@@ -1108,14 +1107,18 @@ out_file:
return retval;
}
-void set_binfmt(struct linux_binfmt *new)
+int set_binfmt(struct linux_binfmt *new)
{
struct linux_binfmt *old = current->binfmt;
- if (new && new->module)
- __MOD_INC_USE_COUNT(new->module);
+
+ if (new) {
+ if (!try_module_get(new->module))
+ return -1;
+ }
current->binfmt = new;
- if (old && old->module)
- __MOD_DEC_USE_COUNT(old->module);
+ if (old)
+ module_put(old->module);
+ return 0;
}
#define CORENAME_MAX_SIZE 64