lkml.org 
[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] ramfs/nommu: fix bug - kernel crash when (nr != lpages)
Date
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


\
 
 \ /
  Last update: 2009-01-07 17:33    [W:0.031 / U:6.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site