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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130701153015.9842a0b2d291e01105d853d0@linux-foundation.org>
Date:	Mon, 1 Jul 2013 15:30:15 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	James Bottomley <James.Bottomley@...senpartnership.com>
Cc:	Sujit Reddy Thumma <sthumma@...eaurora.org>,
	Aaron Lu <aaron.lu@...el.com>, Jens Axboe <axboe@...nel.dk>,
	linux-pm@...r.kernel.org, linux-scsi@...r.kernel.org,
	stable@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: Fix possible sleep in invalid context

On Mon, 01 Jul 2013 15:24:11 -0700 James Bottomley <James.Bottomley@...senpartnership.com> wrote:

> > --- a/block/blk-core.c~block-fix-possible-sleep-in-invalid-context-fix
> > +++ a/block/blk-core.c
> > @@ -3159,15 +3159,14 @@ EXPORT_SYMBOL(blk_pre_runtime_resume);
> >   */
> >  void blk_post_runtime_resume(struct request_queue *q, int err)
> >  {
> > +	spin_lock_irq(q->queue_lock);
> >  	if (!err) {
> > -		spin_lock_irq(q->queue_lock);
> >  		q->rpm_status = RPM_ACTIVE;
> >  		__blk_run_queue(q);
> >  		pm_runtime_mark_last_busy(q->dev);
> >  		spin_unlock_irq(q->queue_lock);
> >  		pm_request_autosuspend(q->dev);
> >  	} else {
> > -		spin_lock_irq(q->queue_lock);
> >  		q->rpm_status = RPM_SUSPENDED;
> >  		spin_unlock_irq(q->queue_lock);
> >  	}
> > _
> > 
> > 
> > I wonder if we actually need locking around that second write to
> > q->rpm_status.
> 
> Shouldn't: it's an int, which makes it a 32 bit quantity we believe to
> have atomic write properties on every platform.

Yes, but.  If there's some other code path which does:

	spin_lock(queue_lock);
	x = q->rpm_status;
	...
	y = q->rpm_status;
	...
	<assumes x == y>
	spin_unlock(queue_lock);

then it blows up if we make the suggested change.  Stranger things have
happened...

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