From: Vasiliy Kulikov Date: Tue, 26 Oct 2010 21:22:15 +0000 (-0700) Subject: drivers/char/hpet.c: fix information leak to userland X-Git-Tag: firefly_0821_release~7613^2~3628^2~96 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dae512edc6e945e127f0848aa757055265d70aa2;p=firefly-linux-kernel-4.4.55.git drivers/char/hpet.c: fix information leak to userland Structure info is copied to userland with some padding fields unitialized. It leads to leaking of stack memory. [akpm@linux-foundation.org: remove now-unneeded zeroing of info->hi_ireqfreq] Signed-off-by: Vasiliy Kulikov Cc: Clemens Ladisch Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index fcb5f0d6ce70..55b8667f739f 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -596,11 +596,10 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, break; case HPET_INFO: { + memset(info, 0, sizeof(*info)); if (devp->hd_ireqfreq) info->hi_ireqfreq = hpet_time_div(hpetp, devp->hd_ireqfreq); - else - info->hi_ireqfreq = 0; info->hi_flags = readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK; info->hi_hpet = hpetp->hp_which;