summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp_sock.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2022-03-02 20:25:18 +0100
committerDavid S. Miller <davem@davemloft.net>2022-03-03 11:43:37 +0100
commit13a3585b264bfeba018941a713b8d7fc9b8221a2 (patch)
tree189ec2afaaf5c5ae8ab977f2dd0f41377bd03812 /net/nfc/llcp_sock.c
parentMerge branch 'net-hw-counters-for-soft-devices' (diff)
downloadlinux-13a3585b264bfeba018941a713b8d7fc9b8221a2.tar.xz
linux-13a3585b264bfeba018941a713b8d7fc9b8221a2.zip
nfc: llcp: nullify llcp_sock->dev on connect() error paths
Nullify the llcp_sock->dev on llcp_sock_connect() error paths, symmetrically to the code llcp_sock_bind(). The non-NULL value of llcp_sock->dev is used in a few places to check whether the socket is still valid. There was no particular issue observed with missing NULL assignment in connect() error path, however a similar case - in the bind() error path - was triggereable. That one was fixed in commit 4ac06a1e013c ("nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect"), so the change here seems logical as well. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/nfc/llcp_sock.c')
-rw-r--r--net/nfc/llcp_sock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 0b93a17b9f11..e92440c0c4c7 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -764,6 +764,7 @@ sock_llcp_release:
llcp_sock->local = NULL;
put_dev:
+ llcp_sock->dev = NULL;
nfc_put_device(dev);
error: