From: Krzysztof Kozlowski Date: Wed, 2 Mar 2022 19:25:18 +0000 (+0100) Subject: nfc: llcp: nullify llcp_sock->dev on connect() error paths X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=13a3585b264bfeba018941a713b8d7fc9b8221a2;p=linux.git 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 Signed-off-by: David S. Miller --- diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c index 0b93a17b9f11f..e92440c0c4c76 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: