Bluetooth: Fix double error response for l2cap_create_chan_req
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 16 Sep 2013 10:05:13 +0000 (13:05 +0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 18 Sep 2013 21:41:07 +0000 (16:41 -0500)
When an L2CAP request handler returns non-zero the calling code will
send a command reject response. The l2cap_create_chan_req function will
in some cases send its own response but then still return a -EFAULT
error which would cause two responses to be sent. This patch fixes this
by making the function return 0 after sending its own response.

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>
net/bluetooth/l2cap_core.c

index b3bb7bca8e606439edbd9f9838bb8021200bb28c..0b8a2704928e47560242c5e35f7d688529abb954 100644 (file)
@@ -4462,7 +4462,7 @@ error:
        l2cap_send_cmd(conn, cmd->ident, L2CAP_CREATE_CHAN_RSP,
                       sizeof(rsp), &rsp);
 
-       return -EFAULT;
+       return 0;
 }
 
 static void l2cap_send_move_chan_req(struct l2cap_chan *chan, u8 dest_amp_id)