[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <b6346235-cc66-4ce0-8768-52a1a89fd699@app.fastmail.com>
Date: Fri, 18 Jul 2025 07:56:49 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Klara Modin" <klarasmodin@...il.com>, "Arnd Bergmann" <arnd@...nel.org>
Cc: "Anuj Gupta" <anuj20.g@...sung.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"Kanchan Joshi" <joshi.k@...sung.com>,
"Christian Brauner" <brauner@...nel.org>,
"Christoph Hellwig" <hch@...radead.org>,
"Naresh Kamboju" <naresh.kamboju@...aro.org>,
"Anders Roxell" <anders.roxell@...aro.org>, "Jens Axboe" <axboe@...nel.dk>,
"Keith Busch" <kbusch@...nel.org>,
"Caleb Sander Mateos" <csander@...estorage.com>,
"Pavel Begunkov" <asml.silence@...il.com>,
"Alexey Dobriyan" <adobriyan@...il.com>,
"Darrick J. Wong" <djwong@...nel.org>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] block: fix FS_IOC_GETLBMD_CAP parsing in
blkdev_common_ioctl()
On Fri, Jul 18, 2025, at 01:37, Klara Modin wrote:
>> diff --git a/block/ioctl.c b/block/ioctl.c
>> index 9ad403733e19..af2e22e5533c 100644
>> --- a/block/ioctl.c
>> +++ b/block/ioctl.c
>> @@ -566,9 +566,11 @@ static int blkdev_common_ioctl(struct block_device *bdev, blk_mode_t mode,
>> void __user *argp)
>> {
>> unsigned int max_sectors;
>> + int ret;
>>
>> - if (_IOC_NR(cmd) == _IOC_NR(FS_IOC_GETLBMD_CAP))
>> - return blk_get_meta_cap(bdev, cmd, argp);
>
>> + ret = blk_get_meta_cap(bdev, cmd, argp);
>> + if (ret != -ENOIOCTLCMD)
>> + return ret;
>
> This check seems to be incomplete. In the case when BLK_DEV_INTEGRITY is
> disabled the ioctl can never complete as blk_get_meta_cap will then
> always return -EOPNOTSUPP. Or should the !BLK_DEV_INTEGRITY stub be
> changed to return -ENOIOCTLCMD instead?
Ah, I did miss the stub.
> It makes e.g. cryptsetup fail in my initramfs. Adding -EOPNOTSUPP to the
> check fixes it for me:
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index af2e22e5533c..7d5361fd1b7d 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -569,7 +569,7 @@ static int blkdev_common_ioctl(struct block_device
> *bdev, blk_mode_t mode,
> int ret;
>
> ret = blk_get_meta_cap(bdev, cmd, argp);
> - if (ret != -ENOIOCTLCMD)
> + if (ret != -EOPNOTSUPP && ret != -ENOIOCTLCMD)
> return ret;
>
> switch (cmd) {
I think returning -ENOIOCTLCMD from the stub makes more sense,
but I don't know what the motivation for the -EOPNOTSUPP was.
Arnd
Powered by blists - more mailing lists