~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to net/bluetooth/rfcomm/core.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
#define rfcomm_lock()   mutex_lock(&rfcomm_mutex)
63
63
#define rfcomm_unlock() mutex_unlock(&rfcomm_mutex)
64
64
 
65
 
static unsigned long rfcomm_event;
66
65
 
67
66
static LIST_HEAD(session_list);
68
67
 
120
119
{
121
120
        if (!rfcomm_thread)
122
121
                return;
123
 
        set_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
124
122
        wake_up_process(rfcomm_thread);
125
123
}
126
124
 
1804
1802
                        continue;
1805
1803
                }
1806
1804
 
 
1805
                if (test_bit(RFCOMM_ENC_DROP, &d->flags)) {
 
1806
                        __rfcomm_dlc_close(d, ECONNREFUSED);
 
1807
                        continue;
 
1808
                }
 
1809
 
1807
1810
                if (test_and_clear_bit(RFCOMM_AUTH_ACCEPT, &d->flags)) {
1808
1811
                        rfcomm_dlc_clear_timer(d);
1809
1812
                        if (d->out) {
1855
1858
        /* Get data directly from socket receive queue without copying it. */
1856
1859
        while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
1857
1860
                skb_orphan(skb);
1858
 
                rfcomm_recv_frame(s, skb);
 
1861
                if (!skb_linearize(skb))
 
1862
                        rfcomm_recv_frame(s, skb);
 
1863
                else
 
1864
                        kfree_skb(skb);
1859
1865
        }
1860
1866
 
1861
1867
        if (sk->sk_state == BT_CLOSED) {
2038
2044
 
2039
2045
        rfcomm_add_listener(BDADDR_ANY);
2040
2046
 
2041
 
        while (!kthread_should_stop()) {
 
2047
        while (1) {
2042
2048
                set_current_state(TASK_INTERRUPTIBLE);
2043
 
                if (!test_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event)) {
2044
 
                        /* No pending events. Let's sleep.
2045
 
                         * Incoming connections and data will wake us up. */
2046
 
                        schedule();
2047
 
                }
2048
 
                set_current_state(TASK_RUNNING);
 
2049
 
 
2050
                if (kthread_should_stop())
 
2051
                        break;
2049
2052
 
2050
2053
                /* Process stuff */
2051
 
                clear_bit(RFCOMM_SCHED_WAKEUP, &rfcomm_event);
2052
2054
                rfcomm_process_sessions();
 
2055
 
 
2056
                schedule();
2053
2057
        }
 
2058
        __set_current_state(TASK_RUNNING);
2054
2059
 
2055
2060
        rfcomm_kill_listener();
2056
2061
 
2077
2082
                if (test_and_clear_bit(RFCOMM_SEC_PENDING, &d->flags)) {
2078
2083
                        rfcomm_dlc_clear_timer(d);
2079
2084
                        if (status || encrypt == 0x00) {
2080
 
                                __rfcomm_dlc_close(d, ECONNREFUSED);
 
2085
                                set_bit(RFCOMM_ENC_DROP, &d->flags);
2081
2086
                                continue;
2082
2087
                        }
2083
2088
                }
2088
2093
                                rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT);
2089
2094
                                continue;
2090
2095
                        } else if (d->sec_level == BT_SECURITY_HIGH) {
2091
 
                                __rfcomm_dlc_close(d, ECONNREFUSED);
 
2096
                                set_bit(RFCOMM_ENC_DROP, &d->flags);
2092
2097
                                continue;
2093
2098
                        }
2094
2099
                }