From d075105da01d0a8f40bdef0433b29f5efb9eaefe Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 5 Jan 2008 12:36:35 +0000 Subject: After applying LCONVPATH() to the path, do use the converted path instead of original user-mode string in the linux_stat() and linux_lstat() syscalls. Tested by: Peter Holm MFC after: 3 days --- sys/compat/linux/linux_stats.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'sys/compat') diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index 048a401dbb5b..374ce39a0eb3 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -270,13 +270,15 @@ linux_stat(struct thread *td, struct linux_stat_args *args) #ifdef DEBUG if (ldebug(stat)) - printf(ARGS(stat, "%s, *"), args->path); + printf(ARGS(stat, "%s, *"), path); #endif error = kern_stat(td, path, UIO_SYSSPACE, &buf); - LFREEPATH(path); - if (error) + if (error) { + LFREEPATH(path); return (error); - translate_path_major_minor(td, args->path, &buf); + } + translate_path_major_minor(td, path, &buf); + LFREEPATH(path); return(stat_copyout(&buf, args->up)); } @@ -291,13 +293,15 @@ linux_lstat(struct thread *td, struct linux_lstat_args *args) #ifdef DEBUG if (ldebug(lstat)) - printf(ARGS(lstat, "%s, *"), args->path); + printf(ARGS(lstat, "%s, *"), path); #endif - error = kern_lstat(td, args->path, UIO_SYSSPACE, &buf); - LFREEPATH(path); - if (error) + error = kern_lstat(td, path, UIO_SYSSPACE, &buf); + if (error) { + LFREEPATH(path); return (error); - translate_path_major_minor(td, args->path, &buf); + } + translate_path_major_minor(td, path, &buf); + LFREEPATH(path); return(stat_copyout(&buf, args->up)); } -- cgit v1.3