+ net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: net/9p/client.c: put refcount of trans_mod in error case in parse_opts()
has been added to the -mm tree.  Its filename is
     net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: piaojun <piaojun@xxxxxxxxxx>
Subject: net/9p/client.c: put refcount of trans_mod in error case in parse_opts()

In my testing, the second mount will fail after umounting successfully. 
The reason is that we put refcount of trans_mod in the correct case rather
than the error case in parse_opts() at last.  That will cause the refcount
decrease to -1, and when we try to get trans_mod again in
try_module_get(), we could only increase refcount to 0 which will cause
failure as follows:

parse_opts
  v9fs_get_trans_by_name
    try_module_get : return NULL to caller which cause error

So we should put refcount of trans_mod in error case.

Link: http://lkml.kernel.org/r/5B3F39A0.2030509@xxxxxxxxxx
Fixes: 9421c3e64137ec ("net/9p/client.c: fix potential refcnt problem of trans module")
Signed-off-by: Jun Piao <piaojun@xxxxxxxxxx>
Reviewed-by: Yiwen Jiang <jiangyiwen@xxxxxxxxxx>
Cc: Eric Van Hensbergen <ericvh@xxxxxxxxx>
Cc: Ron Minnich <rminnich@xxxxxxxxxx>
Cc: Latchesar Ionkov <lucho@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 net/9p/client.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN net/9p/client.c~net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts net/9p/client.c
--- a/net/9p/client.c~net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts
+++ a/net/9p/client.c
@@ -225,7 +225,8 @@ static int parse_opts(char *opts, struct
 	}
 
 free_and_return:
-	v9fs_put_trans(clnt->trans_mod);
+	if (ret)
+		v9fs_put_trans(clnt->trans_mod);
 	kfree(tmp_options);
 	return ret;
 }
_

Patches currently in -mm which might be from piaojun@xxxxxxxxxx are

net-9p-clientc-put-refcount-of-trans_mod-in-error-case-in-parse_opts.patch
ocfs2-return-erofs-when-filesystem-becomes-read-only.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux