Skip to content

Commit 36b8312

Browse files
Kyle-KyleNipaLocal
authored andcommitted
ptp: prevent info leak to userspace
Somehow the `memset` is lost after refactor, which leaks a lot of kernel stack data to userspace directly. This patch clears the reserved data region to prevent the info leak. Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com> Signed-off-by: NipaLocal <nipa@local>
1 parent cbe99b6 commit 36b8312

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/ptp/ptp_chardev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static long ptp_clock_getcaps(struct ptp_clock *ptp, void __user *arg)
195195
if (caps.adjust_phase)
196196
caps.max_phase_adj = ptp->info->getmaxphase(ptp->info);
197197

198+
memset(caps.rsv, 0, sizeof(caps.rsv));
199+
198200
return copy_to_user(arg, &caps, sizeof(caps)) ? -EFAULT : 0;
199201
}
200202

0 commit comments

Comments
 (0)