public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: GuanJun He <heguanbo@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c
Date: Thu, 22 Apr 2010 00:27:05 +0800	[thread overview]
Message-ID: <20100421162704.GB13861@hack> (raw)
In-Reply-To: <z2xccf7f6161004210409n817c86eckdb72d9cdb31e3be@mail.gmail.com>

On Wed, Apr 21, 2010 at 07:09:42PM +0800, GuanJun He wrote:
>fix badness in fs/proc/generic.c,  Bug 15589 -  2.6.34-rc1: Badness at
>fs/proc/generic.c:316
>
>Signed-off-by: Guanjun He <heguanbo@gmail.com>

NACK.

The callers of __xlate_proc_name() all hold proc_subdir_lock.

>
>---
>diff -Nupr linux-2.6.34-rc1.orig/fs/proc/generic.c
>linux-2.6.34-rc1/fs/proc/generic.c
>--- linux-2.6.34-rc1.orig/fs/proc/generic.c     2010-03-09
>02:45:44.000000000 +0800
>+++ linux-2.6.34-rc1/fs/proc/generic.c  2010-04-21 19:02:49.000000000 +0800
>@@ -297,11 +297,13 @@ static int __xlate_proc_name(const char
>        const char              *cp = name, *next;
>        struct proc_dir_entry   *de;
>        int                     len;
>+       int                     rtn = 0;
>
>        de = *ret;
>        if (!de)
>                de = &proc_root;
>
>+       spin_lock(&proc_subdir_lock);
>        while (1) {
>                next = strchr(cp, '/');
>                if (!next)
>@@ -313,14 +315,17 @@ static int __xlate_proc_name(const char
>                                break;
>                }
>                if (!de) {
>-                       WARN(1, "name '%s'\n", name);
>-                       return -ENOENT;
>+                       WARN(1, "name \"%s\"\n", name);
>+                       rtn = -ENOENT;
>+                       goto out;
>                }
>                cp += len + 1;
>        }
>        *residual = cp;
>        *ret = de;
>-       return 0;
>+out:
>+       spin_unlock(&proc_subdir_lock);
>+       return rtn;
> }
>
> static int xlate_proc_name(const char *name, struct proc_dir_entry **ret,
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

-- 
Live like a child, think like the god.
 

  reply	other threads:[~2010-04-21 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 11:09 [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c GuanJun He
2010-04-21 16:27 ` Américo Wang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-04-22  4:10 GuanJun He
2010-04-22  6:09 ` Alexey Dobriyan

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=20100421162704.GB13861@hack \
    --to=xiyou.wangcong@gmail.com \
    --cc=heguanbo@gmail.com \
    --cc=linux-kernel@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