Thread (20 messages) 20 messages, 5 authors, 2018-10-17

Re: WARNING: kmalloc bug in input_mt_init_slots

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2018-10-17 00:10:02
Also in: linux-mm, lkml

On Thu, Sep 27, 2018 at 07:35:37AM -0700, Matthew Wilcox wrote:
On Mon, Sep 24, 2018 at 11:41:58AM -0700, Dmitry Torokhov wrote:
quoted
quoted
How large is the allocation? AFACIT nRequests larger than KMALLOC_MAX_SIZE
are larger than the maximum allowed by the page allocator. Thus the warning
and the NULL return.
The size in this particular case is being derived from a value passed
from userspace. Input core does not care about any limits on size of
memory kmalloc() can support and is perfectly happy with getting NULL
and telling userspace to go away with their silly requests by returning
-ENOMEM.

For the record: I definitely do not want to pre-sanitize size neither in
uinput nor in input core.
Probably should be using kvzalloc then.
No. No sane input device can track so many contacts so we need to use
kvzalloc(). Failing to allocate memory is proper response here.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help