Commit d7737d42 authored by Aditya Pakki's avatar Aditya Pakki Committed by David S. Miller

nfc: Fix to check for kmemdup failure

In case of kmemdup failure while setting the service name the patch
returns -ENOMEM upstream for processing.
Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3e23f71
......@@ -726,6 +726,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->service_name = kmemdup(addr->service_name,
llcp_sock->service_name_len,
GFP_KERNEL);
if (!llcp_sock->service_name) {
ret = -ENOMEM;
goto sock_llcp_release;
}
nfc_llcp_sock_link(&local->connecting_sockets, sk);
......@@ -745,10 +749,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
return ret;
sock_unlink:
nfc_llcp_put_ssap(local, llcp_sock->ssap);
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
sock_llcp_release:
nfc_llcp_put_ssap(local, llcp_sock->ssap);
put_dev:
nfc_put_device(dev);
......
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