From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Torokhov Subject: Re: WARNING: kmalloc bug in input_mt_init_slots Date: Wed, 17 Oct 2018 08:43:30 -0700 Message-ID: References: <000000000000e5f76c057664e73d@google.com> <010001660c1fafb2-6d0dc7e1-d898-4589-874c-1be1af94e22d-000000@email.amazonses.com> <010001660c4a8bbe-91200766-00df-48bd-bc60-a03da2ccdb7d-000000@email.amazonses.com> <20180924184158.GA156847@dtor-ws> <20180927143537.GB19006@bombadil.infradead.org> <20181017000955.GG230131@dtor-ws> <0100016682aaae79-d1382d3d-83f8-4972-b4b9-6220367f4f65-000000@email.amazonses.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <0100016682aaae79-d1382d3d-83f8-4972-b4b9-6220367f4f65-000000@email.amazonses.com> Sender: linux-kernel-owner@vger.kernel.org To: Christopher Lameter Cc: Matthew Wilcox , Dmitry Vyukov , syzbot+87829a10073277282ad1@syzkaller.appspotmail.com, Pekka Enberg , "linux-input@vger.kernel.org" , lkml , Henrik Rydberg , syzkaller-bugs , Linux-MM List-Id: linux-input@vger.kernel.org On October 17, 2018 8:35:15 AM PDT, Christopher Lameter wr= ote: >On Tue, 16 Oct 2018, Dmitry Torokhov wrote: > >> 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: >> > > > How large is the allocation? AFACIT nRequests larger than >KMALLOC_MAX_SIZE >> > > > are larger than the maximum allowed by the page allocator=2E Thus >the warning >> > > > and the NULL return=2E >> > > >> > > The size in this particular case is being derived from a value >passed >> > > from userspace=2E 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=2E >> > > >> > > For the record: I definitely do not want to pre-sanitize size >neither in >> > > uinput nor in input core=2E >> > >> > Probably should be using kvzalloc then=2E >> >> No=2E No sane input device can track so many contacts so we need to use >> kvzalloc()=2E Failing to allocate memory is proper response here=2E > >What is a "contact" here? Are we talking about SG segments? No, we are talking about maximum number of fingers a person can have=2E De= vices don't usually track more than 10 distinct contacts on the touch surfa= ce at a time=2E Thanks=2E --=20 Dmitry