From: Jiri Kosina <jkosina@suse.cz>
To: Rafi Rubin <rafi@seas.upenn.edu>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
micki@n-trig.com, rydberg@euromail.se, chatty@enac.fr,
peter.hutterer@who-t.net
Subject: Re: [PATCH 1/2] HID: ntrig don't dereference unclaimed hidinput
Date: Sat, 26 Feb 2011 11:58:47 +0100 (CET) [thread overview]
Message-ID: <alpine.LNX.2.00.1102261156480.2160@pobox.suse.cz> (raw)
In-Reply-To: <1298610932-21957-1-git-send-email-rafi@seas.upenn.edu>
On Fri, 25 Feb 2011, Rafi Rubin wrote:
> Moved the claimed input check before dereferencing field->hidinput to
> fix a reported invalid deference bug.
>
> Switched to a goto instead of an extra indent for most of the function.
>
> Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
> ---
> Peter Hutterer reported seeing ntrig_event called when field->hidinput
> is NULL.
>
> Seems like a reasonable opportunity to adjust the whitespace a bit.
Hi Rafi,
thanks for the fix. Even though it's obvious in this case what the actual
fix is, I'd prefer to have it separate from the other cleanup changes ...
> ---
> drivers/hid/hid-ntrig.c | 466 ++++++++++++++++++++++++-----------------------
> 1 files changed, 236 insertions(+), 230 deletions(-)
>
> diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
> index beb4034..616f091 100644
> --- a/drivers/hid/hid-ntrig.c
> +++ b/drivers/hid/hid-ntrig.c
> @@ -539,277 +539,283 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
> static int ntrig_event (struct hid_device *hid, struct hid_field *field,
> struct hid_usage *usage, __s32 value)
> {
> - struct input_dev *input = field->hidinput->input;
> struct ntrig_data *nd = hid_get_drvdata(hid);
> + struct input_dev *input;
> +
> + /* Skip processing if not a claimed input */
> + if (!(hid->claimed & HID_CLAIMED_INPUT))
> + goto not_claimed_input;
Makes me wonder why ntrig would be the only driver needing this ...
perhaps pushing it up the stack would make more sense?
--
Jiri Kosina
SUSE Labs, Novell Inc.
prev parent reply other threads:[~2011-02-26 10:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-25 5:15 Rafi Rubin
2011-02-25 5:15 ` [PATCH 2/2] HID: ntrig mapping more firmware id bits Rafi Rubin
2011-02-28 9:07 ` Jiri Kosina
2011-02-26 7:36 ` [PATCH 1/2] HID: ntrig don't dereference unclaimed hidinput Henrik Rydberg
2011-02-26 7:50 ` Rafi Rubin
2011-02-27 22:17 ` Peter Hutterer
2011-02-26 10:58 ` Jiri Kosina [this message]
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=alpine.LNX.2.00.1102261156480.2160@pobox.suse.cz \
--to=jkosina@suse.cz \
--cc=chatty@enac.fr \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=micki@n-trig.com \
--cc=peter.hutterer@who-t.net \
--cc=rafi@seas.upenn.edu \
--cc=rydberg@euromail.se \
/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®