From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Rob Herring <robh@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Lunn <andrew@lunn.ch>,
Grant Likely <grant.likely@secretlab.ca>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] of: do not leak console options
Date: Sun, 27 Aug 2017 17:01:48 +0900 [thread overview]
Message-ID: <20170827080148.GB581@tigerII.localdomain> (raw)
In-Reply-To: <20170827071910.GA581@tigerII.localdomain>
On (08/27/17 16:19), Sergey Senozhatsky wrote:
[..]
> int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
> char **options)
> {
> if (strncmp(p, "mmio,", 5) == 0) {
> *iotype = UPIO_MEM;
> p += 5;
> } else if (strncmp(p, "mmio16,", 7) == 0) {
> *iotype = UPIO_MEM16;
> p += 7;
> } else if (strncmp(p, "mmio32,", 7) == 0) {
> *iotype = UPIO_MEM32;
> p += 7;
> } else if (strncmp(p, "mmio32be,", 9) == 0) {
> *iotype = UPIO_MEM32BE;
> p += 9;
> } else if (strncmp(p, "mmio32native,", 13) == 0) {
> *iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
> UPIO_MEM32BE : UPIO_MEM32;
> p += 13;
> } else if (strncmp(p, "io,", 3) == 0) {
> *iotype = UPIO_PORT;
> p += 3;
> } else if (strncmp(p, "0x", 2) == 0) {
> *iotype = UPIO_MEM;
> } else {
> return -EINVAL;
> }
>
> /*
> * Before you replace it with kstrtoull(), think about options separator
> * (',') it will not tolerate
> */
> *addr = simple_strtoull(p, NULL, 0);
> p = strchr(p, ',');
> if (p)
> p++;
>
> *options = p;
> return 0;
> }
>
> that's just one example I found after a very quick grepping. may be
> there are other control paths that can change ->options.
well, obviously, it doesn't change the options per se, but it sort of
demonstrates that _probably_ somewhere ->options could be changed. on
the other hand, that ->options = ->options + X makes it rather hard
to kfree() the ->options. well, we never kfree() the ->options anyway,
as far as I can tell...
-ss
next prev parent reply other threads:[~2017-08-27 8:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 17:36 [PATCH] of: do not leak console options Sergey Senozhatsky
[not found] ` <20170825173647.1004-1-sergey.senozhatsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-25 22:37 ` Rob Herring
2017-08-27 7:19 ` Sergey Senozhatsky
2017-08-27 8:01 ` Sergey Senozhatsky [this message]
2017-09-06 12:40 ` Petr Mladek
2017-09-06 13:29 ` Sergey Senozhatsky
2017-09-06 15:27 ` Rob Herring
2017-09-07 9:57 ` Sergey Senozhatsky
[not found] ` <CAL_JsqKRPGFUzLVbyU_=GZzsy87Mc6x43DtmUQ758-nrZZF_jA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-26 6:31 ` Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2017-09-26 6:25 Sergey Senozhatsky
2017-10-03 7:20 ` Petr Mladek
[not found] ` <20171003072007.GB9706-KsEp0d+Q8qECVLCxKZUutA@public.gmane.org>
2017-10-13 19:48 ` Geert Uytterhoeven
[not found] ` <CAMuHMdXL1v20PvP2=jv_YdNgk0afkrgfZf1b21LrTWXGoPDMhg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-13 20:44 ` Rob Herring
2017-10-12 17:24 ` Rob Herring
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=20170827080148.GB581@tigerII.localdomain \
--to=sergey.senozhatsky@gmail.com \
--cc=andrew@lunn.ch \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=robh@kernel.org \
--cc=rostedt@goodmis.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