[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151011090544-mutt-send-email-mst@redhat.com>
Date: Sun, 11 Oct 2015 09:06:03 +0300
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net-next] tun: use sk_fullsock() before reading
sk->sk_tsflags
On Fri, Oct 09, 2015 at 03:42:21PM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> timewait or request sockets are small and do not contain sk->sk_tsflags
>
> Without this fix, we might read garbage, and crash later in
>
> __skb_complete_tx_timestamp()
> -> sock_queue_err_skb()
>
> (These pseudo sockets do not have an error queue either)
>
> Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Willem de Bruijn <willemb@...gle.com>
Acked-by: Michael S. Tsirkin <mst@...hat.com>
> ---
> Note this bug also exists on net tree for timewait sockets but only
> in exceptional conditions (routing glitches and IP early demux)
>
> drivers/net/tun.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 976aa9704297..b1878faea397 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -858,7 +858,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
> if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
> goto drop;
>
> - if (skb->sk) {
> + if (skb->sk && sk_fullsock(skb->sk)) {
> sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags);
> sw_tx_timestamp(skb);
> }
>
>
> --
> 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
--
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