Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122181
b: refs/heads/master
c: 673c09b
h: refs/heads/master
i:
  122179: 69b7a0b
v: v3
  • Loading branch information
Alexey Dobriyan authored and David S. Miller committed Nov 26, 2008
1 parent 988bef2 commit 6e1fb80
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 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: d62ddc21b674b5ac1466091ff3fbf7baa53bc92c
refs/heads/master: 673c09be457bb23aa0eaaa79804cbb342210d195
10 changes: 9 additions & 1 deletion trunk/include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ struct xfrm_state_walk {
/* Full description of state of transformer. */
struct xfrm_state
{
#ifdef CONFIG_NET_NS
struct net *xs_net;
#endif
union {
struct hlist_node gclist;
struct hlist_node bydst;
Expand Down Expand Up @@ -223,6 +226,11 @@ struct xfrm_state
void *data;
};

static inline struct net *xs_net(struct xfrm_state *x)
{
return read_pnet(&x->xs_net);
}

/* xflags - make enum if more show up */
#define XFRM_TIME_DEFER 1

Expand Down Expand Up @@ -1296,7 +1304,7 @@ extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
extern int xfrm_state_walk(struct xfrm_state_walk *walk,
int (*func)(struct xfrm_state *, int, void*), void *);
extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
extern struct xfrm_state *xfrm_state_alloc(void);
extern struct xfrm_state *xfrm_state_alloc(struct net *net);
extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
struct flowi *fl, struct xfrm_tmpl *tmpl,
struct xfrm_policy *pol, int *err,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/ipcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
{
struct xfrm_state *t;

t = xfrm_state_alloc();
t = xfrm_state_alloc(&init_net);
if (t == NULL)
goto out;

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv6/ipcomp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static struct xfrm_state *ipcomp6_tunnel_create(struct xfrm_state *x)
{
struct xfrm_state *t = NULL;

t = xfrm_state_alloc();
t = xfrm_state_alloc(&init_net);
if (!t)
goto out;

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
(key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t)))
return ERR_PTR(-EINVAL);

x = xfrm_state_alloc();
x = xfrm_state_alloc(&init_net);
if (x == NULL)
return ERR_PTR(-ENOBUFS);

Expand Down
9 changes: 5 additions & 4 deletions trunk/net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,14 @@ static void xfrm_timer_handler(unsigned long data)

static void xfrm_replay_timer_handler(unsigned long data);

struct xfrm_state *xfrm_state_alloc(void)
struct xfrm_state *xfrm_state_alloc(struct net *net)
{
struct xfrm_state *x;

x = kzalloc(sizeof(struct xfrm_state), GFP_ATOMIC);

if (x) {
write_pnet(&x->xs_net, net);
atomic_set(&x->refcnt, 1);
atomic_set(&x->tunnel_users, 0);
INIT_LIST_HEAD(&x->km.all);
Expand Down Expand Up @@ -835,7 +836,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
error = -EEXIST;
goto out;
}
x = xfrm_state_alloc();
x = xfrm_state_alloc(&init_net);
if (x == NULL) {
error = -ENOMEM;
goto out;
Expand Down Expand Up @@ -1017,7 +1018,7 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
if (!create)
return NULL;

x = xfrm_state_alloc();
x = xfrm_state_alloc(&init_net);
if (likely(x)) {
switch (family) {
case AF_INET:
Expand Down Expand Up @@ -1125,7 +1126,7 @@ EXPORT_SYMBOL(xfrm_state_add);
static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, int *errp)
{
int err = -ENOMEM;
struct xfrm_state *x = xfrm_state_alloc();
struct xfrm_state *x = xfrm_state_alloc(&init_net);
if (!x)
goto error;

Expand Down
4 changes: 2 additions & 2 deletions trunk/net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
struct nlattr **attrs,
int *errp)
{
struct xfrm_state *x = xfrm_state_alloc();
struct xfrm_state *x = xfrm_state_alloc(&init_net);
int err = -ENOMEM;

if (!x)
Expand Down Expand Up @@ -1663,7 +1663,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
struct nlattr *rt = attrs[XFRMA_TMPL];

struct xfrm_user_acquire *ua = nlmsg_data(nlh);
struct xfrm_state *x = xfrm_state_alloc();
struct xfrm_state *x = xfrm_state_alloc(&init_net);
int err = -ENOMEM;

if (!x)
Expand Down

0 comments on commit 6e1fb80

Please sign in to comment.