linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Hemment <markhe@veritas.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] Wrong assumption in set_bh_page()
Date: Sun, 17 Aug 2003 17:40:54 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.33.0308171729130.1203-100000@localhost.localdomain> (raw)

  set_bh_page() assumes page_address() will always return NULL for a
highmem page.  This assumption is wrong - the highmem page could be
kmap()ped.

  Luckily, no code I've looked at assumes that b_data contains a _pure_
offset for a highmem page, but this is a bug waiting to happen.

  Patch is against 2.4.21-rc1.

Mark


diff -urN linux-2.4.21-rc1/fs/buffer.c linux-2.4.21-rc1-bh/fs/buffer.c
--- linux-2.4.21-rc1/fs/buffer.c	2003-08-17 15:55:40.000000000 +0100
+++ linux-2.4.21-rc1-bh/fs/buffer.c	2003-08-17 18:15:13.000000000 +0100
@@ -1231,10 +1231,11 @@
 	if (offset >= PAGE_SIZE)
 		BUG();

-	/*
-	 * page_address will return NULL anyways for highmem pages
-	 */
-	bh->b_data = page_address(page) + offset;
+	if (PageHighMem(page)) {
+		bh->b_data = (char *)offset;
+	} else {
+		bh->b_data = page_address(page) + offset;
+	}
 	bh->b_page = page;
 }
 EXPORT_SYMBOL(set_bh_page);




                 reply	other threads:[~2003-08-17 16:39 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=Pine.LNX.4.33.0308171729130.1203-100000@localhost.localdomain \
    --to=markhe@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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;
as well as URLs for NNTP newsgroup(s).