mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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: Aditya Pakki <pakki001@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a3e23f719f
commit
d7737d4257
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user