[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200330082929.GG13121@gauss3.secunet.de>
Date: Mon, 30 Mar 2020 10:29:29 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Xin Long <lucien.xin@...il.com>
CC: network dev <netdev@...r.kernel.org>, <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Florian Westphal <fw@...len.de>
Subject: Re: [PATCH net] udp: fix a skb extensions leak
On Thu, Mar 26, 2020 at 05:06:25PM +0800, Xin Long wrote:
> On udp rx path udp_rcv_segment() may do segment where the frag skbs
> will get the header copied from the head skb in skb_segment_list()
> by calling __copy_skb_header(), which could overwrite the frag skbs'
> extensions by __skb_ext_copy() and cause a leak.
>
> This issue was found after loading esp_offload where a sec path ext
> is set in the skb.
>
> On udp tx gso path, it works well as the frag skbs' extensions are
> not set. So this issue should be fixed on udp's rx path only and
> release the frag skbs' extensions before going to do segment.
Are you sure that this affects only the RX path? What if such
a packet is forwarded? Also, I think TCP has the same problem.
>
> Reported-by: Xiumei Mu <xmu@...hat.com>
> Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
> Signed-off-by: Xin Long <lucien.xin@...il.com>
> ---
> include/net/udp.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/net/udp.h b/include/net/udp.h
> index e55d5f7..7bf0ca5 100644
> --- a/include/net/udp.h
> +++ b/include/net/udp.h
> @@ -486,6 +486,10 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
> if (skb->pkt_type == PACKET_LOOPBACK)
> skb->ip_summed = CHECKSUM_PARTIAL;
>
> + if (skb_has_frag_list(skb) && skb_has_extensions(skb))
> + skb_walk_frags(skb, segs)
> + skb_ext_put(segs);
If a skb in the fraglist has a secpath, it is still valid.
So maybe instead of dropping it here and assign the one
from the head skb, we could just keep the secpath. But
I don't know about other extensions. I've CCed Florian,
he might know a bit more about other extensions. Also,
it might be good to check if the extensions of the GRO
packets are all the same before merging.
Powered by blists - more mailing lists