[Linux-kernel-mentees] [PATCH v3] media/v4l2-core: Fix kernel-infoleak in video_put_user()

Peilin Ye yepeilin.cs at gmail.com
Mon Jul 27 22:04:56 UTC 2020

On Mon, Jul 27, 2020 at 04:16:08PM +0300, Dan Carpenter wrote:
> drivers/char/hpet.c:675 hpet_ioctl() warn: check that 'info' doesn't leak information (struct has a hole after 'hi_timer')

This one seems like a false positive.


	err = hpet_ioctl_common(file->private_data, cmd, arg, &info);

	if ((cmd == HPET_INFO) && !err &&
	    (copy_to_user((void __user *)arg, &info, sizeof(info))))
		err = -EFAULT;

`info` is only being copied to userspace when `cmd` is `HPET_INFO`.
However, hpet_ioctl_common() is already doing memset() on `info` in
`case HPET_INFO`:


	case HPET_INFO:
			memset(info, 0, sizeof(*info));

Thank you,
Peilin Ye

More information about the Linux-kernel-mentees mailing list