Helge Deller 9b7b819ca1 compat: cleanup coding in compat_get_bitmap() and compat_put_bitmap()
In the functions compat_get_bitmap() and compat_put_bitmap() the
variable nr_compat_longs stores how many compat_ulong_t words should be
copied in a loop.

The copy loop itself is this:
  if (nr_compat_longs-- > 0) {
      if (__get_user(um, umask)) return -EFAULT;
  } else {
      um = 0;
  }

Since nr_compat_longs gets unconditionally decremented in each loop and
since it's type is unsigned this could theoretically lead to out of
bounds accesses to userspace if nr_compat_longs wraps around to
(unsigned)(-1).

Although the callers currently do not trigger out-of-bounds accesses, we
should better implement the loop in a safe way to completely avoid such
warp-arounds.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
2015-06-04 23:57:18 +02:00
..
2015-04-27 23:11:49 -04:00
2015-04-17 09:04:08 -04:00
2015-04-21 09:33:10 -07:00
2015-04-11 22:27:55 -04:00
2015-04-12 21:03:31 +02:00
2015-04-12 20:58:24 +02:00
2015-02-24 08:41:07 +01:00
2015-04-30 09:35:41 -07:00
2014-12-04 14:34:54 -05:00
2014-12-22 15:40:48 +01:00
2015-01-17 10:02:23 +13:00
2015-04-15 15:06:55 -04:00
2014-12-10 17:41:10 -08:00
2015-04-06 11:16:04 -04:00