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
This commit is contained in:
Konstantin Belousov 2007-12-29 14:25:29 +00:00
parent e7627b2c62
commit 15b78ac5d1

View File

@ -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);