mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "James McMechan" <James_McMechan@hotmail.com>
To: <linux-kernel@vger.kernel.org>
Cc: <user-mode-linux-devel-request@lists.sourceforge.net>
Subject: [PATCH] backport of fix for tmpfs oops from 2.6.0 final to 2.4.23
Date: Mon, 29 Dec 2003 22:09:03 -0800	[thread overview]
Message-ID: <BAY13-DAV8Hx5Th42jv0000d5a7@hotmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: oops-2-4-23.fix --]
[-- Type: application/octet-stream, Size: 1096 bytes --]

Ok, here is a backport of the patch that went into 2.6.0
to fix the problem where the tmpfs/shmfs dcache could be
oopsed by any user doing a dirseek to offset 2.
This occurs because the when the seek is at the cursor
and then the cursor is deleted, the list_add_tail
tries to attach to the end of the list and gets the
old pointers (poisoned on 2.6) from the list_del.
This fix just deletes the cursor before going over the
list since it can not be a member of the list and should
not be counted, delete it before counting over the list.

--- linux-2.4.23/fs/readdir.c	2002-08-02 17:39:45.000000000 -0700
+++ build-2.4.23-skas/fs/readdir.c	2003-12-23 17:18:37.000000000 -0800
@@ -69,6 +69,7 @@
 			loff_t n = file->f_pos - 2;
 
 			spin_lock(&dcache_lock);
+			list_del(&cursor->d_child);
 			p = file->f_dentry->d_subdirs.next;
 			while (n && p != &file->f_dentry->d_subdirs) {
 				struct dentry *next;
@@ -77,7 +78,6 @@
 					n--;
 				p = p->next;
 			}
-			list_del(&cursor->d_child);
 			list_add_tail(&cursor->d_child, p);
 			spin_unlock(&dcache_lock);
 		}

                 reply	other threads:[~2003-12-30  6:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BAY13-DAV8Hx5Th42jv0000d5a7@hotmail.com \
    --to=james_mcmechan@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=user-mode-linux-devel-request@lists.sourceforge.net \
    /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®