Commit ec1fc58b authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Stefan Bader

sunrpc: handle ENOMEM in rpcb_getport_async

BugLink: https://bugs.launchpad.net/bugs/1818797

commit 81c88b18 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: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent b4b4be2a
...@@ -772,6 +772,12 @@ void rpcb_getport_async(struct rpc_task *task) ...@@ -772,6 +772,12 @@ void rpcb_getport_async(struct rpc_task *task)
case RPCBVERS_3: case RPCBVERS_3:
map->r_netid = xprt->address_strings[RPC_DISPLAY_NETID]; map->r_netid = xprt->address_strings[RPC_DISPLAY_NETID];
map->r_addr = rpc_sockaddr2uaddr(sap, GFP_ATOMIC); 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 = ""; map->r_owner = "";
break; break;
case RPCBVERS_2: case RPCBVERS_2:
...@@ -794,6 +800,8 @@ void rpcb_getport_async(struct rpc_task *task) ...@@ -794,6 +800,8 @@ void rpcb_getport_async(struct rpc_task *task)
rpc_put_task(child); rpc_put_task(child);
return; return;
bailout_free_args:
kfree(map);
bailout_release_client: bailout_release_client:
rpc_release_client(rpcb_clnt); rpc_release_client(rpcb_clnt);
bailout_nofree: bailout_nofree:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment