Unverified Commit 24d3440b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6895 tun: limit printing rate when illegal packet received by tun dev

parents a817551c 2f9bcb58
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -2140,14 +2140,16 @@ static ssize_t tun_put_user(struct tun_struct *tun,
					    tun_is_little_endian(tun), true,
					    vlan_hlen)) {
			struct skb_shared_info *sinfo = skb_shinfo(skb);
			pr_err("unexpected GSO type: "
			       "0x%x, gso_size %d, hdr_len %d\n",

			if (net_ratelimit()) {
				netdev_err(tun->dev, "unexpected GSO type: 0x%x, gso_size %d, hdr_len %d\n",
					   sinfo->gso_type, tun16_to_cpu(tun, gso.gso_size),
					   tun16_to_cpu(tun, gso.hdr_len));
				print_hex_dump(KERN_ERR, "tun: ",
					       DUMP_PREFIX_NONE,
					       16, 1, skb->head,
					       min((int)tun16_to_cpu(tun, gso.hdr_len), 64), true);
			}
			WARN_ON_ONCE(1);
			return -EINVAL;
		}