Bluetooth: Fix issue in the Set LE privacy function.
[platform/kernel/linux-rpi.git] / net / appletalk / ddp.c
index 8978fb6..b070a89 100644 (file)
@@ -1811,15 +1811,14 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                break;
        }
        case TIOCINQ: {
-               /*
-                * These two are safe on a single CPU system as only
-                * user tasks fiddle here
-                */
-               struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
+               struct sk_buff *skb;
                long amount = 0;
 
+               spin_lock_irq(&sk->sk_receive_queue.lock);
+               skb = skb_peek(&sk->sk_receive_queue);
                if (skb)
                        amount = skb->len - sizeof(struct ddpehdr);
+               spin_unlock_irq(&sk->sk_receive_queue.lock);
                rc = put_user(amount, (int __user *)argp);
                break;
        }