Sasha Levin
2ccd4f4d47
pipe: fail cleanly when root tries F_SETPIPE_SZ with big size
...
When a user with the CAP_SYS_RESOURCE cap tries to F_SETPIPE_SZ a pipe
with size bigger than kmalloc() can alloc it spits out an ugly warning:
------------[ cut here ]------------
WARNING: at mm/page_alloc.c:2095 __alloc_pages_nodemask+0x5d3/0x7a0()
Pid: 733, comm: a.out Not tainted 3.2.0-rc1+ #4
Call Trace:
warn_slowpath_common+0x75/0xb0
warn_slowpath_null+0x15/0x20
__alloc_pages_nodemask+0x5d3/0x7a0
__get_free_pages+0x12/0x50
__kmalloc+0x12b/0x150
pipe_set_size+0x75/0x120
pipe_fcntl+0xf8/0x140
do_fcntl+0x2d4/0x410
sys_fcntl+0x66/0xa0
system_call_fastpath+0x16/0x1b
---[ end trace 432f702e6db7b5ee ]---
Instead, make kcalloc() handle the overflow case and fail quietly.
[akpm@linux-foundation.org: switch to sizeof(*bufs) for 80-column niceness]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Acked-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-12 20:13:04 -08:00
..
2012-01-10 15:09:01 -08:00
2012-01-06 23:19:54 -05:00
2012-01-03 22:55:04 -05:00
2012-01-03 22:54:53 -05:00
2012-01-11 00:20:12 -05:00
2012-01-03 22:52:40 -05:00
2012-01-03 22:54:53 -05:00
2012-01-10 16:59:59 -08:00
2012-01-03 22:54:07 -05:00
2012-01-09 16:36:12 -05:00
2012-01-08 12:19:57 -08:00
2012-01-10 11:13:16 -05:00
2012-01-03 22:54:57 -05:00
2012-01-06 23:15:54 -05:00
2012-01-08 12:19:57 -08:00
2012-01-08 20:19:03 -05:00
2012-01-10 14:55:55 -08:00
2012-01-06 23:19:54 -05:00
2012-01-03 22:52:40 -05:00
2012-01-09 12:51:01 -08:00
2011-03-15 02:21:44 -04:00
2012-01-09 12:51:21 -08:00
2012-01-09 12:51:21 -08:00
2012-01-10 11:54:07 -05:00
2012-01-09 12:09:47 -08:00
2012-01-03 22:55:10 -05:00
2011-07-21 10:59:16 -07:00
2012-01-06 23:19:54 -05:00
2012-01-10 14:55:55 -08:00
2012-01-06 23:19:54 -05:00
2012-01-10 17:48:52 -05:00
2012-01-06 23:19:54 -05:00
2012-01-03 22:54:54 -05:00
2012-01-03 22:52:41 -05:00
2012-01-03 22:55:05 -05:00
2012-01-09 10:48:11 -05:00
2012-01-09 12:51:21 -08:00
2012-01-10 11:54:07 -05:00
2012-01-10 13:45:22 -08:00
2012-01-08 13:10:57 -08:00
2012-01-06 23:16:53 -05:00
2012-01-10 13:45:22 -08:00
2012-01-08 12:19:57 -08:00
2012-01-06 23:19:54 -05:00
2012-01-10 14:57:40 -08:00
2011-03-31 11:26:23 -03:00
2012-01-10 14:57:40 -08:00
2012-01-08 13:10:57 -08:00
2011-11-26 19:58:47 -08:00
2012-01-03 22:57:12 -05:00
2012-01-06 23:19:54 -05:00
2012-01-10 14:55:55 -08:00
2012-01-03 22:55:01 -05:00
2012-01-03 22:52:40 -05:00
2012-01-12 20:13:02 -08:00
2011-11-18 13:49:00 -08:00
2012-01-08 13:21:22 -08:00
2012-01-06 23:16:53 -05:00
2012-01-03 22:55:07 -05:00
2012-01-10 16:30:54 -08:00
2012-01-10 13:45:22 -08:00
2012-01-03 22:52:40 -05:00
2012-01-03 22:55:03 -05:00
2012-01-06 23:16:53 -05:00
2012-01-10 14:57:19 -08:00
2012-01-09 12:51:21 -08:00
2012-01-06 23:19:54 -05:00
2012-01-09 12:50:15 -08:00
2011-11-02 16:07:03 -07:00
2011-07-26 12:57:09 -04:00
2012-01-03 22:55:11 -05:00
2012-01-03 22:54:54 -05:00
2011-07-20 01:43:10 -04:00
2012-01-10 16:30:51 -08:00
2011-05-03 10:10:51 +10:00
2012-01-06 23:16:53 -05:00
2011-10-31 19:30:31 -04:00
2011-11-16 09:21:50 +01:00
2012-01-10 13:08:55 -05:00
2012-01-03 22:54:07 -05:00
2011-12-13 11:18:17 -08:00
2012-01-05 15:40:12 -08:00
2012-01-03 22:55:19 -05:00
2012-01-10 13:06:32 -05:00
2011-05-31 16:33:35 +02:00
2011-10-28 14:58:58 +02:00
2011-05-25 08:39:26 -07:00
2011-02-21 15:07:04 -08:00
2011-10-31 17:30:57 -07:00
2012-01-10 16:30:44 -08:00
2011-03-23 19:47:13 -07:00
2012-01-06 23:16:53 -05:00
2011-03-21 00:16:09 -04:00
2012-01-06 23:20:13 -05:00
2011-04-28 11:28:20 -07:00
2012-01-03 22:52:39 -05:00
2011-01-16 13:47:07 -05:00
2012-01-10 16:59:59 -08:00
2011-08-01 02:10:06 -04:00
2012-01-10 16:30:42 -08:00
2012-01-06 23:20:12 -05:00
2012-01-05 15:40:12 -08:00
2011-10-31 19:30:31 -04:00
2012-01-09 12:51:01 -08:00
2012-01-10 16:30:51 -08:00
2012-01-03 22:54:07 -05:00
2011-12-26 10:25:26 -08:00
2012-01-06 23:15:54 -05:00
2011-05-25 08:39:26 -07:00
2012-01-06 23:20:12 -05:00
2011-05-26 10:01:43 -06:00
2012-01-06 23:15:54 -05:00
2012-01-08 13:21:22 -08:00
2012-01-06 23:16:53 -05:00
2012-01-12 20:13:04 -08:00
2012-01-03 22:57:11 -05:00
2012-01-03 22:57:11 -05:00
2011-10-28 14:58:54 +02:00
2012-01-06 23:19:54 -05:00
2011-10-31 17:30:44 -07:00
2011-03-21 00:16:08 -04:00
2012-01-03 22:52:40 -05:00
2012-01-03 22:54:07 -05:00
2011-11-02 12:53:43 +01:00
2011-11-02 12:53:42 +01:00
2012-01-03 22:53:07 -05:00
2012-01-06 23:20:13 -05:00
2012-01-03 22:54:07 -05:00
2011-06-14 11:46:14 +02:00
2011-03-23 19:47:13 -07:00
2012-01-03 22:52:40 -05:00