Skip to content

Commit

Permalink
datapath: net: make skb_gso_segment error handling more robust
Browse files Browse the repository at this point in the history
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 <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
  • Loading branch information
Pravin B Shelar committed Oct 21, 2014
1 parent 15fd905 commit d1da766
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions datapath/datapath.c
Expand Up @@ -346,6 +346,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;

if (gso_type & SKB_GSO_UDP) {
/* The initial flow key extracted by ovs_flow_key_extract()
Expand Down

0 comments on commit d1da766

Please sign in to comment.