Bluetooth: Fix handling of unexpected SMP PDUs
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 29 Jan 2013 16:44:23 +0000 (10:44 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 20 Feb 2013 03:15:22 +0000 (03:15 +0000)
commit93322d7fee4bc923dfede42f78cad115027bfcd3
treec9478012da647a4ddaa0c869d4b0d5ed403ff749
parent02fb524d798d829131a3d3f7694f6fb15663665f
Bluetooth: Fix handling of unexpected SMP PDUs

commit 8cf9fa1240229cbdd888236c0c43fcbad680cf00 upstream.

The conn->smp_chan pointer can be NULL if SMP PDUs arrive at unexpected
moments. To avoid NULL pointer dereferences the code should be checking
for this and disconnect if an unexpected SMP PDU arrives. This patch
fixes the issue by adding a check for conn->smp_chan for all other PDUs
except pairing request and security request (which are are the first
PDUs to come to initialize the SMP context).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/bluetooth/smp.c