public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion•org>
To: Rainer Weikusat <rweikusat@mobileactivedefense•com>,
	David Miller <davem@davemloft•net>
Cc: dvyukov@google•com, netdev@vger•kernel.org,
	linux-kernel@vger•kernel.org, viro@ZenIV•linux.org.uk
Subject: Re: [PATCH] af_unix: Fix splice-bind deadlock
Date: Tue, 29 Dec 2015 11:58:28 +0100	[thread overview]
Message-ID: <56826754.2060003@stressinduktion.org> (raw)
In-Reply-To: <87y4cftztp.fsf@doppelsaurus.mobileactivedefense.com>

Hello Rainer,

On 27.12.2015 21:13, Rainer Weikusat wrote:
> -static int unix_mknod(const char *sun_path, umode_t mode, struct path *res)
> +static int unix_mknod(struct dentry *dentry, struct path *path, umode_t mode,
> +		      struct path *res)
>   {
> -	struct dentry *dentry;
> -	struct path path;
> -	int err = 0;
> -	/*
> -	 * Get the parent directory, calculate the hash for last
> -	 * component.
> -	 */
> -	dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0);
> -	err = PTR_ERR(dentry);
> -	if (IS_ERR(dentry))
> -		return err;
> +	int err;
>
> -	/*
> -	 * All right, let's create it.
> -	 */
> -	err = security_path_mknod(&path, dentry, mode, 0);
> +	err = security_path_mknod(path, dentry, mode, 0);
>   	if (!err) {
> -		err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0);
> +		err = vfs_mknod(d_inode(path->dentry), dentry, mode, 0);
>   		if (!err) {
> -			res->mnt = mntget(path.mnt);
> +			res->mnt = mntget(path->mnt);
>   			res->dentry = dget(dentry);
>   		}
>   	}
> -	done_path_create(&path, dentry);
> +

The reordered call to done_path_create will change the locking ordering 
between the i_mutexes and the unix readlock. Can you comment on this? On 
a first sight this looks like a much more dangerous change than the 
original deadlock report. Can't this also conflict with splice code deep 
down in vfs layer?

Thanks,
   Hannes

  reply	other threads:[~2015-12-29 10:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-27 20:13 [PATCH] af_unix: Fix splice-bind deadlock Rainer Weikusat
2015-12-29 10:58 ` Hannes Frederic Sowa [this message]
2015-12-31 19:36   ` Rainer Weikusat
2016-01-03 18:03     ` Rainer Weikusat
2016-01-04 23:25       ` Hannes Frederic Sowa
2016-01-06 14:45         ` Rainer Weikusat
2016-01-03 18:04 ` Rainer Weikusat
2016-01-03 18:56   ` Rainer Weikusat
2016-01-05  4:23     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56826754.2060003@stressinduktion.org \
    --to=hannes@stressinduktion$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=dvyukov@google$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rweikusat@mobileactivedefense$(echo .)com \
    --cc=viro@ZenIV$(echo .)linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox