projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ac89b2e
)
9p: check memory allocation result for cachetag
author
Chengguang Xu
<
[email protected]
>
Thu, 5 Apr 2018 23:19:53 +0000
(16:19 -0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 6 Apr 2018 04:36:22 +0000
(21:36 -0700)
Check memory allocation result for cachetag in mount option parsing and
fix potential memory leak in the error case.
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Chengguang Xu <
[email protected]
>
Reviewed-by: Andrew Morton <
[email protected]
>
Cc: Eric Van Hensbergen <
[email protected]
>
Cc: Ron Minnich <
[email protected]
>
Cc: Latchesar Ionkov <
[email protected]
>
Cc: <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
fs/9p/v9fs.c
patch
|
blob
|
history
diff --git
a/fs/9p/v9fs.c
b/fs/9p/v9fs.c
index 8fb89ddc6cc7ec3be59236cd5e493ffcc44719ae..e622f0f10502886556d637b2c5951efce78fcba0 100644
(file)
--- a/
fs/9p/v9fs.c
+++ b/
fs/9p/v9fs.c
@@
-292,6
+292,10
@@
static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
#ifdef CONFIG_9P_FSCACHE
kfree(v9ses->cachetag);
v9ses->cachetag = match_strdup(&args[0]);
+ if (!v9ses->cachetag) {
+ ret = -ENOMEM;
+ goto free_and_return;
+ }
#endif
break;
case Opt_cache:
@@
-471,6
+475,9
@@
struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
return fid;
err_clnt:
+#ifdef CONFIG_9P_FSCACHE
+ kfree(v9ses->cachetag);
+#endif
p9_client_destroy(v9ses->clnt);
err_names:
kfree(v9ses->uname);