[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1374944157.13555.43.camel@deadeye.wl.decadent.org.uk>
Date: Sat, 27 Jul 2013 17:55:57 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Eric Dumazet <edumazet@...gle.com>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Patrick McHardy <kaber@...sh.net>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [ 42/79] vlan: fix a race in egress prio management
On Fri, 2013-07-26 at 13:47 -0700, Greg Kroah-Hartman wrote:
> 3.10-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Eric Dumazet <edumazet@...gle.com>
>
> [ Upstream commit 3e3aac497513c669e1c62c71e1d552ea85c1d974 ]
>
> egress_priority_map[] hash table updates are protected by rtnl,
> and we never remove elements until device is dismantled.
>
> We have to make sure that before inserting an new element in hash table,
> all its fields are committed to memory or else another cpu could
> find corrupt values and crash.
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Patrick McHardy <kaber@...sh.net>
> Signed-off-by: David S. Miller <davem@...emloft.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> net/8021q/vlan_dev.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -73,6 +73,8 @@ vlan_dev_get_egress_qos_mask(struct net_
> {
> struct vlan_priority_tci_mapping *mp;
>
> + smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */
> +
> mp = vlan_dev_priv(dev)->egress_priority_map[(skb->priority & 0xF)];
This barrier is the wrong type in the wrong place; there should be a
smp_read_barrier_depends() *after* reading the pointer from
egress_priority_map, and after reading each next pointer.
(In practice, I think this error is harmless except on Alpha. So the
patch is worth applying anyway.)
Ben.
> while (mp) {
> if (mp->priority == skb->priority) {
> @@ -249,6 +251,11 @@ int vlan_dev_set_egress_priority(const s
> np->next = mp;
> np->priority = skb_prio;
> np->vlan_qos = vlan_qos;
> + /* Before inserting this element in hash table, make sure all its fields
> + * are committed to memory.
> + * coupled with smp_rmb() in vlan_dev_get_egress_qos_mask()
> + */
> + smp_wmb();
> vlan->egress_priority_map[skb_prio & 0xF] = np;
> if (vlan_qos)
> vlan->nr_egress_mappings++;
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists