Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298944

Re: [PATCH] af_unix: Fix splice-bind deadlock

From Hannes Frederic Sowa <hannes@stressinduktion.org>
Newsgroups linux.kernel
Subject Re: [PATCH] af_unix: Fix splice-bind deadlock
Date 2015-12-29 12:00 +0100
Message-ID <qL0au-7IT-11@gated-at.bofh.it> (permalink)
References <qKw3w-3Io-1017@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] af_unix: Fix splice-bind deadlock Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-12-28 03:50 +0100
  Re: [PATCH] af_unix: Fix splice-bind deadlock Hannes Frederic Sowa <hannes@stressinduktion.org> - 2015-12-29 12:00 +0100
    Re: [PATCH] af_unix: Fix splice-bind deadlock Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2015-12-31 20:40 +0100

csiph-web