public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: linux-fsdevel@vger.kernel.org,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] loop.c forgot a kmap
Date: Thu, 23 May 2002 23:20:25 -0400	[thread overview]
Message-ID: <20020523232024.A2917@redhat.com> (raw)

The patch below fixes a bug in loop.c that causes highmem systems 
to fail spectacularly when a page happens to be allocated in highmem 
by replacing the use of page_address with a kmap/kunmap sequence.  

		-ben
-- 
"You will be reincarnated as a toad; and you will be much happier."

:r ~/patches/v2.4.19-pre8-loop-kmap.diff
--- /md0/kernels/2.4/v2.4.19-pre8/drivers/block/loop.c	Wed May  8 13:19:02 2002
+++ v2.4.19-pre8/drivers/block/loop.c	Thu May 23 22:44:09 2002
@@ -199,9 +199,9 @@
 		page = grab_cache_page(mapping, index);
 		if (!page)
 			goto fail;
+		kaddr = kmap(page);
 		if (aops->prepare_write(file, page, offset, offset+size))
 			goto unlock;
-		kaddr = page_address(page);
 		flush_dcache_page(page);
 		transfer_result = lo_do_transfer(lo, WRITE, kaddr + offset, data, size, IV);
 		if (transfer_result) {
@@ -216,6 +216,7 @@
 			goto unlock;
 		if (transfer_result)
 			goto unlock;
+		kunmap(page);
 		data += size;
 		len -= size;
 		offset = 0;
@@ -228,6 +229,7 @@
 	return 0;
 
 unlock:
+	kunmap(page);
 	UnlockPage(page);
 	page_cache_release(page);
 fail:

             reply	other threads:[~2002-05-24  3:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-24  3:20 Benjamin LaHaise [this message]
2002-05-24  3:24 ` [PATCH] loop.c forgot a kmap William Lee Irwin III
2002-05-24  4:18 ` Andrew Morton

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=20020523232024.A2917@redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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