Commit 895ac137 authored by Eugene Syromiatnikov's avatar Eugene Syromiatnikov Committed by David S. Miller

ptp: check that rsv field is zero in struct ptp_sys_offset_extended

Otherwise it is impossible to use it for something else, as it will break
userspace that puts garbage there.

The same check should be done in other structures, but the fact that
data in reserved fields is ignored is already part of the kernel ABI.
Signed-off-by: default avatarEugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 977e4899
...@@ -224,7 +224,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) ...@@ -224,7 +224,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
extoff = NULL; extoff = NULL;
break; break;
} }
if (extoff->n_samples > PTP_MAX_SAMPLES) { if (extoff->n_samples > PTP_MAX_SAMPLES
|| extoff->rsv[0] || extoff->rsv[1] || extoff->rsv[2]) {
err = -EINVAL; err = -EINVAL;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment