diff options
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index cd8f6ea03841..4ed38272df78 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -3078,6 +3078,14 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
3078 | break; | 3078 | break; |
3079 | 3079 | ||
3080 | default: | 3080 | default: |
3081 | /* don't delete l2cap channel if sk is owned by user */ | ||
3082 | if (sock_owned_by_user(sk)) { | ||
3083 | sk->sk_state = BT_DISCONN; | ||
3084 | l2cap_sock_clear_timer(sk); | ||
3085 | l2cap_sock_set_timer(sk, HZ / 5); | ||
3086 | break; | ||
3087 | } | ||
3088 | |||
3081 | l2cap_chan_del(sk, ECONNREFUSED); | 3089 | l2cap_chan_del(sk, ECONNREFUSED); |
3082 | break; | 3090 | break; |
3083 | } | 3091 | } |
@@ -3283,6 +3291,15 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd | |||
3283 | 3291 | ||
3284 | sk->sk_shutdown = SHUTDOWN_MASK; | 3292 | sk->sk_shutdown = SHUTDOWN_MASK; |
3285 | 3293 | ||
3294 | /* don't delete l2cap channel if sk is owned by user */ | ||
3295 | if (sock_owned_by_user(sk)) { | ||
3296 | sk->sk_state = BT_DISCONN; | ||
3297 | l2cap_sock_clear_timer(sk); | ||
3298 | l2cap_sock_set_timer(sk, HZ / 5); | ||
3299 | bh_unlock_sock(sk); | ||
3300 | return 0; | ||
3301 | } | ||
3302 | |||
3286 | l2cap_chan_del(sk, ECONNRESET); | 3303 | l2cap_chan_del(sk, ECONNRESET); |
3287 | bh_unlock_sock(sk); | 3304 | bh_unlock_sock(sk); |
3288 | 3305 | ||
@@ -3305,6 +3322,15 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd | |||
3305 | if (!sk) | 3322 | if (!sk) |
3306 | return 0; | 3323 | return 0; |
3307 | 3324 | ||
3325 | /* don't delete l2cap channel if sk is owned by user */ | ||
3326 | if (sock_owned_by_user(sk)) { | ||
3327 | sk->sk_state = BT_DISCONN; | ||
3328 | l2cap_sock_clear_timer(sk); | ||
3329 | l2cap_sock_set_timer(sk, HZ / 5); | ||
3330 | bh_unlock_sock(sk); | ||
3331 | return 0; | ||
3332 | } | ||
3333 | |||
3308 | l2cap_chan_del(sk, 0); | 3334 | l2cap_chan_del(sk, 0); |
3309 | bh_unlock_sock(sk); | 3335 | bh_unlock_sock(sk); |
3310 | 3336 | ||