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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIA004HDuhoTQzY/@infradead.org>
Date:   Wed, 7 Jun 2023 00:42:11 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Demi Marie Obenour <demi@...isiblethingslab.com>
Cc:     Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block, loop: Increment diskseq when releasing a loop
 device

> +++ b/block/genhd.c
> @@ -1502,3 +1502,4 @@ void inc_diskseq(struct gendisk *disk)
>  {
>  	disk->diskseq = atomic64_inc_return(&diskseq);
>  }
> +EXPORT_SYMBOL(inc_diskseq);

I really do not like exporting this as a lowlevel function.  If we
increment the sequence it should be part of a higher level operation.

> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1205,6 +1205,12 @@ static void __loop_clr_fd(struct loop_device *lo, bool release)
>  	if (!part_shift)
>  		set_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
>  	mutex_lock(&lo->lo_mutex);
> +
> +	/*
> +	 * Increment the disk sequence number, so that userspace knows this
> +	 * device now points to something else.
> +	 */
> +	inc_diskseq(lo->lo_disk);

And I'm not sure why we even need this.  __loop_clr_fd
already calls disk_force_media_change, which calls inc_diskseq.
Why do we need an extra increment?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ