summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2007-12-29 14:25:29 +0000
committerkib <kib@FreeBSD.org>2007-12-29 14:25:29 +0000
commit6dc4f55b5511f713d99d0c9ddf7bc0125318384a (patch)
treec881e9c16bb36dbcfb43a58ae8d5789ca419f69a
parentc9fb56ffc84b6f60b46e1e1bf352c0d8282d1a0b (diff)
downloadFreeBSD-src-6dc4f55b5511f713d99d0c9ddf7bc0125318384a.zip
FreeBSD-src-6dc4f55b5511f713d99d0c9ddf7bc0125318384a.tar.gz
Apply the LCONVPATH() to the (old) linux_stat() and linux_lstat() syscalls.
Without it, code has two problems: - behaviour of the old and new [l]stat are different with regard of the /compat/linux - directly accessing the userspace data from the kernel asks for the panics. Reported and tested by: Peter Holm Reviewed by: rdivacky MFC after: 3 days
-rw-r--r--sys/compat/linux/linux_stats.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 4dd9419..048a401 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -263,12 +263,17 @@ int
linux_stat(struct thread *td, struct linux_stat_args *args)
{
struct stat buf;
+ char *path;
int error;
+
+ LCONVPATHEXIST(td, args->path, &path);
+
#ifdef DEBUG
if (ldebug(stat))
- printf(ARGS(stat, "%s, *"), args->path);
+ printf(ARGS(stat, "%s, *"), args->path);
#endif
- error = kern_stat(td, args->path, UIO_SYSSPACE, &buf);
+ error = kern_stat(td, path, UIO_SYSSPACE, &buf);
+ LFREEPATH(path);
if (error)
return (error);
translate_path_major_minor(td, args->path, &buf);
@@ -279,13 +284,17 @@ int
linux_lstat(struct thread *td, struct linux_lstat_args *args)
{
struct stat buf;
+ char *path;
int error;
+ LCONVPATHEXIST(td, args->path, &path);
+
#ifdef DEBUG
if (ldebug(lstat))
- printf(ARGS(lstat, "%s, *"), args->path);
+ printf(ARGS(lstat, "%s, *"), args->path);
#endif
error = kern_lstat(td, args->path, UIO_SYSSPACE, &buf);
+ LFREEPATH(path);
if (error)
return (error);
translate_path_major_minor(td, args->path, &buf);
OpenPOWER on IntegriCloud