mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +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 = kmemdup(addr->service_name,
|
||||||
llcp_sock->service_name_len,
|
llcp_sock->service_name_len,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
if (!llcp_sock->service_name) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto sock_llcp_release;
|
||||||
|
}
|
||||||
|
|
||||||
nfc_llcp_sock_link(&local->connecting_sockets, sk);
|
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;
|
return ret;
|
||||||
|
|
||||||
sock_unlink:
|
sock_unlink:
|
||||||
nfc_llcp_put_ssap(local, llcp_sock->ssap);
|
|
||||||
|
|
||||||
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
|
nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
|
||||||
|
|
||||||
|
sock_llcp_release:
|
||||||
|
nfc_llcp_put_ssap(local, llcp_sock->ssap);
|
||||||
|
|
||||||
put_dev:
|
put_dev:
|
||||||
nfc_put_device(dev);
|
nfc_put_device(dev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user