mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Halcrow <mhalcrow@us.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: trevor.highland@gmail.com, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] eCryptfs: zero out last page for llseek/write
Date: Mon, 25 Jun 2007 12:48:30 -0500	[thread overview]
Message-ID: <20070625174830.GC27771@halcrow.austin.ibm.com> (raw)
In-Reply-To: <20070613185456.GY13465@halcrow.austin.ibm.com>

When one llseek's past the end of the file and then writes, every page
past the previous end of the file should be cleared. Trevor found that
the code, as is, does not assure that the very last page is always
cleared. This patch takes care of that.

This patch, including the two that I sent on June 13th, are bugfixes
to try to clean up the recent llseek() hack job; hopefully they can be
merged before the release of 2.6.22 (I've noticed that we're already
at -rc6).

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>

---
 fs/ecryptfs/mmap.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 6df410c..7d5a43c 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -422,6 +422,8 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
 				goto out;
 			}
 		}
+		if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host))
+			zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
 	}
 out:
 	return rc;
-- 
1.4.4.4


      reply	other threads:[~2007-06-25 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-13 18:53 [PATCH 1/2] eCryptfs: fix write zeros behavior Michael Halcrow
2007-06-13 18:54 ` [PATCH 2/2] eCryptfs: initialize crypt_stat in setattr Michael Halcrow
2007-06-25 17:48   ` Michael Halcrow [this message]

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=20070625174830.GC27771@halcrow.austin.ibm.com \
    --to=mhalcrow@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trevor.highland@gmail.com \
    /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®