sock_hold and sock_put
ratheesh kannoth <[email protected]> Wed, 24 Jun 2015 14:47:35 +0530
| Newsgroups | org.kernel.vger.linux-newbie,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAGZFCEHHXbnsSoBaTUdxqwoQ75hN5BTBXJMEXp0dkwQbFSEkRw@mail.gmail.com> |
Hi list, There is a comment on sock_hold() function - 561 /* Grab socket reference count. This operation is valid only 562 when sk is ALREADY grabbed f.e. it is found in hash table 563 or a list and the lookup is made under lock preventing hash table 564 modifications. 565 */ But i could see instances of sock hold() in kernel without any locks. How the race between sock_hold() and sock_put() is prevented in smp ? note: I would like to use sock_hold() and sock_put() in netdev_notifier chain call back functions. -Ratheesh