diff options
| -rw-r--r-- | net/bluetooth/l2cap.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index fadf26b4ed7c..c7847035562b 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -3071,6 +3071,17 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
| 3071 | return 0; | 3071 | return 0; |
| 3072 | } | 3072 | } |
| 3073 | 3073 | ||
| 3074 | static inline void set_default_fcs(struct l2cap_pinfo *pi) | ||
| 3075 | { | ||
| 3076 | /* FCS is enabled only in ERTM or streaming mode, if one or both | ||
| 3077 | * sides request it. | ||
| 3078 | */ | ||
| 3079 | if (pi->mode != L2CAP_MODE_ERTM && pi->mode != L2CAP_MODE_STREAMING) | ||
| 3080 | pi->fcs = L2CAP_FCS_NONE; | ||
| 3081 | else if (!(pi->conf_state & L2CAP_CONF_NO_FCS_RECV)) | ||
| 3082 | pi->fcs = L2CAP_FCS_CRC16; | ||
| 3083 | } | ||
| 3084 | |||
| 3074 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) | 3085 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) |
| 3075 | { | 3086 | { |
| 3076 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; | 3087 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; |
| @@ -3135,9 +3146,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
| 3135 | goto unlock; | 3146 | goto unlock; |
| 3136 | 3147 | ||
| 3137 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { | 3148 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_INPUT_DONE) { |
| 3138 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_NO_FCS_RECV) || | 3149 | set_default_fcs(l2cap_pi(sk)); |
| 3139 | l2cap_pi(sk)->fcs != L2CAP_FCS_NONE) | ||
| 3140 | l2cap_pi(sk)->fcs = L2CAP_FCS_CRC16; | ||
| 3141 | 3150 | ||
| 3142 | sk->sk_state = BT_CONNECTED; | 3151 | sk->sk_state = BT_CONNECTED; |
| 3143 | 3152 | ||
| @@ -3225,9 +3234,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
| 3225 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE; | 3234 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_INPUT_DONE; |
| 3226 | 3235 | ||
| 3227 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) { | 3236 | if (l2cap_pi(sk)->conf_state & L2CAP_CONF_OUTPUT_DONE) { |
| 3228 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_NO_FCS_RECV) || | 3237 | set_default_fcs(l2cap_pi(sk)); |
| 3229 | l2cap_pi(sk)->fcs != L2CAP_FCS_NONE) | ||
| 3230 | l2cap_pi(sk)->fcs = L2CAP_FCS_CRC16; | ||
| 3231 | 3238 | ||
| 3232 | sk->sk_state = BT_CONNECTED; | 3239 | sk->sk_state = BT_CONNECTED; |
| 3233 | l2cap_pi(sk)->next_tx_seq = 0; | 3240 | l2cap_pi(sk)->next_tx_seq = 0; |
