[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130318225657.GA9685@logfs.org>
Date: Mon, 18 Mar 2013 18:56:57 -0400
From: Jörn Engel <joern@...fs.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Nicholas A. Bellinger" <nab@...ux-iscsi.org>,
linux-kernel@...r.kernel.org,
target-devel <target-devel@...r.kernel.org>
Subject: Re: [PATCH] target: close target_put_sess_cmd() vs.
core_tmr_abort_task() race
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists