diff options
author | Laura Abbott <labbott@redhat.com> | 2018-04-18 00:57:42 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-04-19 13:54:57 +0300 |
commit | c3bca5d450b620dd3d36e14b5e1f43639fd47d6b (patch) | |
tree | d57849e0c5a1fff07dbcaa994d6aaeb80101cdc8 /drivers/clocksource/timer-imx-tpm.c | |
parent | e142aa09ed88be98395dde7acb96fb2263566b68 (diff) | |
download | linux-c3bca5d450b620dd3d36e14b5e1f43639fd47d6b.tar.xz |
posix-cpu-timers: Ensure set_process_cpu_timer is always evaluated
Commit a9445e47d897 ("posix-cpu-timers: Make set_process_cpu_timer()
more robust") moved the check into the 'if' statement. Unfortunately,
it did so on the right side of an && which means that it may get short
circuited and never evaluated. This is easily reproduced with:
$ cat loop.c
void main() {
struct rlimit res;
/* set the CPU time limit */
getrlimit(RLIMIT_CPU,&res);
res.rlim_cur = 2;
res.rlim_max = 2;
setrlimit(RLIMIT_CPU,&res);
while (1);
}
Which will hang forever instead of being killed. Fix this by pulling the
evaluation out of the if statement but checking the return value instead.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1568337
Fixes: a9445e47d897 ("posix-cpu-timers: Make set_process_cpu_timer() more robust")
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Cc: "Max R . P . Grossmann" <m@max.pm>
Cc: John Stultz <john.stultz@linaro.org>
Link: https://lkml.kernel.org/r/20180417215742.2521-1-labbott@redhat.com
Diffstat (limited to 'drivers/clocksource/timer-imx-tpm.c')
0 files changed, 0 insertions, 0 deletions