All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jason Andryuk <jandryuk@gmail.com>
Cc: stable@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Peter Hutterer <peter.hutterer@who-t.net>,
	Jason Andryuk <jason.andryuk@amd.com>
Subject: Re: [PATCH v2] Input: try trimming too long modalias strings
Date: Mon, 17 Jun 2024 14:31:10 +0200	[thread overview]
Message-ID: <2024061700-barber-prong-643f@gregkh> (raw)
In-Reply-To: <20240613015251.88897-1-jandryuk@gmail.com>

On Wed, Jun 12, 2024 at 09:52:51PM -0400, Jason Andryuk wrote:
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> commit 0774d19038c496f0c3602fb505c43e1b2d8eed85 upstream.
> 
> If an input device declares too many capability bits then modalias
> string for such device may become too long and not fit into uevent
> buffer, resulting in failure of sending said uevent. This, in turn,
> may prevent userspace from recognizing existence of such devices.
> 
> This is typically not a concern for real hardware devices as they have
> limited number of keys, but happen with synthetic devices such as
> ones created by xen-kbdfront driver, which creates devices as being
> capable of delivering all possible keys, since it doesn't know what
> keys the backend may produce.
> 
> To deal with such devices input core will attempt to trim key data,
> in the hope that the rest of modalias string will fit in the given
> buffer. When trimming key data it will indicate that it is not
> complete by placing "+," sign, resulting in conversions like this:
> 
> old: k71,72,73,74,78,7A,7B,7C,7D,8E,9E,A4,AD,E0,E1,E4,F8,174,
> new: k71,72,73,74,78,7A,7B,7C,+,
> 
> This should allow existing udev rules continue to work with existing
> devices, and will also allow writing more complex rules that would
> recognize trimmed modalias and check input device characteristics by
> other means (for example by parsing KEY= data in uevent or parsing
> input device sysfs attributes).
> 
> Note that the driver core may try adding more uevent environment
> variables once input core is done adding its own, so when forming
> modalias we can not use the entire available buffer, so we reduce
> it by somewhat an arbitrary amount (96 bytes).
> 
> Reported-by: Jason Andryuk <jandryuk@gmail.com>
> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
> Tested-by: Jason Andryuk <jandryuk@gmail.com>
> Link: https://lore.kernel.org/r/ZjAWMQCJdrxZkvkB@google.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> [ Apply to linux-5.15.y ]
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
> ---
> Built with 5.15 and 4.19.  Tested on 5.15.
> 
> Drop const from struct input_dev *id
> Declare i outside loop:
> 
> drivers/input/input.c: In function ‘input_print_modalias_parts’:
> drivers/input/input.c:1393:25: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
>  1393 |                         for (int i = size - 1 - remainder - 3; i >= 0; i--) {
>       |                         ^~~
> ---
>  drivers/input/input.c | 105 ++++++++++++++++++++++++++++++++++++------
>  1 file changed, 90 insertions(+), 15 deletions(-)

Both now queued up, thanks.

greg k-h

  reply	other threads:[~2024-06-17 12:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  1:52 [PATCH v2] Input: try trimming too long modalias strings Jason Andryuk
2024-06-17 12:31 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-13  1:50 Jason Andryuk
2024-04-29 21:50 Dmitry Torokhov
2024-04-30  1:04 ` Jason Andryuk
2024-04-30 22:25   ` Jason Andryuk
2024-05-01 19:11     ` Dmitry Torokhov
2024-05-01  3:59 ` Peter Hutterer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024061700-barber-prong-643f@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jandryuk@gmail.com \
    --cc=jason.andryuk@amd.com \
    --cc=peter.hutterer@who-t.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.