diff options
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/posix-clock.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c index 04498cbf6002..25028dd4fa18 100644 --- a/kernel/time/posix-clock.c +++ b/kernel/time/posix-clock.c | |||
@@ -287,11 +287,16 @@ static int pc_clock_adjtime(clockid_t id, struct timex *tx) | |||
287 | if (err) | 287 | if (err) |
288 | return err; | 288 | return err; |
289 | 289 | ||
290 | if ((cd.fp->f_mode & FMODE_WRITE) == 0) { | ||
291 | err = -EACCES; | ||
292 | goto out; | ||
293 | } | ||
294 | |||
290 | if (cd.clk->ops.clock_adjtime) | 295 | if (cd.clk->ops.clock_adjtime) |
291 | err = cd.clk->ops.clock_adjtime(cd.clk, tx); | 296 | err = cd.clk->ops.clock_adjtime(cd.clk, tx); |
292 | else | 297 | else |
293 | err = -EOPNOTSUPP; | 298 | err = -EOPNOTSUPP; |
294 | 299 | out: | |
295 | put_clock_desc(&cd); | 300 | put_clock_desc(&cd); |
296 | 301 | ||
297 | return err; | 302 | return err; |
@@ -344,11 +349,16 @@ static int pc_clock_settime(clockid_t id, const struct timespec *ts) | |||
344 | if (err) | 349 | if (err) |
345 | return err; | 350 | return err; |
346 | 351 | ||
352 | if ((cd.fp->f_mode & FMODE_WRITE) == 0) { | ||
353 | err = -EACCES; | ||
354 | goto out; | ||
355 | } | ||
356 | |||
347 | if (cd.clk->ops.clock_settime) | 357 | if (cd.clk->ops.clock_settime) |
348 | err = cd.clk->ops.clock_settime(cd.clk, ts); | 358 | err = cd.clk->ops.clock_settime(cd.clk, ts); |
349 | else | 359 | else |
350 | err = -EOPNOTSUPP; | 360 | err = -EOPNOTSUPP; |
351 | 361 | out: | |
352 | put_clock_desc(&cd); | 362 | put_clock_desc(&cd); |
353 | 363 | ||
354 | return err; | 364 | return err; |