lkml.org 
[lkml]   [2013]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 27/45] vlan: fix a race in egress prio management
    Date
    3.0-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Eric Dumazet <edumazet@google.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@google.com>
    Cc: Patrick McHardy <kaber@trash.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    net/8021q/vlan_dev.c | 7 +++++++
    1 file changed, 7 insertions(+)

    --- a/net/8021q/vlan_dev.c
    +++ b/net/8021q/vlan_dev.c
    @@ -70,6 +70,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_info(dev)->egress_priority_map[(skb->priority & 0xF)];
    while (mp) {
    if (mp->priority == skb->priority) {
    @@ -230,6 +232,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++;



    \
     
     \ /
      Last update: 2013-07-26 23:21    [W:4.092 / U:0.132 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site