Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Oct 2022 10:18:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 266885] [FUSEFS] fcntl(F_GETLK) overwrites flock->l_pid even if unlocked
Message-ID:  <bug-266885-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266885

            Bug ID: 266885
           Summary: [FUSEFS] fcntl(F_GETLK) overwrites flock->l_pid even
                    if unlocked
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: jmillikin@gmail.com

The documentation for fcntl(F_GETLK) says:

  If no lock is found that would prevent this lock from being created,
  the structure is left unchanged by this system call except for
  the lock type which is set to F_UNLCK.

However, the code is currently overwriting the flock structure's `l_pid` fi=
eld:

        /* sys/fs/fuse/fuse_vnops.c :: fuse_vnop_advlock() */
        if (err =3D=3D 0 && op =3D=3D FUSE_GETLK) {
                flo =3D fdi.answ;
                fl->l_type =3D flo->lk.type;
                fl->l_pid =3D flo->lk.pid;            /* <- here */
                if (flo->lk.type !=3D F_UNLCK) {
                        fl->l_start =3D flo->lk.start;

I think that assignment should be moved down a line, into the `!=3D F_UNLCK`
branch.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-266885-227>