提交 2da2c21d 编写于 作者: T Tom Tucker 提交者: J. Bruce Fields

Add a reference to sunrpc in svc_addsock

The svc_addsock function adds transport instances without taking a
reference on the sunrpc.ko module, however, the generic transport
destruction code drops a reference when a transport instance
is destroyed.

Add a try_module_get call to the svc_addsock function for transport
instances added by this function.
Signed-off-by: NTom Tucker <tom@opengridcomputing.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
Tested-by: NJeff Moyer <jmoyer@redhat.com>
上级 2c5e7615
...@@ -1183,7 +1183,11 @@ int svc_addsock(struct svc_serv *serv, ...@@ -1183,7 +1183,11 @@ int svc_addsock(struct svc_serv *serv,
else if (so->state > SS_UNCONNECTED) else if (so->state > SS_UNCONNECTED)
err = -EISCONN; err = -EISCONN;
else { else {
svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS); if (!try_module_get(THIS_MODULE))
err = -ENOENT;
else
svsk = svc_setup_socket(serv, so, &err,
SVC_SOCK_DEFAULTS);
if (svsk) { if (svsk) {
struct sockaddr_storage addr; struct sockaddr_storage addr;
struct sockaddr *sin = (struct sockaddr *)&addr; struct sockaddr *sin = (struct sockaddr *)&addr;
...@@ -1196,7 +1200,8 @@ int svc_addsock(struct svc_serv *serv, ...@@ -1196,7 +1200,8 @@ int svc_addsock(struct svc_serv *serv,
spin_unlock_bh(&serv->sv_lock); spin_unlock_bh(&serv->sv_lock);
svc_xprt_received(&svsk->sk_xprt); svc_xprt_received(&svsk->sk_xprt);
err = 0; err = 0;
} } else
module_put(THIS_MODULE);
} }
if (err) { if (err) {
sockfd_put(so); sockfd_put(so);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册