• Johannes Berg's avatar
    netlink: fix compat recvmsg · 68d6ac6d
    Johannes Berg authored
    Since
    commit 1dacc76d
    Author: Johannes Berg <johannes@sipsolutions.net>
    Date:   Wed Jul 1 11:26:02 2009 +0000
    
        net/compat/wext: send different messages to compat tasks
    
    we had a race condition when setting and then
    restoring frag_list. Eric attempted to fix it,
    but the fix created even worse problems.
    
    However, the original motivation I had when I
    added the code that turned out to be racy is
    no longer clear to me, since we only copy up
    to skb->len to userspace, which doesn't include
    the frag_list length. As a result, not doing
    any frag_list clearing and restoring avoids
    the race condition, while not introducing any
    other problems.
    
    Additionally, while preparing this patch I found
    that since none of the remaining netlink code is
    really aware of the frag_list, we need to use the
    original skb's information for packet information
    and credentials. This fixes, for example, the
    group information received by compat tasks.
    
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Cc: stable@kernel.org [2.6.31+, for 2.6.35 revert 1235f504]
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    68d6ac6d
af_netlink.c 48.2 KB