From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569AbdBAR1S (ORCPT ); Wed, 1 Feb 2017 12:27:18 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35377 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752902AbdBAR1Q (ORCPT ); Wed, 1 Feb 2017 12:27:16 -0500 Date: Wed, 1 Feb 2017 09:27:13 -0800 From: Dmitry Torokhov To: Benjamin Tissoires Cc: linux-input@vger.kernel.org, David Herrmann , Rodrigo Rivas Costa , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Input: uinput - fix crash when mixing old and new init style Message-ID: <20170201172713.GD40045@dtor-ws> References: <20170131231728.GA37933@dtor-ws> <20170201084925.GD31658@mail.corp.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170201084925.GD31658@mail.corp.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 01, 2017 at 09:49:25AM +0100, Benjamin Tissoires wrote: > On Jan 31 2017 or thereabouts, Dmitry Torokhov wrote: > > If user tries to initialize uinput device mixing old and new style > > initialization (i.e. using old UI_SET_ABSBIT instead of UI_ABS_SETUP, > > we forget to allocate input->absinfo and will crash when trying to send > > absolute events: > > > > ioctl(ui, UI_DEV_SETUP, &us); > > ioctl(ui, UI_SET_EVBIT, EV_ABS); > > ioctl(ui, UI_SET_ABSBIT, ABS_X); > > ioctl(ui, UI_SET_ABSBIT, ABS_Y); > > ioctl(ui, UI_DEV_CREATE, 0); > > Shouldn't we prevent completely the mix of the 2 versions? If the user > used UI_DEV_SETUP, we should probably prevent the use of UI_SET_ABSBIT > afterwards, or at least warn it somehow. Why? If user does not wish to set up parameters of an axis then just using UI_SET_ABSBIT is fine. In fact, I think it would be weird if we allowed all UI_SET_*BIT except for ABS. > > But the patch in itself doesn't hurt, so: > Reviewed-by: Benjamin Tissoires Thanks. -- Dmitry