From: Baokun Li <libaokun1@huawei.com>
To: <richard@nod.at>, <miquel.raynal@bootlin.com>, <vigneshr@ti.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: <patchwork@huawei.com>, <libaokun1@huawei.com>,
<yukuai3@huawei.com>, <chengzhihao1@huawei.com>
Subject: [PATCH -next V2 0/2] ubi: fix race between ctrl_cdev_ioctl and ubi_cdev_ioctl
Date: Wed, 3 Nov 2021 09:32:47 +0800 [thread overview]
Message-ID: <20211103013249.498805-1-libaokun1@huawei.com> (raw)
The lock held by ctrl_cdev_ioctl is ubi_devices_mutex, but the lock held by
ubi_cdev_ioctl is ubi->device_mutex. Therefore, the two locks can be
concurrent.
ubi_attach_mtd_dev in ctrl_cdev_ioctl may be race with ubi_create_volume and
ubi_remove_volume in ubi_cdev_ioctl. Because ubi_attach_mtd_dev has similar
ubi_free_volume and ubi_open_volume. These two functions are called in
uif_init and uif_close, and we'll fix both races in this patch set.
Another function in ctrl_cdev_ioctl, ubi_detach_mtd_dev, uses reference
counting and ubi_devices_lock to avoid race in concurrency cases,
so we do not need to fix it.
V1->V2:
Add race in uif_close
Baokun Li (2):
ubi: fix race between volume operations and uif_init
ubi: fix race between volume operations and uif_close
drivers/mtd/ubi/build.c | 5 +++++
1 file changed, 5 insertions(+)
--
2.31.1
next reply other threads:[~2021-11-03 1:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 1:32 Baokun Li [this message]
2021-11-03 1:32 ` [PATCH -next V2 1/2] ubi: fix race between volume operations and uif_init Baokun Li
2021-11-03 1:32 ` [PATCH -next V2 2/2] ubi: fix race between volume operations and uif_close Baokun Li
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=20211103013249.498805-1-libaokun1@huawei.com \
--to=libaokun1@huawei.com \
--cc=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=patchwork@huawei.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yukuai3@huawei.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).