From: David Miller <davem@davemloft.net>
To: deweerdt@free.fr
Cc: netdev@vger.kernel.org
Subject: Re: [Oops] unix_dgram_connect locking problem?
Date: Mon, 14 May 2007 03:20:54 -0700 (PDT) [thread overview]
Message-ID: <20070514.032054.95058880.davem@davemloft.net> (raw)
In-Reply-To: <20070511150014.GF23638@slug>
From: Frederik Deweerdt <deweerdt@free.fr>
Date: Fri, 11 May 2007 17:00:14 +0200
> I think that not unix_state_rlock'ing "other" in
> unix_dgram_connect may cause it to become NULL while passing it to
> selinux_socket_unix_may_send. With the following patch applied, I've
> seen no oops so far (1-2 hours as opposed to a few minutes before applying
> the patch). Any thoughts?
Thanks for this report and patch, similar code in UNIX stream connect
has the following comment:
/* Latch our state.
It is tricky place. We need to grab write lock and cannot
drop lock on peer. It is dangerous because deadlock is
possible. Connect to self case and simultaneous
attempt to connect are eliminated by checking socket
state. other is TCP_LISTEN, if sk is TCP_LISTEN we
check this before attempt to grab lock.
Well, and we have to recheck the state after socket locked.
*/
...
unix_state_wlock_nested(sk);
So I think we need to be careful about deadlocks wrt. holding
both wlock on sk and rlock on other at the same time in
the dgram case too.
next prev parent reply other threads:[~2007-05-14 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-11 15:00 [Oops] unix_dgram_connect locking problem? Frederik Deweerdt
2007-05-14 10:20 ` David Miller [this message]
2007-05-14 18:49 ` Frederik Deweerdt
2007-05-31 22:22 ` David Miller
2007-06-01 11:34 ` Frederik Deweerdt
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=20070514.032054.95058880.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=deweerdt@free.fr \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).