Re: sock_hold and sock_put

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2015-06-24 at 14:47 +0530, ratheesh kannoth wrote:
> 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.

You misunderstood the comment.

Comment only stated that sock_hold() must be used in contexts where
caller owns a reference (and will eventually release it later with
sock_put().

There is nothing about having a lock here.


--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs



[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux