lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALjSBEuEd70qy2DZUT4gMPJp4bALzZitu+JOr6TBHCXRkTrw+g@mail.gmail.com>
Date: Wed, 10 Dec 2025 19:42:31 +0800
From: Ming Hung Tsai <mtsai@...hat.com>
To: Li Chen <me@...ux.beauty>
Cc: Alasdair Kergon <agk@...hat.com>, Mike Snitzer <snitzer@...nel.org>, 
	Mikulas Patocka <mpatocka@...hat.com>, dm-devel@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] dm cache: drop redundant origin size check

On Wed, Dec 10, 2025 at 11:25 AM Li Chen <me@...ux.beauty> wrote:
>
> The cache target already exposes the origin device through
> cache_iterate_devices(), which allows dm-table to call
> device_area_is_invalid() and verify that the mapping fits inside the
> underlying block device.
>
> The explicit ti->len > origin_sectors test in parse_origin_dev() is
> therefore redundant. Drop this check and rely on the core device
> validation instead. This changes the user-visible error string when the
> origin is too small, but preserves the failure behaviour.
>
> Signed-off-by: Li Chen <me@...ux.beauty>
> ---
>  drivers/md/dm-cache-target.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
> index a10d75a562db..350a0aa53365 100644
> --- a/drivers/md/dm-cache-target.c
> +++ b/drivers/md/dm-cache-target.c
> @@ -2099,7 +2099,6 @@ static int parse_cache_dev(struct cache_args *ca, struct dm_arg_set *as,
>  static int parse_origin_dev(struct cache_args *ca, struct dm_arg_set *as,
>                             char **error)
>  {
> -       sector_t origin_sectors;
>         int r;
>
>         if (!at_least_one_arg(as, error))
> @@ -2112,12 +2111,6 @@ static int parse_origin_dev(struct cache_args *ca, struct dm_arg_set *as,
>                 return r;
>         }
>
> -       origin_sectors = get_dev_size(ca->origin_dev);
> -       if (ca->ti->len > origin_sectors) {
> -               *error = "Device size larger than cached device";
> -               return -EINVAL;
> -       }
> -
>         return 0;
>  }
>
> --
> 2.51.0
>
>

The size check in parse_origin_dev() provides early validation during
table creation. Removing it delays the size check until the resume
phase when reloading an existing device, which leaves the device
suspended if the new table size is invalid. This changes user
expectations and could affect volume managers like LVM and Stratis.


Ming-Hung Tsai


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ