[PATCH] nvme: don't allow unprivileged Write Zeroes passthrough on read-only FDs

Keith Busch kbusch at kernel.org
Thu Dec 1 08:07:38 PST 2022


On Tue, Nov 29, 2022 at 10:00:16AM +0100, Christoph Hellwig wrote:
> -	if (nvme_is_write(c))
> +	if (nvme_is_write(c) || c->common.opcode == nvme_cmd_write_zeroes)
>  		return mode & FMODE_WRITE;

Write Uncorrectable should also be checked, and any future opcodes that
can modify media. Maybe use Command Effects Log's LBCC field instead? We
can preload known effects for older nvme's that don't support that log
page.



More information about the Linux-nvme mailing list