Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98367
b: refs/heads/master
c: b9f75f4
h: refs/heads/master
i:
  98365: f79468a
  98363: 9c5454a
  98359: 141e148
  98351: a1cfff8
  98335: 741e0d1
  98303: 8d3fd52
v: v3
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Jun 21, 2008
1 parent dc5e833 commit 02581e5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 735ce972fbc8a65fb17788debd7bbe7b4383cc62
refs/heads/master: b9f75f45a6b46a0ab4eb0857d437a0845871f314
11 changes: 11 additions & 0 deletions trunk/include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ extern struct list_head net_namespace_list;
#ifdef CONFIG_NET_NS
extern void __put_net(struct net *net);

static inline int net_alive(struct net *net)
{
return net && atomic_read(&net->count);
}

static inline struct net *get_net(struct net *net)
{
atomic_inc(&net->count);
Expand Down Expand Up @@ -125,6 +130,12 @@ int net_eq(const struct net *net1, const struct net *net2)
return net1 == net2;
}
#else

static inline int net_alive(struct net *net)
{
return 1;
}

static inline struct net *get_net(struct net *net)
{
return net;
Expand Down
4 changes: 4 additions & 0 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,10 @@ int netif_receive_skb(struct sk_buff *skb)

rcu_read_lock();

/* Don't receive packets in an exiting network namespace */
if (!net_alive(dev_net(skb->dev)))
goto out;

#ifdef CONFIG_NET_CLS_ACT
if (skb->tc_verd & TC_NCLS) {
skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
Expand Down
3 changes: 3 additions & 0 deletions trunk/net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ static void cleanup_net(struct work_struct *work)
struct pernet_operations *ops;
struct net *net;

/* Be very certain incoming network packets will not find us */
rcu_barrier();

net = container_of(work, struct net, work);

mutex_lock(&net_mutex);
Expand Down

0 comments on commit 02581e5

Please sign in to comment.