netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net:openvswitch: check return value of pskb_trim()
@ 2023-07-17 14:50 Yuanjun Gong
  2023-07-17 15:53 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuanjun Gong @ 2023-07-17 14:50 UTC (permalink / raw)
  To: Yuanjun Gong, Pravin B Shelar, David S . Miller, Eric Dumazet,
	netdev

do kfree_skb() if an unexpected result is returned by pskb_tirm()
in do_output().

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 net/openvswitch/actions.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index cab1e02b63e0..6b3456bdff1c 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -920,9 +920,11 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
 
 		if (unlikely(cutlen > 0)) {
 			if (skb->len - cutlen > ovs_mac_header_len(key))
-				pskb_trim(skb, skb->len - cutlen);
+				if (pskb_trim(skb, skb->len - cutlen))
+					kfree_skb(skb);
 			else
-				pskb_trim(skb, ovs_mac_header_len(key));
+				if (pskb_trim(skb, ovs_mac_header_len(key)))
+					kfree_skb(skb);
 		}
 
 		if (likely(!mru ||
-- 
2.17.1


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

end of thread, other threads:[~2023-07-19  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 14:50 [PATCH 1/1] net:openvswitch: check return value of pskb_trim() Yuanjun Gong
2023-07-17 15:53 ` Eric Dumazet
2023-07-18 15:28 ` kernel test robot
2023-07-19  0:48 ` kernel test robot

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).