lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1424713924-6821-3-git-send-email-eyal.birger@gmail.com>
Date:	Mon, 23 Feb 2015 19:52:02 +0200
From:	Eyal Birger <eyal.birger@...il.com>
To:	davem@...emloft.net
Cc:	edumazet@...gle.com, shmulik.ladkani@...il.com,
	netdev@...r.kernel.org, Eyal Birger <eyal.birger@...il.com>
Subject: [PATCH net-next v3 2/4] ipv4,v6: avoid setting skb->priority when skb->reserved_tailroom is in use in igmpv3/mld

IGMPv3/MLD packets are sent with TC_PRIO_CONTROL.
skb->priority is set immediately after skb allocation.

skb->reserved_tailroom is also set after allocation and is
used by the IGMPv3/MLD code prior to transmittion.

In order to be able to alias skb->priority and
skb->reserved_tailroom in struct sk_buff, the two fields
must not be used at the same time.

The skb->priority value is not required before the packet
is sent down the IP stack. Therefore, move setting
skb->priority prior to transmittion.

Signed-off-by: Eyal Birger <eyal.birger@...il.com>
---
 net/ipv4/igmp.c  | 3 ++-
 net/ipv6/mcast.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 4b1172d..f28dc9c 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -339,7 +339,6 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu)
 		if (size < 256)
 			return NULL;
 	}
-	skb->priority = TC_PRIO_CONTROL;
 
 	rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0,
 				   0, 0,
@@ -391,6 +390,8 @@ static int igmpv3_sendpack(struct sk_buff *skb)
 	struct igmphdr *pig = igmp_hdr(skb);
 	const int igmplen = skb_tail_pointer(skb) - skb_transport_header(skb);
 
+	skb->priority = TC_PRIO_CONTROL;
+
 	pig->csum = ip_compute_csum(igmp_hdr(skb), igmplen);
 
 	return ip_local_out(skb);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 5ce107c..67e6c0a 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1575,7 +1575,6 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)
 	if (!skb)
 		return NULL;
 
-	skb->priority = TC_PRIO_CONTROL;
 	skb->reserved_tailroom = skb_end_offset(skb) -
 				 min(mtu, skb_end_offset(skb));
 	skb_reserve(skb, hlen);
@@ -1616,6 +1615,8 @@ static void mld_sendpack(struct sk_buff *skb)
 	struct flowi6 fl6;
 	struct dst_entry *dst;
 
+	skb->priority = TC_PRIO_CONTROL;
+
 	rcu_read_lock();
 	idev = __in6_dev_get(skb->dev);
 	IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ