]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sat, 13 May 2023 11:52:04 +0000 (13:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 06:37:07 +0000 (08:37 +0200)
commit6ca0c94f2b029e83c96657c3ef5ec2971629e59a
tree2472a6d1592cafc35f3602e309198360200f6da9
parent66a1be74230bbe098e651766c9a0cf4038db8442
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()

[ Upstream commit 0d9b41daa5907756a31772d8af8ac5ff25cf17c1 ]

If sock->service_name is NULL, the local variable
service_name_tlv_length will not be assigned by nfc_llcp_build_tlv(),
later leading to using value frmo the stack.  Smatch warning:

  net/nfc/llcp_commands.c:442 nfc_llcp_send_connect() error: uninitialized symbol 'service_name_tlv_length'.

Fixes: de9e5aeb4f40 ("NFC: llcp: Fix usage of llcp_add_tlv()")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/nfc/llcp_commands.c