lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1435150000.4110.7.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Wed, 24 Jun 2015 14:46:40 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	ratheesh kannoth <ratheesh.ksz@...il.com>
Cc:	netdev <netdev@...r.kernel.org>,
	linux-newbie <linux-newbie@...r.kernel.org>
Subject: Re: sock_hold and sock_put

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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ