From: Benson Leung <bleung@chromium.org>
To: rydberg@euromail.se, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com
Cc: bleung@chromium.org, olofj@chromium.org, djkurtz@chromium.org,
dudl@cypress.com
Subject: [PATCH 3/4] Input: cyapa - Allow filename to be changed in update_fw
Date: Wed, 13 Mar 2013 16:50:50 -0700 [thread overview]
Message-ID: <1363218651-22457-4-git-send-email-bleung@chromium.org> (raw)
In-Reply-To: <1363218651-22457-1-git-send-email-bleung@chromium.org>
Allow the name of the designated firmware to be passed as the
argument to update_fw from user space. This will allow user space
to specify which firmware to load.
Signed-off-by: Benson Leung <bleung@chromium.org>
---
drivers/input/mouse/cyapa.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index e622c25..51e9d44 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -1180,9 +1180,16 @@ static ssize_t cyapa_update_fw_store(struct device *dev,
const char *buf, size_t count)
{
struct cyapa *cyapa = dev_get_drvdata(dev);
- const char *fw_name = CYAPA_FW_NAME;
+ const char *fw_name;
int ret;
+ /* Do not allow paths that step out of /lib/firmware */
+ if (strstr(buf, "../") != NULL)
+ return -EINVAL;
+
+ fw_name = !strncmp(buf, "1", count) ||
+ !strncmp(buf, "1\n", count) ? CYAPA_FW_NAME : buf;
+
ret = cyapa_firmware(cyapa, fw_name);
if (ret)
dev_err(dev, "firmware update failed, %d\n", ret);
--
1.8.1.3
next prev parent reply other threads:[~2013-03-13 23:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 23:50 [PATCH 0/4] Input: cyapa - Add firmware update feature Benson Leung
2013-03-13 23:50 ` [PATCH 1/4] Input: cyapa - Move common initialization to cyapa_detect Benson Leung
2013-03-16 19:40 ` Henrik Rydberg
2013-03-13 23:50 ` [PATCH 2/4] Input: cyapa - Firmware update via request firmware Benson Leung
2013-03-14 0:38 ` Dmitry Torokhov
2013-03-16 20:00 ` Henrik Rydberg
2013-03-19 0:37 ` Benson Leung
2013-03-19 21:52 ` Henrik Rydberg
2013-03-13 23:50 ` Benson Leung [this message]
2013-03-13 23:50 ` [PATCH 4/4] Input: cyapa - Add sysfs attrs for product_id and fw version Benson Leung
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=1363218651-22457-4-git-send-email-bleung@chromium.org \
--to=bleung@chromium.org \
--cc=djkurtz@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dudl@cypress.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olofj@chromium.org \
--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®