On Tue, Aug 4, 2020 at 1:45 PM Eric Biggers <[email protected]> wrote: > > On Tue, Aug 04, 2020 at 01:31:55PM -0700, Lokesh Gidra wrote: > > when get_unused_fd_flags returns error, ctx will be freed by > > userfaultfd's release function, which is indirectly called by fput(). > > Also, if anon_inode_getfile_secure() returns an error, then > > userfaultfd_ctx_put() is called, which calls mmdrop() and frees ctx. > > > > Also, the O_CLOEXEC was inadvertently added to the call to > > get_unused_fd_flags() [1]. > > > > Adding Al Viro's suggested-by, based on [2]. > > > > [1] > > https://lore.kernel.org/lkml/[email protected]/ > > [2] > > https://lore.kernel.org/lkml/[email protected]/ > > > > Fixes: d08ac70b1e0d (Wire UFFD up to SELinux) > > Suggested-by: Al Viro <[email protected]> > > Reported-by: [email protected] > > Signed-off-by: Lokesh Gidra <[email protected]> > > What branch does this patch apply to? Neither mainline nor linux-next works. > On James Morris' tree (secure_uffd_v5.9 branch).
> - Eric

