[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWhA2xxKKEmmobZDDKGnWNfO4xDb6m6gM16CCFX-1UyTQ@mail.gmail.com>
Date: Wed, 31 Jul 2019 11:27:02 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Cc: Kishon Vijay Abraham I <kishon@...com>,
Pavel Machek <pavel@...x.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"
Hi Shimoda-san,
On Wed, Jul 31, 2019 at 11:04 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com> wrote:
> Since the role_store() uses strncmp(), it's possible to refer
> out-of-memory if the sysfs data size is smaller than strlen("host").
> This patch fixes it by using sysfs_streq() instead of strncmp().
>
> Reported-by: Pavel Machek <pavel@...x.de>
> Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap")
> Cc: <stable@...r.kernel.org> # v4.10+
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
> ---
> Just a record. The role_store() doesn't need to check the count because
> the sysfs_streq() checks the first argument is NULL or not.
Is that wat you mean? sysfs_streq() doesn't seem to check for NULL pointers.
Isn't the real reason that sysfs (kernfs) guarantees that the passed buffer
is NUL-terminated?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists