Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9421c3e6 authored by Chengguang Xu's avatar Chengguang Xu Committed by Linus Torvalds
Browse files

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: default avatarChengguang Xu <cgxu519@gmx.com>
Reviewed-by: default avatarAndrew 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7ff3c204
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -191,6 +191,8 @@ static int parse_opts(char *opts, struct p9_client *clnt)
					 "problem allocating copy of trans arg\n");
				goto free_and_return;
			}

			v9fs_put_trans(clnt->trans_mod);
			clnt->trans_mod = v9fs_get_trans_by_name(s);
			if (clnt->trans_mod == NULL) {
				pr_info("Could not find request transport: %s\n",
@@ -226,6 +228,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
	}

free_and_return:
	v9fs_put_trans(clnt->trans_mod);
	kfree(tmp_options);
	return ret;
}