diff options
author | marcel <marcel@FreeBSD.org> | 1999-08-13 09:27:54 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 1999-08-13 09:27:54 +0000 |
commit | 43df2a8dbd4768fdf3fe7c3ef8e958b569609528 (patch) | |
tree | 7a1ca37c9e8edb3f095a6e082648b3971bd91e40 /sys/compat/linux/linux_file.c | |
parent | e4cfa037a082e66ec08197c2dfc338003db19cd8 (diff) | |
download | FreeBSD-src-43df2a8dbd4768fdf3fe7c3ef8e958b569609528.zip FreeBSD-src-43df2a8dbd4768fdf3fe7c3ef8e958b569609528.tar.gz |
In doing lock type conversion (struct flock), make sure that carbage in results
in deterministic behaviour. In this case known garbage out.
The fix is different than suggested in the PR.
PR: 12749
Originator: Boris Nikolaus <boris@cs.tu-berlin.de>
Diffstat (limited to 'sys/compat/linux/linux_file.c')
-rw-r--r-- | sys/compat/linux/linux_file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index ded59f9..c27f1c9 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_file.c,v 1.27 1999/07/18 14:31:01 phk Exp $ + * $Id: linux_file.c,v 1.28 1999/08/12 19:53:32 marcel Exp $ */ #include "opt_compat.h" @@ -158,6 +158,9 @@ linux_to_bsd_flock(struct linux_flock *linux_flock, struct flock *bsd_flock) case LINUX_F_UNLCK: bsd_flock->l_type = F_UNLCK; break; + default: + bsd_flock->l_type = -1; + break; } bsd_flock->l_whence = linux_flock->l_whence; bsd_flock->l_start = (off_t)linux_flock->l_start; @@ -250,7 +253,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) if (args->arg & LINUX_FASYNC) fcntl_args.arg |= O_ASYNC; fcntl_args.cmd = F_SETFL; return fcntl(p, &fcntl_args); - + case LINUX_F_GETLK: if ((error = copyin((caddr_t)args->arg, (caddr_t)&linux_flock, sizeof(struct linux_flock)))) |