Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213893
b: refs/heads/master
c: 49e8ab0
h: refs/heads/master
i:
  213891: e376a22
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Aug 20, 2010
1 parent f6283ad commit 65b2a02
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4da79504b2b41410dd56e9268c9ad403aa65e89c
refs/heads/master: 49e8ab03ebcacd8e37660ffec20c0c46721a2800
8 changes: 3 additions & 5 deletions trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,16 @@ EXPORT_SYMBOL(inet_ehash_secret);

/*
* inet_ehash_secret must be set exactly once
* Instead of using a dedicated spinlock, we (ab)use inetsw_lock
*/
void build_ehash_secret(void)
{
u32 rnd;

do {
get_random_bytes(&rnd, sizeof(rnd));
} while (rnd == 0);
spin_lock_bh(&inetsw_lock);
if (!inet_ehash_secret)
inet_ehash_secret = rnd;
spin_unlock_bh(&inetsw_lock);

cmpxchg(&inet_ehash_secret, 0, rnd);
}
EXPORT_SYMBOL(build_ehash_secret);

Expand Down
9 changes: 1 addition & 8 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,18 +1268,11 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt,

void rt_bind_peer(struct rtable *rt, int create)
{
static DEFINE_SPINLOCK(rt_peer_lock);
struct inet_peer *peer;

peer = inet_getpeer(rt->rt_dst, create);

spin_lock_bh(&rt_peer_lock);
if (rt->peer == NULL) {
rt->peer = peer;
peer = NULL;
}
spin_unlock_bh(&rt_peer_lock);
if (peer)
if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL)
inet_putpeer(peer);
}

Expand Down

0 comments on commit 65b2a02

Please sign in to comment.