Re: [PATCHSET] making unix_bind() undo mknod on failure

From: Jakub Kicinski
Date: Tue Feb 23 2021 - 20:09:51 EST


On Mon, 22 Feb 2021 19:06:00 +0000 Al Viro wrote:
> On Sat, Feb 20, 2021 at 09:08:56PM +0000, Al Viro wrote:
>
> > *shrug*
> >
> > If anything, __unix_complete_bind() might make a better name for that,
> > with dropping ->bindlock also pulled in, but TBH I don't have sufficiently
> > strong preferences - might as well leave dropping the lock to caller.
> >
> > I'll post that series to netdev tonight.
>
> Took longer than I hoped... Anyway, here's the current variant;
> it's 5.11-based, lives in
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git misc.af_unix
>
> Shortlog:
> Al Viro (8):
> af_unix: take address assignment/hash insertion into a new helper
> unix_bind(): allocate addr earlier
> unix_bind(): separate BSD and abstract cases
> unix_bind(): take BSD and abstract address cases into new helpers
> fold unix_mknod() into unix_bind_bsd()
> unix_bind_bsd(): move done_path_create() call after dealing with ->bindlock
> unix_bind_bsd(): unlink if we fail after successful mknod
> __unix_find_socket_byname(): don't pass hash and type separately
>
> Diffstat:
> net/unix/af_unix.c | 186 +++++++++++++++++++++++++++--------------------------
> 1 file changed, 94 insertions(+), 92 deletions(-)
>
> The actual fix is in #7/8, the first 6 are massage in preparation to that
> and #8/8 is a minor followup cleanup. Individual patches in followups.

Dave is out this week, but this looks good to me. You said "please
review" - I'm assuming you'll send these to Linus yourself, so:

Acked-by: Jakub Kicinski <kuba@xxxxxxxxxx>