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
[ Upstream commit 83d0bdc7390b890905634186baaa294475cd6a06 ]

If a gettime64 call fails, return the error and avoid copying data back
to user.

Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
mlichvar authored and gregkh committed Feb 20, 2019
1 parent 7c6340d commit caf6a81
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 @@ -204,7 +204,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 @@ -257,6 +259,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 caf6a81

Please sign in to comment.