~ubuntu-branches/debian/sid/linux-grsec/sid

« back to all changes in this revision

Viewing changes to net/netlink/af_netlink.c

  • Committer: Package Import Robot
  • Author(s): Yves-Alexis Perez
  • Date: 2016-12-20 16:13:41 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20161220161341-sec3a0j4hvey3kr7
Tags: 4.8.15-1+grsec201612151923+1
* Merge changes from src:linux up to 4.8.15-1.
  - include the flex change, fixing FTBFS.                    closes: #848803
* Update grsecurity to 3.1-4.8.15-201612151923.
* debian/patches:
  - bugfix/all/net-handle-no-dst-on-skb-in-icmp6_send.patch disabled,
    already included in grsecurity.
* set CONFIG_LEGACY_VSYSCALL_NONE following src:linux.

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
        if (nlk->cb_running) {
330
330
                if (nlk->cb.done)
331
331
                        nlk->cb.done(&nlk->cb);
332
 
 
333
332
                module_put(nlk->cb.module);
334
333
                kfree_skb(nlk->cb.skb);
335
334
        }
346
345
        WARN_ON(nlk_sk(sk)->groups);
347
346
}
348
347
 
 
348
static void netlink_sock_destruct_work(struct work_struct *work)
 
349
{
 
350
        struct netlink_sock *nlk = container_of(work, struct netlink_sock,
 
351
                                                work);
 
352
 
 
353
        sk_free(&nlk->sk);
 
354
}
 
355
 
349
356
/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
350
357
 * SMP. Look, when several writers sleep and reader wakes them up, all but one
351
358
 * immediately hit write lock and grab all the cpus. Exclusive sleep solves
648
655
static void deferred_put_nlk_sk(struct rcu_head *head)
649
656
{
650
657
        struct netlink_sock *nlk = container_of(head, struct netlink_sock, rcu);
651
 
 
652
 
        sock_put(&nlk->sk);
 
658
        struct sock *sk = &nlk->sk;
 
659
 
 
660
        if (!atomic_dec_and_test(&sk->sk_refcnt))
 
661
                return;
 
662
 
 
663
        if (nlk->cb_running && nlk->cb.done) {
 
664
                INIT_WORK(&nlk->work, netlink_sock_destruct_work);
 
665
                schedule_work(&nlk->work);
 
666
                return;
 
667
        }
 
668
 
 
669
        sk_free(sk);
653
670
}
654
671
 
655
672
static int netlink_release(struct socket *sock)