From: Cong Wang <xiyou.wangcong@gmail.com>
To: Taehee Yoo <ap420073@gmail.com>
Cc: David Miller <davem@davemloft.net>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
treeze.taeung@gmail.com
Subject: Re: [net PATCH] hsr: fix a NULL pointer dereference in hsr_dev_xmit()
Date: Sat, 30 Nov 2019 10:35:58 -0800 [thread overview]
Message-ID: <CAM_iQpWmwreeCuOVnTTucHcXkmLP-QRtzW22_g6QWM2-QoS5WA@mail.gmail.com> (raw)
In-Reply-To: <20191130142400.3930-1-ap420073@gmail.com>
On Sat, Nov 30, 2019 at 6:24 AM Taehee Yoo <ap420073@gmail.com> wrote:
>
> hsr_dev_xmit() calls hsr_port_get_hsr() to find master node and that would
> return NULL if master node is not existing in the list.
> But hsr_dev_xmit() doesn't check return pointer so a NULL dereference
> could occur.
If you look at the git history, I made a same patch but reverted it later. :)
>
> In the TX datapath, there is no rcu_read_lock() so this patch adds missing
> rcu_read_lock() in the hsr_dev_xmit() too.
This is wrong.
>
> Test commands:
> ip netns add nst
> ip link add v0 type veth peer name v1
> ip link add v2 type veth peer name v3
> ip link set v1 netns nst
> ip link set v3 netns nst
> ip link add hsr0 type hsr slave1 v0 slave2 v2
> ip a a 192.168.100.1/24 dev hsr0
> ip link set v0 up
> ip link set v2 up
> ip link set hsr0 up
> ip netns exec nst ip link add hsr1 type hsr slave1 v1 slave2 v3
> ip netns exec nst ip a a 192.168.100.2/24 dev hsr1
> ip netns exec nst ip link set v1 up
> ip netns exec nst ip link set v3 up
> ip netns exec nst ip link set hsr1 up
> hping3 192.168.100.2 -2 --flood &
> modprobe -rv hsr
Looks like the master port got deleted without respecting RCU
readers, let me look into it.
Thanks!
next prev parent reply other threads:[~2019-11-30 18:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-30 14:24 [net PATCH] hsr: fix a NULL pointer dereference in hsr_dev_xmit() Taehee Yoo
2019-11-30 18:34 ` David Miller
2019-12-01 15:52 ` Taehee Yoo
2019-11-30 18:35 ` Cong Wang [this message]
2019-11-30 21:04 ` Cong Wang
2019-12-01 16:08 ` Taehee Yoo
2019-12-04 17:24 ` Cong Wang
2019-12-01 16:01 ` Taehee Yoo
2019-12-04 17:29 ` Cong Wang
2019-12-05 7:00 ` Taehee Yoo
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=CAM_iQpWmwreeCuOVnTTucHcXkmLP-QRtzW22_g6QWM2-QoS5WA@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=treeze.taeung@gmail.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).