netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET] AF_UNIX bind(2) cleanup on failures after mknod
@ 2021-06-19  3:48 Al Viro
  2021-06-19  3:50 ` [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper Al Viro
  0 siblings, 1 reply; 11+ messages in thread
From: Al Viro @ 2021-06-19  3:48 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

	Failures in unix_bind() coming after we'd created a socket
node in filesystem are possible and can leave an unpleasant mess behind.
That had been reported back in February by Denis Kirjanov, but his
proposed solution had holes.

	This is a rebase of the series I'd ended up with back then;
I'd prefer to have it go through the regular net.git path.

	8 commits total, preliminary massage in the first 6, the fix is #7
and #8 is a minor followup cleanup.  Branch is based at net.git/master,
lives in vfs.git #misc.af_unix.  Individual patches in followups.

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

 net/unix/af_unix.c | 188 +++++++++++++++++++++++++++--------------------------
 1 file changed, 96 insertions(+), 92 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCHSET] making unix_bind() undo mknod on failure
@ 2021-02-22 19:06 Al Viro
  2021-02-22 19:12 ` [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper Al Viro
  0 siblings, 1 reply; 11+ messages in thread
From: Al Viro @ 2021-02-22 19:06 UTC (permalink / raw)
  To: netdev
  Cc: Denis Kirjanov, Christoph Hellwig, LKML, Jakub Kicinski,
	linux-fsdevel, Cong Wang

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.
Please, review.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-21 19:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19  3:48 [PATCHSET] AF_UNIX bind(2) cleanup on failures after mknod Al Viro
2021-06-19  3:50 ` [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper Al Viro
2021-06-19  3:50   ` [PATCH 2/8] unix_bind(): allocate addr earlier Al Viro
2021-06-19  3:50   ` [PATCH 3/8] unix_bind(): separate BSD and abstract cases Al Viro
2021-06-19  3:50   ` [PATCH 4/8] unix_bind(): take BSD and abstract address cases into new helpers Al Viro
2021-06-19  3:50   ` [PATCH 5/8] fold unix_mknod() into unix_bind_bsd() Al Viro
2021-06-19  3:50   ` [PATCH 6/8] unix_bind_bsd(): move done_path_create() call after dealing with ->bindlock Al Viro
2021-06-19  3:50   ` [PATCH 7/8] unix_bind_bsd(): unlink if we fail after successful mknod Al Viro
2021-06-19  3:50   ` [PATCH 8/8] __unix_find_socket_byname(): don't pass hash and type separately Al Viro
2021-06-21 19:30   ` [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2021-02-22 19:06 [PATCHSET] making unix_bind() undo mknod on failure Al Viro
2021-02-22 19:12 ` [PATCH 1/8] af_unix: take address assignment/hash insertion into a new helper Al Viro
2021-02-22 19:12   ` [PATCH 4/8] unix_bind(): take BSD and abstract address cases into new helpers Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).