소스 검색

SUNRPC: Fix a double-free in rpcbind

It is wrong to be freeing up the rpcbind arguments if the call to
rpcb_call_async() fails, since they should already have been freed up by
rpcb_map_release().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust 17 년 전
부모
커밋
0d3a34b48c
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      net/sunrpc/rpcb_clnt.c

+ 2 - 4
net/sunrpc/rpcb_clnt.c

@@ -365,18 +365,16 @@ void rpcb_getport_async(struct rpc_task *task)
 	rpc_release_client(rpcb_clnt);
 	rpc_release_client(rpcb_clnt);
 	if (IS_ERR(child)) {
 	if (IS_ERR(child)) {
 		status = -EIO;
 		status = -EIO;
+		/* rpcb_map_release() has freed the arguments */
 		dprintk("RPC: %5u %s: rpc_run_task failed\n",
 		dprintk("RPC: %5u %s: rpc_run_task failed\n",
 			task->tk_pid, __func__);
 			task->tk_pid, __func__);
-		goto bailout;
+		goto bailout_nofree;
 	}
 	}
 	rpc_put_task(child);
 	rpc_put_task(child);
 
 
 	task->tk_xprt->stat.bind_count++;
 	task->tk_xprt->stat.bind_count++;
 	return;
 	return;
 
 
-bailout:
-	kfree(map);
-	xprt_put(xprt);
 bailout_nofree:
 bailout_nofree:
 	rpcb_wake_rpcbind_waiters(xprt, status);
 	rpcb_wake_rpcbind_waiters(xprt, status);
 bailout_nowake:
 bailout_nowake: