Skip to content

Commit

Permalink
ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
Browse files Browse the repository at this point in the history
If a gettime64 call fails, return the error and avoid copying data back
to user.

Cc: Richard Cochran <[email protected]>
Cc: Jacob Keller <[email protected]>
Signed-off-by: Miroslav Lichvar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
mlichvar authored and davem330 committed Nov 10, 2018
1 parent fbb960a commit 83d0bdc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/ptp/ptp_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
ptp->info->gettime64(ptp->info, &ts);
err = ptp->info->gettime64(ptp->info, &ts);
if (err)
goto out;
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
Expand Down Expand Up @@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
break;
}

out:
kfree(sysoff);
return err;
}
Expand Down

0 comments on commit 83d0bdc

Please sign in to comment.