All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: linux-next: Tree for July 30
Date: Thu, 31 Jul 2008 15:42:07 -0400	[thread overview]
Message-ID: <20080731194207.GA12233@anvil.corenet.prv> (raw)
In-Reply-To: <20080731151625.ZZRA012@mailhub.coreip.homeip.net>

On Thu, Jul 31, 2008 at 03:24:02PM -0400, Dmitry Torokhov wrote:
> On Thu, Jul 31, 2008 at 12:10:40PM -0700, Linus Torvalds wrote:
> > 
> > Sorry, but you're simply wrong.
> > 
> > If somebody has the commit that broke user space, that commit will be 
> > _reverted_ unless it's fixed. It's that simple. The rules are: we don't 
> > knowingly break user space. 
> >
> 
> We have 3 options now:
> 
> 1. Never change KEY_MAX and dont add any new key definitions.
> 2. Introduce a new ioctl and have all wel-behaving programs rewritten
>    to support it.
> 3. Fix userspace driver (patch is available).
> 
> Gioventhe fact that I wanted that change to go when .28 opens and it
> will really hit users in 6+ months I'd still like to have 3.
>  

I guess we could do something like the below, but it is soooo ugly...

Input: paper over a bug in Synaptics X driver

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/evdev.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 2d65411..c78a63b 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -736,8 +736,10 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 			if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) {
 
 				unsigned long *bits;
+				unsigned int buf_len = _IOC_SIZE(cmd);
 				int len;
 
+
 				switch (_IOC_NR(cmd) & EV_MAX) {
 
 				case      0: bits = dev->evbit;  len = EV_MAX;  break;
@@ -751,7 +753,17 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 				case EV_SW:  bits = dev->swbit;  len = SW_MAX;  break;
 				default: return -EINVAL;
 				}
-				return bits_to_user(bits, len, _IOC_SIZE(cmd), p, compat_mode);
+
+				if ((_IOC_NR(cmd) & EV_MAX) == EV_KEY && buf_len == 0x1ff) {
+					printk(KERN_WARNING
+						"evdev.c(EVIOCGBIT): Detected suspicious "
+						"buffer size 0x1ff, limiting output to 64 "
+						"bytes. Make sure you are not using "
+						"EVIOCGBIT(EV_KEY, KEY_MAX)\n");
+					buf_len = 64; 
+				}
+
+				return bits_to_user(bits, len, buf_len, p, compat_mode);
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0)))

  reply	other threads:[~2008-07-31 19:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30  7:06 linux-next: Tree for July 30 Stephen Rothwell
2008-07-30 14:47 ` Takashi Iwai
2008-07-31  6:10 ` Andrew Morton
2008-07-31 14:07   ` Dmitry Torokhov
2008-07-31 15:36     ` Bartlomiej Zolnierkiewicz
2008-07-31 15:56       ` Dmitry Torokhov
2008-07-31 17:44         ` Andrew Morton
2008-07-31 18:17           ` Dmitry Torokhov
2008-07-31 18:26             ` Andrew Morton
2008-07-31 18:34               ` Dmitry Torokhov
2008-07-31 18:55                 ` Andrew Morton
2008-07-31 19:03                   ` Dmitry Torokhov
2008-07-31 19:20                   ` Hugh Dickins
2008-07-31 18:48             ` Rafael J. Wysocki
2008-07-31 18:54               ` Dmitry Torokhov
2008-07-31 19:10                 ` Linus Torvalds
2008-07-31 19:24                   ` Dmitry Torokhov
2008-07-31 19:42                     ` Dmitry Torokhov [this message]
2008-07-31 20:10                       ` Andrew Morton
2008-08-07 18:11                         ` Dmitry Torokhov
2008-08-07 18:50                           ` Andrew Morton
2008-08-07 19:06                             ` Dmitry Torokhov
2008-08-07 18:55                           ` Rafael J. Wysocki
2008-08-01 19:12                       ` Linus Torvalds
2008-08-01 19:23                         ` Dmitry Torokhov
2008-08-01 19:26                           ` Linus Torvalds
2008-07-31 19:44                     ` Linus Torvalds
2008-07-31 20:05                       ` Dmitry Torokhov
2008-07-31 20:16                         ` Linus Torvalds
2008-07-31 20:28                           ` Linus Torvalds
2008-07-31 20:39                             ` Dmitry Torokhov
2008-07-31 20:28                           ` Dmitry Torokhov
2008-07-31 19:13                 ` Andrew Morton
2008-07-31 19:57                 ` Rafael J. Wysocki
2008-08-04  5:47   ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2009-07-30  8:21 Stephen Rothwell
2010-07-30  5:10 Stephen Rothwell
2012-07-30  4:02 Stephen Rothwell

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=20080731194207.GA12233@anvil.corenet.prv \
    --to=dmitry.torokhov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bzolnier@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.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.