From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4FF841BA9E for ; Wed, 15 Jul 2026 18:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784139941; cv=none; b=rSpd6iu2yJ4IRmc+MkEbzVQNLpWOCU3jHCuP5UBdVUcJnot5lGjLUS5pX52REY/L6gEmKBcOrip01FDZBKIGK/lN0ikdFkMVG7pZttcE5BUO2WWYOMqpWFOWaX9O+Ll/cstBSCXZYmE+2nzzl7IrDu1+4udXpiOUxAnNS1eW1Ps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784139941; c=relaxed/simple; bh=DRwysxMywiK5ujH9sdqFUZ+KdT3HQ5nuOGYd5rSddew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AW3ehgsqFa4Ezov2W+UGSTRsqqS8zPc5DGgk/oKS7mq19ZZdVMqWfVXSDgshmzkGglgG/W4vQ4fZUqmHswbRJmqxCY8bXYrkWoCHcZt0WfXhuaa/TxPV3GneywM5FmA5onplo/YLMzUmDKLiGCCdaJbUzvRAmtf+b8ApCqZKpAY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bwz5TbjM; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bwz5TbjM" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-ca7bea5e5b3so4229235a12.1 for ; Wed, 15 Jul 2026 11:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784139931; x=1784744731; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=EObXVbLcL4fdK7Ek+PIS7uUxJgkB9+Ku7XE2jyg9/4A=; b=Bwz5TbjMado1C6A6RRI/Vur9RaCSAVQEPGN1137/KqNGbcNJ92biwnBMRDcjcNDyrd Autx45oxMjSzUniOSpH4OKb9xkR7a8MV/iHoZizBt6J96EucFdbIonxFMwBT9XGDYoyj OLoVu88mnl+inND12Yj5/6yeoQgQy7IPTYPvIs+x0j4oNBHUGpIJ9x8sHiaHUlA9paz5 QjkSfC+6z6QNPMX1O6nek1lekhMSiiPeNNG9ltTMXTauprRd6C8WL5sLkA43aGGscnWk cU+4Ssnd3jlC/jNutlYM8sIKg1Es/czmiOwINBroBFcyybD3uTwNlprOEH4iWWrpE5QK FULw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784139931; x=1784744731; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=EObXVbLcL4fdK7Ek+PIS7uUxJgkB9+Ku7XE2jyg9/4A=; b=FiY4oW+qJ7DMNue2Bxr2E06PiSic+55a6PJWY7x3a2VJB+gmuGPx7nQFoUsMxNCjXG PDSd5xQa0GI+5lJlOyukxJc7XQdnnOeApi4qUR5z1MLWKkTMWQkUCBoVPUF7lonMPIlQ HzSYlcYSdcm/swx0bsPs69vNIbQhHN5ZWhF0y9Dsk/6gcIAikglt1dQVWaeo9zhBlabj GGj0PbhU/LFQCVij//GpydU6YxMyE0aphJtOE60YHc8yyb/Idf/ofboYJiaOsqicannh KMHe4EIp7R7Em6M8M8FJwrg1+/4EaPZNQCnw32whoffJ7ai92KrLqw+4dh0vMnYsKtLL kOFA== X-Forwarded-Encrypted: i=1; AHgh+RqExlZZFZC6OeNtnFbUdO7lEXt6rHXsPmVUu+E8RWCKTvoGHw5WPp9usxEEvgyoiplB8IrEEXjWjE+rJpI=@vger.kernel.org X-Gm-Message-State: AOJu0YyJ7iJPV1D5Hi1HyG1tmSivhXpgR2lB9u9sOSD38hhX9LAU68bT YUa59Z5T5+Evyu/8r1Nm2ugWnK3HGB8uFbfiltTH90OqCQQbQIm1gHBN X-Gm-Gg: AfdE7cmtlOb1hyohVWOrowYHqB7TvHkb7mgE9fPMuiqKIwYXEibOfoE3vUDEiypFijR g8puVoWeH8Vdnn5tPZukxsAIvgtAjYNMKK8Do/uNqUmzU/z1jTUDvn0oTM0wAcU2ylCslzMccQI GaOFnRVkFRaHNyhxeQxOtdDzLq+rhpXVXIf348rOnBos6XvjGQgJ+EG3rs9jfzv0cRj+fUg/9xi BXlj+GPpdhl23WRBn793CC85dzbMSYsKIQthdzv/i9u308xe390bTN3E7w7/oBKPAnhU0Nm+JG6 e+OEAzvb/Q1BxzBKlkajDp32ukXcnOOO8Mp4rwvCcK8Vtbe4M+h562qnPACLbWHdzBag24vD5UR qWrDQSX0oLxliPATSDRruVZ3NCgZA4HQo3Is05LFiCsdXuC6A5V5pVTbnF/jF2cZKPYigt0Vj98 EkDTPtVz38bA+Gi2onrb00AoN0HwcBwYMxhRUGqb4uY+nSuqUG5yey X-Received: by 2002:a05:6a20:c793:b0:39f:24a5:3065 with SMTP id adf61e73a8af0-3c36c0f8f74mr3900110637.7.1784139931134; Wed, 15 Jul 2026 11:25:31 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:575a:5ca:2b13:aa89]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3140e4fcd26sm3077101eec.5.2026.07.15.11.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 11:25:29 -0700 (PDT) Date: Wed, 15 Jul 2026 11:25:27 -0700 From: Dmitry Torokhov To: "Michael S. Tsirkin" Cc: Hari Mishal , Amit Shah , Arnd Bergmann , Greg Kroah-Hartman , Gerd Hoffmann , Jason Wang , David Hildenbrand , Henrik Rydberg , Xuan Zhuo , Eugenio =?utf-8?B?UMOpcmV6?= , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: Re: [PATCH 2/4] virtio_input: validate device-reported multitouch slot count Message-ID: References: <20260715142337.22811-1-harimishal1@gmail.com> <20260715142337.22811-3-harimishal1@gmail.com> <20260715115018-mutt-send-email-mst@kernel.org> <20260715120911-mutt-send-email-mst@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260715120911-mutt-send-email-mst@kernel.org> On Wed, Jul 15, 2026 at 12:11:12PM -0400, Michael S. Tsirkin wrote: > On Wed, Jul 15, 2026 at 06:07:56PM +0200, Hari Mishal wrote: > > On Wed, Jul 15, 2026 at 5:50 PM Michael S. Tsirkin wrote: > > > > > > On Wed, Jul 15, 2026 at 04:22:41PM +0200, Hari Mishal wrote: > > > > nslots is derived from the ABS_MT_SLOT maximum reported by the > > > > virtio device. A device could report a bogus maximum (e.g. -1) > > > > making nslots = 0, which input_mt_init_slots() does not reject; > > > > it returns success without allocating any slot storage, silently > > > > leaving the device registered as multitouch capable with no > > > > backing state. > > > > > > So let's disable multitouch instead? > > > > > > > So rather than failing the whole probe, just warn and clear > > ABS_MT_SLOT from absbit in that case, so the rest of the device > > still registers? I took my lead from input_mt_init_slots(), which > > has its own internal cap and returns -EINVAL when the device > > reports more than 1024 slots. > > Shall I modify that case to get the same "warn and disable > > multitouch" for consistency, or is a hard failure better there since > > it's a different type of bad device data? > > I don't really know enough for sure but generally if the device can > kinda work it's better than not working, and adding > a capability to a device that driver can't use should > generally just ignore the capability, not fail probe. What is the failure mode if we keep the ABS_MT_SLOT capability? Does the kernel crash? And if this can cause crash then we should fix input_mt_init_slots() to reject requests for 0 slots with -EINVAL. Thanks. -- Dmitry