lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20110512202121.GA24843@redhat.com>
Date:	Thu, 12 May 2011 16:21:21 -0400
From:	Vivek Goyal <vgoyal@...hat.com>
To:	linux kernel mailing list <linux-kernel@...r.kernel.org>,
	Jens Axboe <jaxboe@...ionio.com>
Cc:	Tejun Heo <tj@...nel.org>
Subject: Question about life time of block device request queue

Hi,

I am reading following code and wondering what makes sure that request
queue lock is still valid by the time we call __make_request().

__generic_make_request() {
...
...
                if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
                        goto end_io;

...
...
		ret = q->make_request_fn(q, bio); ---> __make_request();
}

__make_request(q)
{
	spin_lock_irq(q->queue_lock);
}

blk_cleanup_queue()
{
...
...
	queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
...
...
}

So when a driver tears down the request queue it should call
blk_cleanup_queue() which will mark queue as DEAD.

In __generic_make_request() once we have checked for dead queue and then
we run bunch of more instructions and then call q->make_request_fn() which
calls __make_request() and in __make_request we take ->queue_lock. What
makes sure that driver did not call blk_cleanup_queue() between DEAD flag
test and taking of spin lock?

Is this a race condition or I am missing something.

Thanks
Vivek
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ