From: Bjorn Helgaas <helgaas@kernel.org>
To: Nicolai Stange <nstange@suse.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Adrian Salido <salidoa@google.com>,
Sasha Levin <sasha.levin@oracle.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 3/3] driver core: platform: Don't read past the end of "driver_override" buffer
Date: Mon, 25 Sep 2017 18:50:00 -0500 [thread overview]
Message-ID: <20170925235000.GI15970@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20170911074542.16777-4-nstange@suse.de>
Greg, I assume you'll deal with this one? Just let me know if I
should do something with it.
On Mon, Sep 11, 2017 at 09:45:42AM +0200, Nicolai Stange wrote:
> When printing the driver_override parameter when it is 4095 and 4094 bytes
> long, the printing code would access invalid memory because we need count+1
> bytes for printing.
>
> Reject driver_override values of these lengths in driver_override_store().
>
> This is in close analogy to commit 4efe874aace5 ("PCI: Don't read past the
> end of sysfs "driver_override" buffer") from Sasha Levin.
>
> Fixes: 3d713e0e382e ("driver core: platform: add device binding path 'driver_override'")
> Cc: stable@vger.kernel.org # v3.17+
> Signed-off-by: Nicolai Stange <nstange@suse.de>
> ---
> drivers/base/platform.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index d1bd99271066..9045c5f3734e 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -868,7 +868,8 @@ static ssize_t driver_override_store(struct device *dev,
> struct platform_device *pdev = to_platform_device(dev);
> char *driver_override, *old, *cp;
>
> - if (count > PATH_MAX)
> + /* We need to keep extra room for a newline */
> + if (count >= (PAGE_SIZE - 1))
> return -EINVAL;
>
> driver_override = kstrndup(buf, count, GFP_KERNEL);
> --
> 2.13.5
>
next prev parent reply other threads:[~2017-09-25 23:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 7:45 [PATCH 0/3] make PCI's and platform's driver_override_store()/show() converge Nicolai Stange
2017-09-11 7:45 ` [PATCH 1/3] PCI: fix race condition with driver_override Nicolai Stange
2017-09-25 23:44 ` Bjorn Helgaas
2017-09-11 7:45 ` [PATCH 2/3] PCI: don't use snprintf() in driver_override_show() Nicolai Stange
2017-09-11 11:55 ` Greg Kroah-Hartman
2017-09-25 23:48 ` Bjorn Helgaas
2017-09-26 6:36 ` Nicolai Stange
2017-09-26 20:02 ` Bjorn Helgaas
2017-09-11 7:45 ` [PATCH 3/3] driver core: platform: Don't read past the end of "driver_override" buffer Nicolai Stange
2017-09-25 23:50 ` Bjorn Helgaas [this message]
2017-09-26 6:51 ` Greg Kroah-Hartman
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=20170925235000.GI15970@bhelgaas-glaptop.roam.corp.google.com \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=nstange@suse.de \
--cc=salidoa@google.com \
--cc=sasha.levin@oracle.com \
/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®