diff options
-rw-r--r-- | net/bluetooth/l2cap_core.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index ae0054ccee5b..b6bca64b320d 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -5736,6 +5736,31 @@ static inline int l2cap_le_credits(struct l2cap_conn *conn, | |||
5736 | return 0; | 5736 | return 0; |
5737 | } | 5737 | } |
5738 | 5738 | ||
5739 | static inline int l2cap_le_command_rej(struct l2cap_conn *conn, | ||
5740 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, | ||
5741 | u8 *data) | ||
5742 | { | ||
5743 | struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data; | ||
5744 | struct l2cap_chan *chan; | ||
5745 | |||
5746 | if (cmd_len < sizeof(*rej)) | ||
5747 | return -EPROTO; | ||
5748 | |||
5749 | mutex_lock(&conn->chan_lock); | ||
5750 | |||
5751 | chan = __l2cap_get_chan_by_ident(conn, cmd->ident); | ||
5752 | if (!chan) | ||
5753 | goto done; | ||
5754 | |||
5755 | l2cap_chan_lock(chan); | ||
5756 | l2cap_chan_del(chan, ECONNREFUSED); | ||
5757 | l2cap_chan_unlock(chan); | ||
5758 | |||
5759 | done: | ||
5760 | mutex_unlock(&conn->chan_lock); | ||
5761 | return 0; | ||
5762 | } | ||
5763 | |||
5739 | static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn, | 5764 | static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn, |
5740 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, | 5765 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
5741 | u8 *data) | 5766 | u8 *data) |
@@ -5755,6 +5780,7 @@ static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn, | |||
5755 | 5780 | ||
5756 | switch (cmd->code) { | 5781 | switch (cmd->code) { |
5757 | case L2CAP_COMMAND_REJ: | 5782 | case L2CAP_COMMAND_REJ: |
5783 | l2cap_le_command_rej(conn, cmd, cmd_len, data); | ||
5758 | break; | 5784 | break; |
5759 | 5785 | ||
5760 | case L2CAP_CONN_PARAM_UPDATE_REQ: | 5786 | case L2CAP_CONN_PARAM_UPDATE_REQ: |