• Johan Hedberg's avatar
    Bluetooth: Fix SMP error and response to be mutually exclusive · 9b7b18ef
    Johan Hedberg authored
    Returning failure from the SMP data parsing function will cause an
    immediate disconnect, making any attempts to send a response PDU futile.
    This patch updates the function to always either send a response or
    return an error, but never both at the same time:
    
    * In the case that HCI_LE_ENABLED is not set we want to send a Pairing Not
      Supported response but it is not required to force a disconnection, so
      do not set the error return in this case.
    
    * If we get garbage SMP data we can just fail with the handler function
      instead of also trying to send an SMP Failure PDU.
    
    * There's no reason to force a disconnection if we receive an unknown SMP
      command. Instead simply send a proper Command Not Supported SMP
      response.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    9b7b18ef
smp.c 40.6 KB