Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2145e15e authored by Matthew Daley's avatar Matthew Daley Committed by Linus Torvalds
Browse files

floppy: don't write kernel-only members to FDRAWCMD ioctl output



Do not leak kernel-only floppy_raw_cmd structure members to userspace.
This includes the linked-list pointer and the pointer to the allocated
DMA space.

Signed-off-by: default avatarMatthew Daley <mattd@bugfuzz.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ef87dbe7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3067,7 +3067,10 @@ static int raw_cmd_copyout(int cmd, void __user *param,
	int ret;

	while (ptr) {
		ret = copy_to_user(param, ptr, sizeof(*ptr));
		struct floppy_raw_cmd cmd = *ptr;
		cmd.next = NULL;
		cmd.kernel_data = NULL;
		ret = copy_to_user(param, &cmd, sizeof(cmd));
		if (ret)
			return -EFAULT;
		param += sizeof(struct floppy_raw_cmd);