Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98568
b: refs/heads/master
c: 9a37580
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jun 28, 2008
1 parent d344f91 commit f89f1d1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 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: a0a61a604c60c14accc3962ecfeee9acc7a3c08a
refs/heads/master: 9a375803feaadb6c34e0807bd9325885dcca5c00
16 changes: 11 additions & 5 deletions trunk/net/ipv4/inet_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,21 @@ EXPORT_SYMBOL(inet_frag_evictor);

static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
struct inet_frag_queue *qp_in, struct inet_frags *f,
unsigned int hash, void *arg)
void *arg)
{
struct inet_frag_queue *qp;
#ifdef CONFIG_SMP
struct hlist_node *n;
#endif
unsigned int hash;

write_lock(&f->lock);
/*
* While we stayed w/o the lock other CPU could update
* the rnd seed, so we need to re-calculate the hash
* chain. Fortunatelly the qp_in can be used to get one.
*/
hash = f->hashfn(qp_in);
#ifdef CONFIG_SMP
/* With SMP race we have to recheck hash table, because
* such entry could be created on other cpu, while we
Expand Down Expand Up @@ -247,15 +254,15 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf,
}

static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,
struct inet_frags *f, void *arg, unsigned int hash)
struct inet_frags *f, void *arg)
{
struct inet_frag_queue *q;

q = inet_frag_alloc(nf, f, arg);
if (q == NULL)
return NULL;

return inet_frag_intern(nf, q, f, hash, arg);
return inet_frag_intern(nf, q, f, arg);
}

struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
Expand All @@ -264,7 +271,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
struct inet_frag_queue *q;
struct hlist_node *n;

read_lock(&f->lock);
hlist_for_each_entry(q, n, &f->hash[hash], list) {
if (q->net == nf && f->match(q, key)) {
atomic_inc(&q->refcnt);
Expand All @@ -274,6 +280,6 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
}
read_unlock(&f->lock);

return inet_frag_create(nf, f, key, hash);
return inet_frag_create(nf, f, key);
}
EXPORT_SYMBOL(inet_frag_find);
2 changes: 2 additions & 0 deletions trunk/net/ipv4/ip_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)

arg.iph = iph;
arg.user = user;

read_lock(&ip4_frags.lock);
hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);

q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv6/netfilter/nf_conntrack_reasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
arg.id = id;
arg.src = src;
arg.dst = dst;

read_lock_bh(&nf_frags.lock);
hash = ip6qhashfn(id, src, dst);

local_bh_disable();
q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
local_bh_enable();
if (q == NULL)
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/ipv6/reassembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst,
arg.id = id;
arg.src = src;
arg.dst = dst;

read_lock(&ip6_frags.lock);
hash = ip6qhashfn(id, src, dst);

q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
Expand Down

0 comments on commit f89f1d1

Please sign in to comment.