From b28c72ba7c992bcd2f5b65be0799a2d9422df21f Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Thu, 17 Jun 2010 15:17:53 -0700 Subject: [PATCH] datapath: Check vswitch_skb_checksum_setup() return code. If vswitch_skb_checksum_setup() returns an error, the checksum pointers probably haven't been set correctly which could cause a crash later. We should give up immediately on error. --- datapath/actions.c | 8 +++++++- datapath/vport-gre.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/datapath/actions.c b/datapath/actions.c index ff67372a..f7e51d92 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -113,6 +113,8 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, ~skb->csum); } } else { + int err; + /* Add vlan header */ /* Set up checksumming pointers for checksum-deferred packets @@ -120,7 +122,11 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, * when we send the packet out on the wire, and it will fail at * that point because skb_checksum_setup() will not look inside * an 802.1Q header. */ - vswitch_skb_checksum_setup(skb); + err = vswitch_skb_checksum_setup(skb); + if (unlikely(err)) { + kfree_skb(skb); + return ERR_PTR(err); + } /* GSO is not implemented for packets with an 802.1Q header, so * we have to do segmentation before we add that header. diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 98e0abc3..c71cc34d 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -1131,7 +1131,9 @@ gre_send(struct vport *vport, struct sk_buff *skb) } forward_ip_summed(skb); - vswitch_skb_checksum_setup(skb); + + if (unlikely(vswitch_skb_checksum_setup(skb))) + goto error_free; skb = handle_gso(skb); if (unlikely(IS_ERR(skb))) { -- 2.30.2