On Sun, May 24, 2020 at 5:05 PM Al Viro <[email protected]> wrote: > > On Sun, May 24, 2020 at 04:39:39PM -0700, Sargun Dhillon wrote: > > Bad refcounting rules. *IF* we go with anything of that sort (and I'm not > convinced that the entire series makes sense), it's better to have more > uniform rules re reference consumption/disposal. > > Make the destructor of addfd *ALWAYS* drop its reference. And have this > function go Are you suggesting the in both the error, and non-error cases the ioctl invoker side is responsible for fput'ing the final reference in both the success and non-success cases? Would we take an extra reference prior to fd_install? > > if (addfd->fd >= 0) { > ret = replace_fd(addfd->fd, addfd->file, addfd->flags); > } else { > ret = get_unused_fd_flags(addfd->flags); > if (ret >= 0) > fd_install(ret, get_file(addfd->file)); > } > Wouldn't this result in consumption of reference in one case (fd_install), and the fd still having a reference in the replace_fd case?
- [PATCH 0/5] Add seccomp notifier ioctl that enables addi... Sargun Dhillon
- [PATCH 2/5] seccomp: Introduce addfd ioctl to secco... Sargun Dhillon
- Re: [PATCH 2/5] seccomp: Introduce addfd ioctl ... Tycho Andersen
- Re: [PATCH 2/5] seccomp: Introduce addfd io... Tycho Andersen
- Re: [PATCH 2/5] seccomp: Introduce addfd ioctl ... Al Viro
- Re: [PATCH 2/5] seccomp: Introduce addfd io... Sargun Dhillon
- Re: [PATCH 2/5] seccomp: Introduce addfd ioctl ... Christian Brauner
- Re: [PATCH 2/5] seccomp: Introduce addfd io... Sargun Dhillon
- Re: [PATCH 2/5] seccomp: Introduce addf... Christian Brauner
- [PATCH 1/5] seccomp: Add find_notification helper Sargun Dhillon
- Re: [PATCH 1/5] seccomp: Add find_notification ... Tycho Andersen
- Re: [PATCH 1/5] seccomp: Add find_notification ... Christian Brauner
- [PATCH 3/5] selftests/seccomp: Test SECCOMP_IOCTL_N... Sargun Dhillon
- [PATCH 4/5] seccomp: Add SECCOMP_ADDFD_FLAG_MOVE fl... Sargun Dhillon
- Re: [PATCH 4/5] seccomp: Add SECCOMP_ADDFD_FLAG... Christian Brauner

