diff options
author | Chengguang Xu <cgxu519@gmx.com> | 2018-04-05 19:20:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-06 00:36:23 -0400 |
commit | 9421c3e64137ec69e5cf4ed024dc777a09b7779f (patch) | |
tree | 53dfc3a13cfc070472ae9a0aa4d6dadd9fc1cf30 /net/9p | |
parent | 7ff3c2046803ac99d95de6d63cda46c84f72293b (diff) |
net/9p/client.c: fix potential refcnt problem of trans module
When specifying trans_mod multiple times in a mount, it will cause an
inaccurate refcount of the trans module. Also, in the error case of
option parsing, we should put the trans module if we have already got
it.
Link: http://lkml.kernel.org/r/1522154942-57339-1-git-send-email-cgxu519@gmx.com
Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/client.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index e6cae8332e2e..21e6df1cc70f 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -190,7 +190,9 @@ static int parse_opts(char *opts, struct p9_client *clnt) | |||
190 | p9_debug(P9_DEBUG_ERROR, | 190 | p9_debug(P9_DEBUG_ERROR, |
191 | "problem allocating copy of trans arg\n"); | 191 | "problem allocating copy of trans arg\n"); |
192 | goto free_and_return; | 192 | goto free_and_return; |
193 | } | 193 | } |
194 | |||
195 | v9fs_put_trans(clnt->trans_mod); | ||
194 | clnt->trans_mod = v9fs_get_trans_by_name(s); | 196 | clnt->trans_mod = v9fs_get_trans_by_name(s); |
195 | if (clnt->trans_mod == NULL) { | 197 | if (clnt->trans_mod == NULL) { |
196 | pr_info("Could not find request transport: %s\n", | 198 | pr_info("Could not find request transport: %s\n", |
@@ -226,6 +228,7 @@ static int parse_opts(char *opts, struct p9_client *clnt) | |||
226 | } | 228 | } |
227 | 229 | ||
228 | free_and_return: | 230 | free_and_return: |
231 | v9fs_put_trans(clnt->trans_mod); | ||
229 | kfree(tmp_options); | 232 | kfree(tmp_options); |
230 | return ret; | 233 | return ret; |
231 | } | 234 | } |