mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Hugh Dickins <hugh@veritas.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix missing unlock_page in mm/rmap.c
Date: Sat, 18 Sep 2004 20:53:04 +1000	[thread overview]
Message-ID: <414C1390.6050802@yahoo.com.au> (raw)

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

Please apply.

[-- Attachment #2: mm-rmap-missing-unlock.patch --]
[-- Type: text/x-patch, Size: 1068 bytes --]



A required unlock_page will be missed in a very rare (but possible) race
condition. Acked by Hugh, who says:

	It'll be hard to hit because of the additional page_mapped test above,
	with truncate unmapping ptes from mms before it advances to removing
	pages from cache; but nothing to prevent it happening.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Hugh Dickins <hugh@veritas.com>



---

 linux-2.6-npiggin/mm/rmap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -puN mm/rmap.c~mm-rmap-missing-unlock mm/rmap.c
--- linux-2.6/mm/rmap.c~mm-rmap-missing-unlock	2004-09-18 20:46:16.000000000 +1000
+++ linux-2.6-npiggin/mm/rmap.c	2004-09-18 20:46:41.000000000 +1000
@@ -406,8 +406,9 @@ int page_referenced(struct page *page, i
 			referenced += page_referenced_file(page);
 		else if (TestSetPageLocked(page))
 			referenced++;
-		else if (page->mapping) {
-			referenced += page_referenced_file(page);
+		else {
+			if (page->mapping)
+				referenced += page_referenced_file(page);
 			unlock_page(page);
 		}
 	}

_

             reply	other threads:[~2004-09-18 10:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-18 10:53 Nick Piggin [this message]
2004-09-18 11:41 ` William Lee Irwin III

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=414C1390.6050802@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®