mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan Wu <cooloney@kernel.org>
To: dhowells@redhat.com
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Graf Yang <graf.yang@analog.com>, Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 1/1] ramfs/nommu: fix bug - kernel crash when (nr != lpages)
Date: Thu,  8 Jan 2009 00:30:23 +0800	[thread overview]
Message-ID: <1231345823-27376-1-git-send-email-cooloney@kernel.org> (raw)

From: Graf Yang <graf.yang@analog.com>

Avoiding kernel crash when (nr != lpages), and return -ENOMEM,
let the user space application handle this error.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 fs/ramfs/file-nommu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 76acdbc..9311031 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -283,7 +283,8 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
 	if (pages) {
 		ptr = pages;
 		for (loop = lpages; loop > 0; loop--)
-			put_page(*ptr++);
+			if (*ptr)
+				put_page(*ptr++);
 		kfree(pages);
 	}
 
-- 
1.5.6


             reply	other threads:[~2009-01-07 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 16:30 Bryan Wu [this message]
2009-01-08 10:58 ` David Howells

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=1231345823-27376-1-git-send-email-cooloney@kernel.org \
    --to=cooloney@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=graf.yang@analog.com \
    --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

Powered by JetHome