From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch v2] Input: force feedback - potential integer wrap in input_ff_create()
Date: Wed, 12 Oct 2011 21:36:07 -0700 [thread overview]
Message-ID: <20111013043607.GC11763@core.coreip.homeip.net> (raw)
In-Reply-To: <20111011211949.GB30887@longonot.mountain>
On Wed, Oct 12, 2011 at 12:19:49AM +0300, Dan Carpenter wrote:
> The problem here is that max_effects can wrap on 32 bits systems.
> We'd allocate a smaller amount of data than sizeof(struct ff_device).
> The call to kcalloc() on the next line would fail but it would write
> the NULL return outside of the memory we just allocated causing data
> corruption.
>
> The call path is that uinput_setup_device() get ->ff_effects_max from
> the user and sets the value in the ->private_data struct. From there
> it is:
> -> uinput_ioctl_handler()
> -> uinput_create_device()
> -> input_ff_create(dev, udev->ff_effects_max);
>
> I've also changed ff_effects_max so it's an unsigned int instead of
> a signed int as a cleanup.
Applied (adding a temp to hold the size), thanks.
--
Dmitry
next prev parent reply other threads:[~2011-10-13 4:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-09 16:25 [patch] Input: force feedback - potential integer wrap in input_ff_create() Dan Carpenter
2011-10-10 5:08 ` Dmitry Torokhov
2011-10-10 20:48 ` Dan Carpenter
2011-10-11 21:19 ` [patch v2] " Dan Carpenter
2011-10-13 4:36 ` Dmitry Torokhov [this message]
2011-10-15 14:24 ` walter harms
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=20111013043607.GC11763@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@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 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).