From: Hyunwoo Kim <v4bel@theori.io>
To: sam@mendozajonas.com
Cc: davem@davemloft.net, pabeni@redhat.com, kuba@kernel.org,
netdev@vger.kernel.org, imv4bel@gmail.com, v4bel@theori.io
Subject: [report?] A race condition is suspected.
Date: Mon, 3 Jul 2023 23:07:34 -0700 [thread overview]
Message-ID: <20230704060734.GA38702@ubuntu> (raw)
Dear all,
From the code, it looks like a use-after-free due to a race condition
could be caused by the lack of a proper lock between the ncsi_dev_work()
worker and the vlan ioctl:
```
cpu0 cpu1
ncsi_dev_work()
ncsi_configure_channel()
set_one_vid()
rcu_read_lock()
sock_ioctl()
vlan_ioctl_handler()
unregister_vlan_dev()
vlan_vid_del()
__vlan_vid_del()
vlan_kill_rx_filter_info()
ncsi_vlan_rx_kill_vid()
list_del_rcu(&vlan->list);
kfree(vlan);
vid = vlan->vid; // use-after-free?
rcu_read_unlock()
```
However, I do not have a device that uses the ncsi_dev_work() worker,
so I have not been able to debug this.
Can a race condition like this actually happen, and if so, it seems
like we need to change `kfree(vlan);` to `kfree_rcu(vlan)`, or add
an appropriate lock to the worker.
Regards,
Hyunwoo Kim
next reply other threads:[~2023-07-04 6:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 6:07 Hyunwoo Kim [this message]
2023-07-28 8:12 ` [report?] A race condition is suspected Hyunwoo Kim
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=20230704060734.GA38702@ubuntu \
--to=v4bel@theori.io \
--cc=davem@davemloft.net \
--cc=imv4bel@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sam@mendozajonas.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