]> git.baikalelectronics.ru Git - kernel.git/commit
select: deal with math overflow from borderline valid userland data
authorArjan van de Ven <arjan@linux.intel.com>
Sat, 25 Oct 2008 19:41:41 +0000 (12:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 26 Oct 2008 18:22:08 +0000 (11:22 -0700)
commite9cb394c28a9d92acc97b6fdc46a699dc2ff275f
tree8c7b8e64ae40769a3f9f948491987ba93698ee3a
parent8a6d2d1eeb54d5c87b5f7d7e70ca49ba89d0e9cd
select: deal with math overflow from borderline valid userland data

Some userland apps seem to pass in a "0" for the seconds, and several
seconds worth of usecs to select().  The old kernels accepted this just
fine, so the new kernels must too.

However, due to the upscaling of the microseconds to nanoseconds we had
some cases where we got math overflow, and depending on the GCC version
(due to inlining decisions) that actually resulted in an -EINVAL return.

This patch fixes this by adding the excess microseconds to the seconds
field.

Also with thanks to Marcin Slusarz for spotting some implementation bugs
in the diagnostics patches.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/compat.c
fs/select.c