Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Nikolay Aleksandrov <razor@blackwall.org>, netdev@vger.kernel.org
Cc: Martynas Pumputis <m@lambda.lt>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	 wireguard@lists.zx2c4.com, kuba@kernel.org, davem@davemloft.net,
	stable@vger.kernel.org
Subject: Re: [PATCH net 1/2] wireguard: device: fix metadata_dst xmit null pointer dereference
Date: Thu, 14 Apr 2022 13:28:18 +0200	[thread overview]
Message-ID: <24cac92b-4981-4ddc-9a05-32b61799e688@iogearbox.net> (raw)
In-Reply-To: <20220414104458.3097244-2-razor@blackwall.org>

On 4/14/22 12:44 PM, Nikolay Aleksandrov wrote:
> When we try to transmit an skb with md_dst attached through wireguard
> we hit a null pointer dereference[1] in wg_xmit() due to the use of
> dst_mtu() which calls into dst_blackhole_mtu() which in turn tries to
> dereference dst->dev. Since wireguard doesn't use md_dsts we should use
> skb_valid_dst() which checks for DST_METADATA flag and if it's set then
> fallback to wireguard's device mtu. That gives us the best chance of
> transmitting the packet, otherwise if the blackhole netdev is used we'd
> get ETH_MIN_MTU.
> 
[...]
> 
> CC: stable@vger.kernel.org
> CC: wireguard@lists.zx2c4.com
> CC: Jason A. Donenfeld <Jason@zx2c4.com>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> CC: Martynas Pumputis <m@lambda.lt>
> Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
> Reported-by: Martynas Pumputis <m@lambda.lt>
> Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>

Looks good to me, thanks Nik!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

  reply	other threads:[~2022-04-22  0:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 10:44 [PATCH net 0/2] " Nikolay Aleksandrov
2022-04-14 10:44 ` [PATCH net 1/2] " Nikolay Aleksandrov
2022-04-14 11:28   ` Daniel Borkmann [this message]
2022-04-14 11:58   ` Jason A. Donenfeld
2022-04-14 10:44 ` [PATCH net 2/2] wireguard: selftests: add metadata_dst xmit selftest Nikolay Aleksandrov
2022-04-14 12:06   ` Jason A. Donenfeld
2022-04-14 12:12     ` Nikolay Aleksandrov
2022-04-14 12:24       ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24cac92b-4981-4ddc-9a05-32b61799e688@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=m@lambda.lt \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=stable@vger.kernel.org \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).