public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Grzegorz Nosek <grzegorz.nosek@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] race condition in procfs
Date: Tue, 29 Nov 2005 08:17:22 +0100	[thread overview]
Message-ID: <121a28810511282317j47a90f6t@mail.gmail.com> (raw)

Hello,

I found a race condition in procfs on SMP systems. The result is an
oops in processes like pidof. Apparently ->proc_read() gets passed a
potentially NULL pointer. The following micro-patch seems to fix it.

Best regards,
 Grzegorz Nosek

--- linux-2.6/fs/proc/base.c.orig 2005-11-25 00:07:43.000000000 +0100
+++ linux-2.6/fs/proc/base.c      2005-11-28 11:44:11.000000000 +0100
@@ -718,6 +718,9 @@
       ssize_t length;
       struct task_struct *task = proc_task(inode);

+       if (!task)
+               return -ENOENT;
+
       if (count > PROC_BLOCK_SIZE)
               count = PROC_BLOCK_SIZE;
       if (!(page = __get_free_page(GFP_KERNEL)))

             reply	other threads:[~2005-11-29  7:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-29  7:17 Grzegorz Nosek [this message]
2005-11-29  8:09 ` [PATCH] race condition in procfs Andrew Morton
2005-11-29  8:38   ` Grzegorz Nosek
2005-11-29 13:25     ` Grzegorz Nosek
2005-11-29 14:04       ` Grzegorz Nosek
2005-11-29 14:28         ` Steven Rostedt
2005-11-29 14:39           ` Grzegorz Nosek
2005-11-29 14:49             ` Steven Rostedt
2005-11-30 14:41               ` Grzegorz Nosek
2005-11-30 15:14                 ` Steven Rostedt
2005-11-30 15:29                   ` Grzegorz Nosek
2005-11-30 16:25                     ` Steven Rostedt
2005-11-30 17:23                       ` Grzegorz Nosek
2005-12-01 20:38                         ` Grzegorz Nosek
2005-11-29 15:22   ` [PATCH] shrinks dentry struct Eric Dumazet
2005-11-30  2:06     ` Paul Jackson
2005-11-30  2:14       ` Andrew Morton
2005-11-30  2:43         ` Paul Jackson
2005-11-30  6:56         ` Hugh Dickins
2005-12-03  1:15     ` [PATCH] remove unused blkp field in percpu_data Eric Dumazet
2005-12-13 18:03     ` [PATCH] shrinks dentry struct Paul E. McKenney
2005-12-13 18:24       ` Eric Dumazet

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=121a28810511282317j47a90f6t@mail.gmail.com \
    --to=grzegorz.nosek@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