From: "Jörn Engel" <joern@logfs.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
linux-kernel@vger.kernel.org,
target-devel <target-devel@vger.kernel.org>
Subject: Re: [PATCH] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race
Date: Mon, 18 Mar 2013 18:56:57 -0400 [thread overview]
Message-ID: <20130318225657.GA9685@logfs.org> (raw)
In-Reply-To: <20130319000411.GA6406@kroah.com>
On Mon, 18 March 2013 17:04:11 -0700, Greg Kroah-Hartman wrote:
> On Mon, Mar 18, 2013 at 06:28:53PM -0400, Jörn Engel wrote:
> > It is possible for one thread to to take se_sess->sess_cmd_lock in
> > core_tmr_abort_task() before taking a reference count on
> > se_cmd->cmd_kref, while another thread in target_put_sess_cmd() drops
> > se_cmd->cmd_kref before taking se_sess->sess_cmd_lock.
> >
> > This introduces kref_put_and_lock() and uses it in
> > target_put_sess_cmd() to close the race window.
>
> We already have kref_put_mutex(), why not just call this
> kref_put_spinlock()?
Back when I originally wrote this patch, kref_put_mutex() didn't exist
yet. So there is my evil predetermined plan to introduce random
inconsistencies by being consistent with atomic_dec_and_lock()
instead.
If you think this matters I can rename the function and resend.
Jörn
--
Computer system analysis is like child-rearing; you can do grievous damage,
but you cannot ensure success."
-- Tom DeMarco
next prev parent reply other threads:[~2013-03-19 0:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 22:28 [PATCH] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race Jörn Engel
2013-03-19 0:04 ` Greg Kroah-Hartman
2013-03-18 22:56 ` Jörn Engel [this message]
2013-03-19 0:27 ` Greg Kroah-Hartman
2013-03-18 23:11 ` [PATCH v2] " Jörn Engel
2013-03-18 23:34 ` [PATCH v3] " Jörn Engel
2013-03-19 1:53 ` Greg Kroah-Hartman
2013-03-19 3:31 ` [PATCH v4] " Jörn Engel
2013-03-19 5:09 ` Greg Kroah-Hartman
2013-03-19 3:58 ` Jörn Engel
2013-03-19 13:38 ` Greg Kroah-Hartman
2013-03-19 15:03 ` Jörn Engel
2013-03-19 2:11 ` [PATCH v3] " Nicholas A. Bellinger
2013-03-19 2:39 ` Greg Kroah-Hartman
2013-03-19 2:46 ` Nicholas A. Bellinger
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=20130318225657.GA9685@logfs.org \
--to=joern@logfs.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=target-devel@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