Re: [PATCH] block: increment diskseq on all media change events
From: Jens Axboe
Date: Tue Jun 20 2023 - 09:19:36 EST
On Wed, 07 Jun 2023 13:08:37 -0400, Demi Marie Obenour wrote:
> Currently, associating a loop device with a different file descriptor
> does not increment its diskseq. This allows the following race
> condition:
>
> 1. Program X opens a loop device
> 2. Program X gets the diskseq of the loop device.
> 3. Program X associates a file with the loop device.
> 4. Program X passes the loop device major, minor, and diskseq to
> something.
> 5. Program X exits.
> 6. Program Y detaches the file from the loop device.
> 7. Program Y attaches a different file to the loop device.
> 8. The opener finally gets around to opening the loop device and checks
> that the diskseq is what it expects it to be. Even though the
> diskseq is the expected value, the result is that the opener is
> accessing the wrong file.
>
> [...]
Applied, thanks!
[1/1] block: increment diskseq on all media change events
commit: b90ecc0379eb7bbe79337b0c7289390a98752646
Best regards,
--
Jens Axboe