From: Andy Zhou Date: Thu, 17 Jul 2014 22:17:54 +0000 (-0700) Subject: openvswitch: Add skb_clone NULL check for the sampling action. X-Git-Tag: firefly_0821_release~176^2~3474^2~91^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d9e0ecb81417c34ef8c02a6880d23c362300cda0;p=firefly-linux-kernel-4.4.55.git openvswitch: Add skb_clone NULL check for the sampling action. Fix a bug where skb_clone() NULL check is missing in sample action implementation. Signed-off-by: Andy Zhou Signed-off-by: Pravin B Shelar --- diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 794a96f6b8d9..fe5cda0deb39 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -477,6 +477,8 @@ static int sample(struct datapath *dp, struct sk_buff *skb, skb_get(skb); } else { sample_skb = skb_clone(skb, GFP_ATOMIC); + if (!sample_skb) /* Skip sample action when out of memory. */ + return 0; } /* Note that do_execute_actions() never consumes skb.