From: Lee Jones <lee.jones@linaro.org>
To: gregkh@linuxfoundation.org, arnd@arndb.de
Cc: linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
Rodolfo Giometti <giometti@enneenne.com>,
"Eurotech S.p.A" <info@eurotech.it>,
David Laight <David.Laight@aculab.com>,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH v2 1/2] misc: c2port: core: Make copying name from userspace more secure
Date: Mon, 2 Nov 2020 14:20:00 +0000 [thread overview]
Message-ID: <20201102142001.560490-1-lee.jones@linaro.org> (raw)
Currently the 'c2dev' device data is not initialised when it's
allocated. There maybe an issue when using strncpy() to populate the
'name' attribute since a NUL terminator may not be provided in all
use-cases. To prevent such a failing, let's ensure the 'c2dev'
device data area is fully zeroed out on allocation.
Cc: Rodolfo Giometti <giometti@enneenne.com>
Cc: "Eurotech S.p.A" <info@eurotech.it>
Cc: David Laight <David.Laight@aculab.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/misc/c2port/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index 80d87e8a0bea9..fb9a1b49ff6de 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -899,7 +899,7 @@ struct c2port_device *c2port_device_register(char *name,
unlikely(!ops->c2d_get) || unlikely(!ops->c2d_set))
return ERR_PTR(-EINVAL);
- c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL);
+ c2dev = kzalloc(sizeof(struct c2port_device), GFP_KERNEL);
if (unlikely(!c2dev))
return ERR_PTR(-ENOMEM);
--
2.25.1
next reply other threads:[~2020-11-02 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 14:20 Lee Jones [this message]
2020-11-02 14:20 ` [PATCH v2 2/2] misc: ocxl: config: Rename function attribute description Lee Jones
2020-11-02 14:29 ` Frederic Barrat
2020-11-03 0:01 ` Andrew Donnellan
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=20201102142001.560490-1-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=David.Laight@aculab.com \
--cc=arnd@arndb.de \
--cc=geert+renesas@glider.be \
--cc=giometti@enneenne.com \
--cc=gregkh@linuxfoundation.org \
--cc=info@eurotech.it \
--cc=linux-kernel@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).