mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Arun KS <arunks.linux@gmail.com>
Cc: viro@zeniv.linux.org.uk, matthew@wil.cx, bfields@fieldses.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	vinayak menon <vinayakm.list@gmail.com>,
	Nagachandra P <nagachandra@gmail.com>,
	Vikram MP <mp.vikram@gmail.com>
Subject: Re: Seq File: Return error if d_path fails
Date: Mon, 12 Aug 2013 14:49:43 -0700	[thread overview]
Message-ID: <20130812144943.a09d6251bc20f8c3d0a6e8d8@linux-foundation.org> (raw)
In-Reply-To: <CAKZGPANjwYxoAtO068UN1iMuMZPtkbjACz8C3yHjZMr5BkM63A@mail.gmail.com>

On Thu, 8 Aug 2013 19:03:31 +0530 Arun KS <arunks.linux@gmail.com> wrote:

> >From 2558382c8a030f7261e47977ac62412cd78e6d38 Mon Sep 17 00:00:00 2001
> From: Arun KS <arun.ks@broadcom.com>
> Date: Thu, 8 Aug 2013 18:23:04 +0530
> Subject: Seq File: Return error if d_path fails
> 
> Return error if d_path fails in seq_path funciton. If we do not return
> from here,
> seq_commit sets seq_file state as overflow. And this continues in a
> loop utill we
> increase the size of seq buf beyond KMALLOC_MAX_SIZE.
> 
> ...
>
> --- a/fs/seq_file.c
> +++ b/fs/seq_file.c
> @@ -471,7 +471,8 @@ int seq_path(struct seq_file *m, const struct path
> *path, const char *esc)
>                         char *end = mangle_path(buf, p, esc);
>                         if (end)
>                                 res = end - buf;
> -               }
> +               } else
> +                       return PTR_ERR(p);
>         }
>         seq_commit(m, res);

hm, does that really fix the bug?  Isn't the core problem the word "or":

/**
 * seq_commit - commit data to the buffer
 * @m: the seq_file handle
 * @num: the number of bytes to commit
 *
 * Commit @num bytes of data written to a buffer previously acquired
 * by seq_buf_get.  To signal an error condition, or that the data
                                                  ^^
 * didn't fit in the available space, pass a negative @num value.
 */

seq_path()/seq_commit() is treating a d_path() failure as an overflow
condition, but it isn't.


  reply	other threads:[~2013-08-12 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 13:33 Arun KS
2013-08-12 21:49 ` Andrew Morton [this message]
2013-08-19  6:50   ` Arun KS

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=20130812144943.a09d6251bc20f8c3d0a6e8d8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arunks.linux@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=mp.vikram@gmail.com \
    --cc=nagachandra@gmail.com \
    --cc=vinayakm.list@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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®