netfilter: nfnetlink: convert kfree_skb to consume_skb
Subsystems (3)
PATCH 1/1 netfilter: nfnetlink: convert kfree_skb to consume_skb
Use consume_skb in the batch code path to avoid generating spurious NOT_SPECIFIED skb drop reasons.
--- net/netfilter/nfnetlink.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/netfilter/nfnetlink.c +7 -7
@@ -402,27 +402,27 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, {nfnl_unlock (subsys_id);netlink_ack (oskb, nlh, -EOPNOTSUPP ,NULL ); -return kfree_skb (skb); +return consume_skb (skb); } }if (!ss->valid_genid || !ss->commit || !ss->abort) {nfnl_unlock (subsys_id);netlink_ack (oskb, nlh, -EOPNOTSUPP ,NULL ); -return kfree_skb (skb); +return consume_skb (skb); }if (!try_module_get (ss->owner)) {nfnl_unlock (subsys_id);netlink_ack (oskb, nlh, -EOPNOTSUPP ,NULL ); -return kfree_skb (skb); +return consume_skb (skb); }if (!ss->valid_genid (net, genid)) {module_put (ss->owner);nfnl_unlock (subsys_id);netlink_ack (oskb, nlh, -ERESTART ,NULL ); -return kfree_skb (skb); +return consume_skb (skb); }nfnl_unlock (subsys_id);
@@ -565,7 +565,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,if (status &NFNL_BATCH_REPLAY ) { ss->abort (net, oskb,NFNL_ABORT_AUTOLOAD );nfnl_err_reset (&err_list); -kfree_skb (skb); +consume_skb (skb);module_put (ss->owner); goto replay; }else if (status ==NFNL_BATCH_DONE ) {
@@ -590,7 +590,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, err = ss->abort (net, oskb, abort_action);if (err == -EAGAIN ) {nfnl_err_reset (&err_list); -kfree_skb (skb); +consume_skb (skb);module_put (ss->owner); status |=NFNL_BATCH_FAILURE ; goto replay_abort;
@@ -598,7 +598,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, }nfnl_err_deliver (&err_list, oskb); -kfree_skb (skb); +consume_skb (skb);module_put (ss->owner); }
Signature · 1 line
2.44.0
Simon Horman
reviewerQuoted 4 lines · Donald Hunter
Use
consume_skbin the batch code path to avoid generating spuriousNOT_SPECIFIEDskb drop reasons.Signed-off-by Donald Hunter <[email protected]>
Hi Donald,
I do wonder if this is the correct approach. I'm happy to stand corrected, but my understanding is that consume_skb() is for situations where the skb is no longer needed for reasons other than errors. But some of these call-sites do appear to be error paths of sorts.
...
Quoted 6 lines · Simon Horman
Quoted 4 lines · Donald Hunter
Use
consume_skbin the batch code path to avoid generating spuriousNOT_SPECIFIEDskb drop reasons.Signed-off-by Donald Hunter <[email protected]>
Quoted 8 lines
Hi Donald,
I do wonder if this is the correct approach. I'm happy to stand corrected, but my understanding is that
consume_skb()is for situations where the skb is no longer needed for reasons other than errors. But some of these call-sites do appear to be error paths of sorts....
Hi Simon,
They all look to be application layer errors which are either communicated back to the client or cause a replay. My understanding is that consume_skb() should be used here since kfree_skb() now implies a (transport?) drop.
Simon Horman
reviewerQuoted 15 lines · Donald Hunter
Quoted 13 lines · Simon Horman
Quoted 4 lines · Donald Hunter
Use
consume_skbin the batch code path to avoid generating spuriousNOT_SPECIFIEDskb drop reasons.Signed-off-by Donald Hunter <[email protected]>Hi Donald,
I do wonder if this is the correct approach. I'm happy to stand corrected, but my understanding is that
consume_skb()is for situations where the skb is no longer needed for reasons other than errors. But some of these call-sites do appear to be error paths of sorts.
Quoted 8 lines
Quoted 1 line
...
Hi Simon,
They all look to be application layer errors which are either communicated back to the client or cause a replay. My understanding is that
consume_skb()should be used here sincekfree_skb()now implies a (transport?) drop.
Hi Donald,
Thanks, that makes sense to me.