public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alex Williamson <alex.williamson@hp.com>,
	Alex Chiang <achiang@hp.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
Date: Mon, 1 Oct 2012 16:51:52 -0700	[thread overview]
Message-ID: <20121001235152.GC15924@kroah.com> (raw)
In-Reply-To: <CAMuHMdW19BQti_EWdgynWwOZCuhTQO-tJbN9Q8gBnUcA=auEKg@mail.gmail.com>

On Sun, Sep 30, 2012 at 08:59:05PM +0200, Geert Uytterhoeven wrote:
> Hi Greg,
> 
> On Sun, Sep 30, 2012 at 4:49 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Sat, Sep 29, 2012 at 10:23:19PM +0200, Geert Uytterhoeven wrote:
> >> The warning check for duplicate sysfs entries can cause a buffer overflow
> >> when printing the warning, as strcat() doesn't check buffer sizes.
> >> Use strlcat() instead.
> >
> > As the comment said, we knew about this, but I have never seen it, do
> > you know of a way to trigger it?
> 
> I expected there would be a check somewhere else in the code, so we can
> never overflow here. But I did manage to overflow the buffer by having a real
> long name (4060 characters) in a conflicting mfd_cell.
> There may be other ways.
> 
> I don't know how likely it is to trigger in a real world scenario. Is
> there a limit
> on the depth of sysfs? Or can it go unbounded, e.g. by cascading USB hubs?

You can only go so deep with USB hubs (5 I think.)

> >> Cc: stable@vger.kernel.org
> >
> > Given that I don't know of any way to actually hit this problem, is it
> > really needed for older kernel releases?
> 
> That's up to you to decide...

Ok, I'll queue this up after 3.7-rc1 is out, thanks.

greg k-h

      reply	other threads:[~2012-10-01 23:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29 20:23 [PATCH] sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat() Geert Uytterhoeven
2012-09-30 14:49 ` Greg Kroah-Hartman
2012-09-30 18:59   ` Geert Uytterhoeven
2012-10-01 23:51     ` Greg Kroah-Hartman [this message]

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=20121001235152.GC15924@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=achiang@hp.com \
    --cc=alex.williamson@hp.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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