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:
- Program X opens a loop device
- Program X gets the diskseq of the loop device.
- Program X associates a file with the loop device.
- Program X passes the loop device major, minor, and diskseq to something.
- Program X exits.
- Program Y detaches the file from the loop device.
- Program Y attaches a different file to the loop device.
- 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,