Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 210946e5 authored by Yunsheng Lin's avatar Yunsheng Lin Committed by Greg Kroah-Hartman
Browse files

net: hns3: check the return of skb_checksum_help()



commit 9bb5a495424fd4bfa672eb1f31481248562fa156 upstream.

Currently skb_checksum_help()'s return is ignored, but it may
return error when it fails to allocate memory when linearizing.

So adds checking for the return of skb_checksum_help().

Fixes: 76ad4f0e("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Fixes: 3db084d2("net: hns3: Fix for vxlan tx checksum bug")
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5c3c0b21
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -702,8 +702,6 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
	if (!(!skb->encapsulation && l4.udp->dest == htons(IANA_VXLAN_PORT)))
	if (!(!skb->encapsulation && l4.udp->dest == htons(IANA_VXLAN_PORT)))
		return false;
		return false;


	skb_checksum_help(skb);

	return true;
	return true;
}
}


@@ -764,8 +762,7 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto,
			/* the stack computes the IP header already,
			/* the stack computes the IP header already,
			 * driver calculate l4 checksum when not TSO.
			 * driver calculate l4 checksum when not TSO.
			 */
			 */
			skb_checksum_help(skb);
			return skb_checksum_help(skb);
			return 0;
		}
		}


		l3.hdr = skb_inner_network_header(skb);
		l3.hdr = skb_inner_network_header(skb);
@@ -796,7 +793,7 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto,
		break;
		break;
	case IPPROTO_UDP:
	case IPPROTO_UDP:
		if (hns3_tunnel_csum_bug(skb))
		if (hns3_tunnel_csum_bug(skb))
			break;
			return skb_checksum_help(skb);


		hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
		hnae3_set_bit(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
		hnae3_set_field(*type_cs_vlan_tso,
		hnae3_set_field(*type_cs_vlan_tso,
@@ -821,8 +818,7 @@ static int hns3_set_l3l4_type_csum(struct sk_buff *skb, u8 ol4_proto,
		/* the stack computes the IP header already,
		/* the stack computes the IP header already,
		 * driver calculate l4 checksum when not TSO.
		 * driver calculate l4 checksum when not TSO.
		 */
		 */
		skb_checksum_help(skb);
		return skb_checksum_help(skb);
		return 0;
	}
	}


	return 0;
	return 0;