diff options
author | Patrick Mooney <patrick.f.mooney@gmail.com> | 2014-12-31 21:47:32 +0000 |
---|---|---|
committer | Patrick Mooney <patrick.f.mooney@gmail.com> | 2014-12-31 22:03:48 +0000 |
commit | ce402f7264952f724625a71be91af2e2b08c950c (patch) | |
tree | f26426705cfb84530a01be781d3f7dedc68b6d01 | |
parent | 0255a6f9dc26c7acbff2a3013e51cfc1d880723a (diff) | |
download | illumos-joyent-ce402f7264952f724625a71be91af2e2b08c950c.tar.gz |
OS-3673 lxbrand apache2 segfaults
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/fcntl.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/fcntl.c b/usr/src/lib/brand/lx/lx_brand/common/fcntl.c index a9f56064b4..b1d999aea7 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/fcntl.c +++ b/usr/src/lib/brand/lx/lx_brand/common/fcntl.c @@ -116,8 +116,12 @@ lx_fcntl(uintptr_t p1, uintptr_t p2, uintptr_t p3) rc = lx_fcntl_com(fd, cmd, arg); - if (lk) - stol_flock(&fl, (struct lx_flock *)p3); + if (lk && rc >= 0) { + stol_flock(&fl, &lxflk); + if (uucopy((void *)&lxflk, (void *)p3, + sizeof (struct lx_flock)) != 0) + return (-errno); + } return (rc); } @@ -145,7 +149,12 @@ lx_fcntl64(uintptr_t p1, uintptr_t p2, uintptr_t p3) return (-errno); ltos_flock(&lxflk, &fl); rc = lx_fcntl_com(fd, cmd, (ulong_t)&fl); - stol_flock(&fl, (struct lx_flock *)p3); + if (rc >= 0) { + stol_flock(&fl, &lxflk); + if (uucopy((void *)&lxflk, (void *)p3, + sizeof (struct lx_flock)) != 0) + return (-errno); + } } else if (cmd == LX_F_GETLK64 || cmd == LX_F_SETLKW64 || \ cmd == LX_F_SETLK64) { if (uucopy((void *)p3, (void *)&lxflk64, @@ -153,7 +162,12 @@ lx_fcntl64(uintptr_t p1, uintptr_t p2, uintptr_t p3) return (-errno); ltos_flock64(&lxflk64, &fl64); rc = lx_fcntl_com(fd, cmd, (ulong_t)&fl64); - stol_flock64(&fl64, (struct lx_flock64 *)p3); + if (rc >= 0) { + stol_flock64(&fl64, &lxflk64); + if (uucopy((void *)&lxflk64, (void *)p3, + sizeof (struct lx_flock64)) != 0) + return (-errno); + } } else { rc = lx_fcntl_com(fd, cmd, (ulong_t)p3); } |