Skip to content

Commit

Permalink
ptp: check that rsv field is zero in struct ptp_sys_offset_extended
Browse files Browse the repository at this point in the history
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: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eugene Syromiatnikov authored and David S. Miller committed Jan 8, 2019
1 parent 977e489 commit 895ac13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/ptp/ptp_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
extoff = NULL;
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;
break;
}
Expand Down

0 comments on commit 895ac13

Please sign in to comment.