NFC: only put local on destruction if it was created before
Subsystems (3)
PATCH 1/1 NFC: only put local on destruction if it was created before
Not having 'local' is a valid case when a socket was created but never bound or connected to anything, so avoid putting 'local' if it was never created.
--- net/nfc/llcp/sock.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/nfc/llcp/sock.c +2 -1
@@ -710,7 +710,8 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) sock->parent =NULL ; -nfc_llcp_local_put (sock->local); +if (sock->local) +nfc_llcp_local_put (sock->local); } static int llcp_sock_create(struct net *net, struct socket *sock,
Signature · 1 line
1.7.8.6
Hi Sasha,
Quoted 14 lines · Sasha Levin
Not having 'local' is a valid case when a socket was created but never bound or connected to anything, so avoid putting 'local' if it was never created.
Signed-off-by Sasha Levin <[email protected]>--- net/nfc/llcp/sock.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)net/nfc/llcp/sock.c +0
-0
net/nfc/llcp/sock.c void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) · line 714
Quoted 6 lines
net/nfc/llcp/sock.c +2
-1@@ -710,7 +710,8 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) sock->parent =NULL ; -nfc_llcp_local_put (sock->local); +if (sock->local) +nfc_llcp_local_put (sock->local);
nfc_llcp_local_put() already checks for its argument being NULL or not.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Quoted 18 lines · Samuel Ortiz
Hi Sasha,
Quoted 15 lines · Sasha Levin
Not having 'local' is a valid case when a socket was created but never bound or connected to anything, so avoid putting 'local' if it was never created.
Signed-off-by Sasha Levin <[email protected]>--- net/nfc/llcp/sock.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)net/nfc/llcp/sock.c +0
-0@@ -710,7 +710,8 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock)
Quoted 6 lines
net/nfc/llcp/sock.c void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) · line 714
Quoted 5 lines
net/nfc/llcp/sock.c +2
-1sock->parent =NULL ; -nfc_llcp_local_put (sock->local); +if (sock->local) +nfc_llcp_local_put (sock->local);
nfc_llcp_local_put()already checks for its argument being NULL or not.
nfc_llcp_local_put() triggers a warning in this case as well, which means that this code path shouldn't be happening.
Should we remove the WARN_ON from nfc_llcp_local_put() instead?
Quoted 26 lines · Sasha Levin
Quoted 18 lines · Samuel Ortiz
Hi Sasha,
Quoted 15 lines · Sasha Levin
Not having 'local' is a valid case when a socket was created but never bound or connected to anything, so avoid putting 'local' if it was never created.
Signed-off-by Sasha Levin <[email protected]>--- net/nfc/llcp/sock.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)net/nfc/llcp/sock.c +0
-0@@ -710,7 +710,8 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock)Quoted 6 lines
net/nfc/llcp/sock.c void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) · line 714
Quoted 5 lines
net/nfc/llcp/sock.c +2
-1sock->parent =NULL ; -nfc_llcp_local_put (sock->local); +if (sock->local) +nfc_llcp_local_put (sock->local);
nfc_llcp_local_put()already checks for its argument being NULL or not.
Quoted 4 lines
nfc_llcp_local_put()triggers a warning in this case as well, which means that this code path shouldn't be happening.Should we remove the
WARN_ONfromnfc_llcp_local_put()instead?
Yes, that would be better.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/