mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aniroop Mathur <aniroop.mathur@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Aniroop Mathur <a.mathur@samsung.com>,
	SAMUEL SEQUEIRA <s.samuel@samsung.com>,
	Rahul Mahale <r.mahale@samsung.com>
Subject: Re: [PATCH] Input: evdev: fix queueing of SYN_DROPPED event for EVIOCG[type] IOCTL case
Date: Wed, 18 Jan 2017 22:17:12 +0530	[thread overview]
Message-ID: <CADYu30-Rrz4zTT1cvkPBjnfjJrjFa2BA-=enn0mfs5NrFiLHUg@mail.gmail.com> (raw)
In-Reply-To: <CADYu30-oJW68-6QRv56bPQJ-zGiohWmvpYgbOENPEzFnWDV4QQ@mail.gmail.com>

Dear Mr. Dmitry Torokhov,

Could you please update about this patch?
Thank you.

-- Aniroop Mathur


On Wed, Dec 14, 2016 at 11:54 PM, Aniroop Mathur
<aniroop.mathur@gmail.com> wrote:
> Hello Mr. Torokhov,
>
> Would you kindly update about this patch?
> Thanks!
>
> Best Regards,
> Aniroop Mathur
>
>
> On Fri, Nov 25, 2016 at 1:41 AM, Aniroop Mathur <a.mathur@samsung.com> wrote:
>> Currently, when EVIOCG[type] ioctl call is issued and bits_to_user fails,
>> then SYN_DROPPED event is inserted in the event queue always.
>>
>> However, it is not compulsory that some events are flushed out on every
>> EVIOCG[type] ioctl call like in case of empty event queue and in case when
>> EVIOCG[type] ioctl is issued for say A type of events but event queue does
>> not have any A type of events but some other type of events.
>>
>> Therefore, insert SYN_DROPPED event only when some events have been flushed
>> out from event queue plus bits_to_user fails.
>>
>> Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
>> ---
>>  drivers/input/evdev.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
>> index e9ae3d5..f8b295e 100644
>> --- a/drivers/input/evdev.c
>> +++ b/drivers/input/evdev.c
>> @@ -108,9 +108,11 @@ static bool __evdev_is_filtered(struct evdev_client *client,
>>  }
>>
>>  /* flush queued events of type @type, caller must hold client->buffer_lock */
>> -static void __evdev_flush_queue(struct evdev_client *client, unsigned int type)
>> +static unsigned int __evdev_flush_queue(struct evdev_client *client,
>> +                                       unsigned int type)
>>  {
>>         unsigned int i, head, num;
>> +       unsigned int drop_count = 0;
>>         unsigned int mask = client->bufsize - 1;
>>         bool is_report;
>>         struct input_event *ev;
>> @@ -129,9 +131,11 @@ static void __evdev_flush_queue(struct evdev_client *client, unsigned int type)
>>
>>                 if (ev->type == type) {
>>                         /* drop matched entry */
>> +                       drop_count++;
>>                         continue;
>>                 } else if (is_report && !num) {
>>                         /* drop empty SYN_REPORT groups */
>> +                       drop_count++;
>>                         continue;
>>                 } else if (head != i) {
>>                         /* move entry to fill the gap */
>> @@ -151,6 +155,7 @@ static void __evdev_flush_queue(struct evdev_client *client, unsigned int type)
>>         }
>>
>>         client->head = head;
>> +       return drop_count;
>>  }
>>
>>  static void __evdev_queue_syn_dropped(struct evdev_client *client)
>> @@ -920,6 +925,7 @@ static int evdev_handle_get_val(struct evdev_client *client,
>>         int ret;
>>         unsigned long *mem;
>>         size_t len;
>> +       unsigned int drop_count = 0;
>>
>>         len = BITS_TO_LONGS(maxbit) * sizeof(unsigned long);
>>         mem = kmalloc(len, GFP_KERNEL);
>> @@ -933,12 +939,12 @@ static int evdev_handle_get_val(struct evdev_client *client,
>>
>>         spin_unlock(&dev->event_lock);
>>
>> -       __evdev_flush_queue(client, type);
>> +       drop_count = __evdev_flush_queue(client, type);
>>
>>         spin_unlock_irq(&client->buffer_lock);
>>
>>         ret = bits_to_user(mem, maxbit, maxlen, p, compat);
>> -       if (ret < 0)
>> +       if (ret < 0 && drop_count > 0)
>>                 evdev_queue_syn_dropped(client);
>>
>>         kfree(mem);
>> --
>> 2.6.2
>>

  reply	other threads:[~2017-01-18 16:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 20:11 Aniroop Mathur
2016-12-14 18:24 ` Aniroop Mathur
2017-01-18 16:47   ` Aniroop Mathur [this message]
2017-01-22 10:45 ` David Herrmann
     [not found] ` <CGME20170122104616epcas1p399ffe5c203d6ea28418316154dea4087@epcas1p3.samsung.com>
2017-01-31 16:09   ` Aniroop Mathur
2017-02-23 11:36     ` David Herrmann
     [not found]     ` <CGME20170122104616epcas1p399ffe5c203d6ea28418316154dea4087@epcms5p2>
2017-02-24 11:36       ` Aniroop Mathur
2017-04-10 14:40         ` Aniroop Mathur
2017-02-01 13:32   ` Aniroop Mathur

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='CADYu30-Rrz4zTT1cvkPBjnfjJrjFa2BA-=enn0mfs5NrFiLHUg@mail.gmail.com' \
    --to=aniroop.mathur@gmail.com \
    --cc=a.mathur@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=r.mahale@samsung.com \
    --cc=s.samuel@samsung.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

all inboxes | Powered by JetHome®