Skip to contentSkip to conversation

SUNRPC: Fix a module reference leak in svc_handle_xprt

PATCH In review Trond Myklebust 2 participants 2 messages May 18, 2014 – May 22, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SUNRPC: Fix a module reference leak in svc_handle_xprt

If the accept() call fails, we need to put the module reference.

---
 net/sunrpc/svc_xprt.c | 2 ++
 1 file changed, 2 insertions(+)
net/sunrpc/svc_xprt.c +2 -0
index 06c6ff0cb911..a4acaf2bcf18 100644
@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
 		newxpt = xprt->xpt_ops->xpo_accept(xprt);
 		if (newxpt)
 			svc_add_new_temp_xprt(serv, newxpt);
+		else
+			module_put(xprt->xpt_class->xcl_owner);
 	} else if (xprt->xpt_ops->xpo_has_wspace(xprt)) {
 		/* XPT_DATA|XPT_DEFERRED case: */
 		dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
Signature · 1 line
1.9.0
#1 lore raw
Quoted 1 line · Trond Myklebust

If the accept() call fails, we need to put the module reference.

OK, applying for 3.16 and stable.

--b.

Quoted 22 lines
---
 net/sunrpc/svc_xprt.c | 2 ++
 1 file changed, 2 insertions(+)
net/sunrpc/svc_xprt.c +2 -0
index 06c6ff0cb911..a4acaf2bcf18 100644
@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
 		newxpt = xprt->xpt_ops->xpo_accept(xprt);
 		if (newxpt)
 			svc_add_new_temp_xprt(serv, newxpt);
+		else
+			module_put(xprt->xpt_class->xcl_owner);
 	} else if (xprt->xpt_ops->xpo_has_wspace(xprt)) {
 		/* XPT_DATA|XPT_DEFERRED case: */
 		dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
Signature · 1 line
1.9.0