From 5528f6adce8785e30d03616796d4a6ee87cb5804 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Tue, 21 Oct 2014 14:20:42 -0700 Subject: [PATCH] datapath: net: make skb_gso_segment error handling more robust skb_gso_segment has three possible return values: 1. a pointer to the first segmented skb 2. an errno value (IS_ERR()) 3. NULL. This can happen when GSO is used for header verification. However, several callers currently test IS_ERR instead of IS_ERR_OR_NULL and would oops when NULL is returned. Note that these call sites should never actually see such a NULL return value; all callers mask out the GSO bits in the feature argument. However, there have been issues with some protocol handlers erronously not respecting the specified feature mask in some cases. It is preferable to get 'have to turn off hw offloading, else slow' reports rather than 'kernel crashes'. Signed-off-by: Florian Westphal Signed-off-by: David S. Miller Acked-by: Pravin B Shelar --- datapath/datapath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/datapath/datapath.c b/datapath/datapath.c index b0de67206..6f8015146 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -347,6 +347,8 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, *OVS_CB(skb) = ovs_cb; if (IS_ERR(segs)) return PTR_ERR(segs); + if (segs == NULL) + return -EINVAL; /* Queue all of the segments. */ skb = segs; -- 2.20.1