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


Groups > linux.kernel > #1574418

Re: fs, net: deadlock between bind/splice on af_unix

From Cong Wang <xiyou.wangcong@gmail.com>
Newsgroups linux.kernel
Subject Re: fs, net: deadlock between bind/splice on af_unix
Date 2017-02-06 08:30 +0100
Message-ID <t7LUm-1Ov-15@gated-at.bofh.it> (permalink)
References (6 earlier) <t41O1-5cG-5@gated-at.bofh.it> <t4773-8sw-5@gated-at.bofh.it> <t48wa-M6-9@gated-at.bofh.it> <t5Aqm-5Qs-17@gated-at.bofh.it> <t5Lc6-3XV-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jan 31, 2017 at 10:14 AM, Mateusz Guzik <mguzik@redhat.com> wrote:
> On Mon, Jan 30, 2017 at 10:44:03PM -0800, Cong Wang wrote:
>> Mind being more specific?
>
> Consider 2 threads which bind the same socket, but with different paths.
>
> Currently exactly one file will get created, the one used to bind.
>
> With your patch both threads can succeed creating their respective
> files, but only one will manage to bind. The other one must error out,
> but it already created a file it is unclear what to do with.

In this case, it simply puts the path back:

        err = -EINVAL;
        if (u->addr)
                goto out_up;
[...]

out_up:
        mutex_unlock(&u->bindlock);
out_put:
        if (err)
                path_put(&path);
out:
        return err;


Which is what unix_release_sock() does too:

        if (path.dentry)
                path_put(&path);

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


Thread

Re: fs, net: deadlock between bind/splice on af_unix Cong Wang <xiyou.wangcong@gmail.com> - 2017-01-31 07:50 +0100
  Re: fs, net: deadlock between bind/splice on af_unix Mateusz Guzik <mguzik@redhat.com> - 2017-01-31 19:20 +0100
    Re: fs, net: deadlock between bind/splice on af_unix Cong Wang <xiyou.wangcong@gmail.com> - 2017-02-06 08:30 +0100
      Re: fs, net: deadlock between bind/splice on af_unix Mateusz Guzik <mguzik@redhat.com> - 2017-02-07 15:30 +0100
        Re: fs, net: deadlock between bind/splice on af_unix Cong Wang <xiyou.wangcong@gmail.com> - 2017-02-10 02:40 +0100

csiph-web