Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

2 messages, 2 authors, 2020-08-17 · open the first message on its own page

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

From: linmiaohe <linmiaohe@huawei.com>
Date: 2020-08-17 02:27:28

David Miller [off-list ref] wrote:
quoted
+	/* split line is in frag list */
+	if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) {
+		/* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */
+		if (skb_has_frag_list(skb))
+			kfree_skb_list(skb_shinfo(skb)->frag_list);
+		kfree(data);
+		return -ENOMEM;
On error, the caller is going to kfree_skb(skb) which will take care of the frag list.
I'am sorry for my careless. The caller will take care of the frag list and kfree(data) is enough here.
Many thanks for review, will send v2 soon.

Re: [PATCH] net: handle the return value of pskb_carve_frag_list() correctly

From: David Miller <davem@davemloft.net>
Date: 2020-08-17 04:01:10

From: linmiaohe <linmiaohe@huawei.com>
Date: Mon, 17 Aug 2020 02:27:23 +0000
David Miller [off-list ref] wrote:
quoted
quoted
+	/* split line is in frag list */
+	if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) {
+		/* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */
+		if (skb_has_frag_list(skb))
+			kfree_skb_list(skb_shinfo(skb)->frag_list);
+		kfree(data);
+		return -ENOMEM;
On error, the caller is going to kfree_skb(skb) which will take care of the frag list.
I'am sorry for my careless. The caller will take care of the frag list and kfree(data) is enough here.
Many thanks for review, will send v2 soon.
Actually, reading this again, what about the skb_clone_fraglist() done a few
lines up?  Who will release that reference to the fraglist items?

Maybe the kfree_skb_list() is necessary after all?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help