linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Nuno Santos <nsantos@edigma.com>
Cc: David Herrmann <dh.herrmann@googlemail.com>, linux-input@vger.kernel.org
Subject: Re: Interacting with a input kernel driver from user space
Date: Wed, 16 Nov 2011 11:27:49 -0800	[thread overview]
Message-ID: <20111116192749.GA26909@core.coreip.homeip.net> (raw)
In-Reply-To: <4EC3F2AD.5080505@edigma.com>

Hi Nuno,

On Wed, Nov 16, 2011 at 05:28:13PM +0000, Nuno Santos wrote:
>     Why? I thought this thing is an input device? Why does an
> application have to modify a running device? Is this modification
> local to the application<->device interface or does it also affect
> all other running applications that use this device? If it is a
> configuration value to put the device into a different state or
> similar, then you can use a sysfs attribute. The user can change
> this with "echo <value> >/sys/class/input/inputX/<attribute>"

Any chance you could use some sane quoting style? It is almost
impossible to dechipher where someone else's mail stops and your reply
starts.

> 
> I'm already with working examples of ATTRIB in my driver project.
> The thing is that I have random kernel panics when I try to read
> from the attribute. This is my attribute code:
> 
> static ssize_t usbtouchscreen_get_state(struct device *dev, struct
> device_attribute *attr, char *buf)
> {
>     int count=0;
>     struct usbtouch_usb *usbtouch = dev_get_drvdata(dev);
>     struct dpx_priv *priv = usbtouch->priv;
> 
>     printk(KERN_INFO "state length: %d",sizeof(DPX_DEVICE_STATE));
> // size = 43196 bytes

So it is probably 39K more than sysfs attribute can handle.

> 
>     memcpy(buf,(void*)&priv->context->State,sizeof(DPX_DEVICE_STATE));

and you are smashing kernel stack here.

-- 
Dmitry

  reply	other threads:[~2011-11-16 19:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 12:24 Interacting with a input kernel driver from user space Nuno Santos
2011-11-14 15:37 ` David Herrmann
2011-11-14 16:00   ` Nuno Santos
2011-11-14 16:09     ` David Herrmann
2011-11-14 16:31       ` Nuno Santos
2011-11-14 16:58         ` David Herrmann
2011-11-14 18:24           ` Nuno Santos
2011-11-14 18:57             ` Dmitry Torokhov
2011-11-14 23:17               ` Oliver Neukum
2011-11-14 23:34                 ` Dmitry Torokhov
2011-11-15  9:41                   ` Nuno Santos
2011-11-15  9:38                 ` Nuno Santos
2011-11-15  9:35               ` Nuno Santos
2011-11-15 18:23                 ` Dmitry Torokhov
2011-11-15 18:41                   ` Nuno Santos
2011-11-15 19:20                     ` Dmitry Torokhov
2011-11-14 17:13         ` Dmitry Torokhov
2011-11-15 10:32           ` Henrik Rydberg
2011-11-15 10:40             ` Nuno Santos
2011-11-15 19:07             ` Chase Douglas
2011-11-16 10:25               ` Nuno Santos
2011-11-16 10:28                 ` Nuno Santos
2011-11-16 17:28       ` Nuno Santos
2011-11-16 19:27         ` Dmitry Torokhov [this message]
2011-11-17 15:39           ` Nuno Santos
2011-11-17 16:58           ` Nuno Santos

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=20111116192749.GA26909@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=dh.herrmann@googlemail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=nsantos@edigma.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).