netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 1/1] net/tls: Replace kfree_skb() with consume_skb()
@ 2019-03-21 11:59 Vakul Garg
  2019-03-21 17:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vakul Garg @ 2019-03-21 11:59 UTC (permalink / raw)
  To: netdev; +Cc: borisp, aviadye, davejwatson, davem, doronrk, Vakul Garg

To free the skb in normal course of processing, consume_skb() should be
used. Only for failure paths, skb_free() is intended to be used.

https://www.kernel.org/doc/htmldocs/networking/API-consume-skb.html

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
v1 -> v2:
Reverted consume_skb() to kfree_skb() in tls_sw_release_resources_rx()

 net/tls/tls_sw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 425351ac2a9b..fa502f171bc1 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -225,7 +225,7 @@ static int tls_do_decryption(struct sock *sk,
 		/* Using skb->sk to push sk through to crypto async callback
 		 * handler. This allows propagating errors up to the socket
 		 * if needed. It _must_ be cleared in the async handler
-		 * before kfree_skb is called. We _know_ skb->sk is NULL
+		 * before consume_skb is called. We _know_ skb->sk is NULL
 		 * because it is a clone from strparser.
 		 */
 		skb->sk = sk;
@@ -1522,7 +1522,7 @@ static bool tls_sw_advance_skb(struct sock *sk, struct sk_buff *skb,
 			rxm->full_len -= len;
 			return false;
 		}
-		kfree_skb(skb);
+		consume_skb(skb);
 	}
 
 	/* Finished with message */
@@ -1631,7 +1631,7 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,
 
 		if (!is_peek) {
 			skb_unlink(skb, &ctx->rx_list);
-			kfree_skb(skb);
+			consume_skb(skb);
 		}
 
 		skb = next_skb;
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2 1/1] net/tls: Replace kfree_skb() with consume_skb()
  2019-03-21 11:59 [PATCH net-next v2 1/1] net/tls: Replace kfree_skb() with consume_skb() Vakul Garg
@ 2019-03-21 17:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-21 17:14 UTC (permalink / raw)
  To: vakul.garg; +Cc: netdev, borisp, aviadye, davejwatson, doronrk

From: Vakul Garg <vakul.garg@nxp.com>
Date: Thu, 21 Mar 2019 11:59:57 +0000

> To free the skb in normal course of processing, consume_skb() should be
> used. Only for failure paths, skb_free() is intended to be used.
> 
> https://www.kernel.org/doc/htmldocs/networking/API-consume-skb.html
> 
> Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
> ---
> v1 -> v2:
> Reverted consume_skb() to kfree_skb() in tls_sw_release_resources_rx()

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-21 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 11:59 [PATCH net-next v2 1/1] net/tls: Replace kfree_skb() with consume_skb() Vakul Garg
2019-03-21 17:14 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).