[uClinux-dev] [PATCH] : Avoid filename < TASK_SIZE test in do_getname() when no MMU

Philippe De Muyter phdm at macqel.be
Thu May 20 04:14:45 EDT 2010


Hi Greg,

--
Avoid filename < TASK_SIZE test in do_getname() when no MMU.

Without MMU, filenames can be anywhere in memory.  It is thus wrong to
check that filename is before TASK_SIZE in do_getname().

Signed-off-by: Philippe De Muyter <phdm at macqel.be>
---
 fs/namei.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index b86b96f..658bc1d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -119,12 +119,14 @@ static int do_getname(const char __user *filename, char *page)
 	int retval;
 	unsigned long len = PATH_MAX;
 
+#ifdef CONFIG_MMU
 	if (!segment_eq(get_fs(), KERNEL_DS)) {
 		if ((unsigned long) filename >= TASK_SIZE)
 			return -EFAULT;
 		if (TASK_SIZE - (unsigned long) filename < PATH_MAX)
 			len = TASK_SIZE - (unsigned long) filename;
 	}
+#endif
 
 	retval = strncpy_from_user(page, filename, len);
 	if (retval > 0) {

-- 
Philippe De Muyter  phdm at macqel dot be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077



More information about the uClinux-dev mailing list