Skip to content

Commit

Permalink
sunrpc: handle ENOMEM in rpcb_getport_async
Browse files Browse the repository at this point in the history
commit 81c88b1 upstream.

If we ignore the error we'll hit a null dereference a little later.

Reported-by: syzbot+4b98281f2401ab849f4b@syzkaller.appspotmail.com
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
J. Bruce Fields authored and gregkh committed Jan 26, 2019
1 parent f76e38e commit 84ba6b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ void rpcb_getport_async(struct rpc_task *task)
case RPCBVERS_3:
map->r_netid = xprt->address_strings[RPC_DISPLAY_NETID];
map->r_addr = rpc_sockaddr2uaddr(sap, GFP_ATOMIC);
if (!map->r_addr) {
status = -ENOMEM;
dprintk("RPC: %5u %s: no memory available\n",
task->tk_pid, __func__);
goto bailout_free_args;
}
map->r_owner = "";
break;
case RPCBVERS_2:
Expand All @@ -794,6 +800,8 @@ void rpcb_getport_async(struct rpc_task *task)
rpc_put_task(child);
return;

bailout_free_args:
kfree(map);
bailout_release_client:
rpc_release_client(rpcb_clnt);
bailout_nofree:
Expand Down

0 comments on commit 84ba6b7

Please sign in to comment.