Skip to content
Commit b0bf1afd authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Jens Axboe
Browse files

cdrom: Avoid barrier_nospec() in cdrom_ioctl_media_changed()



The barrier_nospec() after the array bounds check is overkill and
painfully slow for arches which implement it.

Furthermore, most arches don't implement it, so they remain exposed to
Spectre v1 (which can affect pretty much any CPU with branch
prediction).

Instead, clamp the user pointer to a valid range so it's guaranteed to
be a valid array index even when the bounds check mispredicts.

Fixes: 8270cb10 ("cdrom: Fix spectre-v1 gadget")
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/1d86f4d9d8fba68e5ca64cdeac2451b95a8bf872.1729202937.git.jpoimboe@kernel.org


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent de7007e9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment