From: Jaroslav Kysela <perex@suse.cz>
Subject: LTC23987-iptables LOG output shows too long MAC info
References: 176921
Patch-mainline: not yet

LTC23987-iptables LOG output shows too long MAC info for qeth VLAN interface

Signed-off-by: Jaroslav Kysela <perex@suse.cz>

---
 net/ipv4/netfilter/ipt_LOG.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -409,12 +409,12 @@ ipt_log_packet(u_int8_t pf,
 		printk("MAC=");
 		if (skb->dev && skb->dev->hard_header_len &&
 		    skb->mac_header != skb->network_header) {
-			int i;
+			int i, len;
 			const unsigned char *p = skb_mac_header(skb);
-			for (i = 0; i < skb->dev->hard_header_len; i++,p++)
-				printk("%02x%c", *p,
-				       i==skb->dev->hard_header_len - 1
-				       ? ' ':':');
+			len = (int)(skb_network_header(skb) - p);
+			len = min((int)skb->dev->hard_header_len, len);
+			for (i = 0; i < len; i++,p++)
+				printk("%02x%c", *p, i==len - 1 ? ' ':':');
 		} else
 			printk(" ");
 	}
