Skip to content

Commit ec0dd26

Browse files
greearbTrond Myklebust
authored andcommitted
SUNRPC: Fix use of static variable in rpcb_getport_async
Because struct rpcbind_args *map was declared static, if two threads entered this method at the same time, the values assigned to map could be sent two two differen tasks. This could cause all sorts of problems, include use-after-free and double-free of memory. Fix this by removing the static declaration so that the map pointer is on the stack. Signed-off-by: Ben Greear <greearb@candelatech.com> Cc: stable@kernel.org Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent e5012d1 commit ec0dd26

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/sunrpc/rpcb_clnt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void rpcb_getport_async(struct rpc_task *task)
597597
u32 bind_version;
598598
struct rpc_xprt *xprt;
599599
struct rpc_clnt *rpcb_clnt;
600-
static struct rpcbind_args *map;
600+
struct rpcbind_args *map;
601601
struct rpc_task *child;
602602
struct sockaddr_storage addr;
603603
struct sockaddr *sap = (struct sockaddr *)&addr;

0 commit comments

Comments
 (0)