lkml.org 
[lkml]   [2012]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 204/241] af-packet: fix oops when socket is not present
    Date
    3.5.7.2 -stable review patch.  If anyone has any objections, please let me know.

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

    From: Eric Leblond <eric@regit.org>

    commit a3d744e995d2b936c500585ae39d99ee251c89b4 upstream.

    Due to a NULL dereference, the following patch is causing oops
    in normal trafic condition:

    commit c0de08d04215031d68fa13af36f347a6cfa252ca
    Author: Eric Leblond <eric@regit.org>
    Date:   Thu Aug 16 22:02:58 2012 +0000

        af_packet: don't emit packet on orig fanout group

    This buggy patch was a feature fix and has reached most stable
    branches.

    When skb->sk is NULL and when packet fanout is used, there is a
    crash in match_fanout_group where skb->sk is accessed.
    This patch fixes the issue by returning false as soon as the
    socket is NULL: this correspond to the wanted behavior because
    the kernel as to resend the skb to all the listening socket in
    this case.

    Signed-off-by: Eric Leblond <eric@regit.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
    ---
    net/core/dev.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/net/core/dev.c b/net/core/dev.c
    index 4ef7993..75845ba 100644
    --- a/net/core/dev.c
    +++ b/net/core/dev.c
    @@ -1642,7 +1642,7 @@ static inline int deliver_skb(struct sk_buff *skb,

    static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb)
    {
    - if (ptype->af_packet_priv == NULL)
    + if (!ptype->af_packet_priv || !skb->sk)
    return false;

    if (ptype->id_match)
    --
    1.7.9.5
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2012-12-13 16:01    [W:3.878 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site