Commit 0f816232 authored by Duan Jiong's avatar Duan Jiong Committed by Pablo Neira Ayuso

netfilter: nfnetlink: remove redundant variable nskb

Actually after netlink_skb_clone() is called, the nskb and
skb will point to the same thing, but they are used just like
they are different, sometimes this is confusing, so i think
there is no necessary to keep nskb anymore.
Signed-off-by: default avatarDuan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@soleta.eu>
parent 8aefc4d1
...@@ -272,7 +272,7 @@ static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb) ...@@ -272,7 +272,7 @@ static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb)
static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
u_int16_t subsys_id) u_int16_t subsys_id)
{ {
struct sk_buff *nskb, *oskb = skb; struct sk_buff *oskb = skb;
struct net *net = sock_net(skb->sk); struct net *net = sock_net(skb->sk);
const struct nfnetlink_subsystem *ss; const struct nfnetlink_subsystem *ss;
const struct nfnl_callback *nc; const struct nfnl_callback *nc;
...@@ -283,12 +283,11 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -283,12 +283,11 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
if (subsys_id >= NFNL_SUBSYS_COUNT) if (subsys_id >= NFNL_SUBSYS_COUNT)
return netlink_ack(skb, nlh, -EINVAL); return netlink_ack(skb, nlh, -EINVAL);
replay: replay:
nskb = netlink_skb_clone(oskb, GFP_KERNEL); skb = netlink_skb_clone(oskb, GFP_KERNEL);
if (!nskb) if (!skb)
return netlink_ack(oskb, nlh, -ENOMEM); return netlink_ack(oskb, nlh, -ENOMEM);
nskb->sk = oskb->sk; skb->sk = oskb->sk;
skb = nskb;
nfnl_lock(subsys_id); nfnl_lock(subsys_id);
ss = rcu_dereference_protected(table[subsys_id].subsys, ss = rcu_dereference_protected(table[subsys_id].subsys,
...@@ -305,7 +304,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -305,7 +304,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
{ {
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
netlink_ack(skb, nlh, -EOPNOTSUPP); netlink_ack(skb, nlh, -EOPNOTSUPP);
return kfree_skb(nskb); return kfree_skb(skb);
} }
} }
...@@ -385,7 +384,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -385,7 +384,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
nfnl_err_reset(&err_list); nfnl_err_reset(&err_list);
ss->abort(oskb); ss->abort(oskb);
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
kfree_skb(nskb); kfree_skb(skb);
goto replay; goto replay;
} }
} }
...@@ -426,7 +425,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -426,7 +425,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
nfnl_err_deliver(&err_list, oskb); nfnl_err_deliver(&err_list, oskb);
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
kfree_skb(nskb); kfree_skb(skb);
} }
static void nfnetlink_rcv(struct sk_buff *skb) static void nfnetlink_rcv(struct sk_buff *skb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment