* [PATCH] net: Fix to check for kmemdup failure
@ 2019-03-19 3:19 Aditya Pakki
2019-03-19 20:48 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-19 3:19 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Samuel Ortiz, David S. Miller, linux-wireless, netdev,
linux-kernel
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>
---
net/nfc/llcp_sock.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index ae296273ce3d..17dcd0b5eb32 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: Fix to check for kmemdup failure
2019-03-19 3:19 [PATCH] net: Fix to check for kmemdup failure Aditya Pakki
@ 2019-03-19 20:48 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-19 20:48 UTC (permalink / raw)
To: pakki001; +Cc: kjlu, sameo, linux-wireless, netdev, linux-kernel
From: Aditya Pakki <pakki001@umn.edu>
Date: Mon, 18 Mar 2019 22:19:44 -0500
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-19 20:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 3:19 [PATCH] net: Fix to check for kmemdup failure Aditya Pakki
2019-03-19 20:48 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.