linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Hillf Danton <hdanton@sina.com>,
	syzbot <syzbot+889cc963ed79ee90f74f@syzkaller.appspotmail.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	schatzberg.dan@gmail.com, sfr@canb.auug.org.au,
	syzkaller-bugs@googlegroups.com
Subject: Re: general protection fault in __queue_work (2)
Date: Sun, 8 Mar 2020 20:17:01 -0600	[thread overview]
Message-ID: <092fab4c-5308-4a14-ab3d-e63707efa2f6@kernel.dk> (raw)
In-Reply-To: <20200309020900.16756-1-hdanton@sina.com>

On 3/8/20 8:09 PM, Hillf Danton wrote:
> 
> On Sun, 8 Mar 2020 10:17:33 -0600 Jens Axboe wrote:
>> On 3/8/20 3:44 AM, Hillf Danton wrote:
>>> @@ -1208,8 +1211,16 @@ static int __loop_clr_fd(struct loop_dev
>>>  	 *
>>>  	 * 3) unlock, del_timer_sync so if timer raced it will be a no-op
>>>  	 */
>>> -	loop_unprepare_queue(lo);
>>>  	spin_lock_irq(&lo->lo_lock);
>>> +	do {
>>> +		struct workqueue_struct *wq = lo->workqueue;
>>> +
>>> +		lo->workqueue = ERR_PTR(-EINVAL);
>>> +		spin_unlock_irq(&lo->lo_lock);
>>> +		destroy_workqueue(wq);
>>> +		spin_lock_irq(&lo->lo_lock);
>>> +	} while (0);
>>
>> This looks highly suspicious, what's the point of this loop?
> 
> It is a while(0) loop that just gives me the chance for adding the
> transient local variable wq.

I think that adds more confusion than what is necessary, and I don't think
the approach is great to begin with as you now need various checks as well
for the workqueue pointer.

We're freezing the queue right after anyway, which will ensure that
nobody is going to hit an invalid workqueue pointer in terms of queueing.
This looks more like an ordering issue.

>> Also think this series a) might not be fully cooked, and b) really
>> should have gone through the block tree.
> 
> Gavel in your hand, Sir.

Andrew, can you please drop this series so we can work out the kinks and
get it properly queued up after?

-- 
Jens Axboe


  parent reply	other threads:[~2020-03-09  2:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200308094448.15320-1-hdanton@sina.com>
2020-03-08 16:17 ` general protection fault in __queue_work (2) Jens Axboe
     [not found] ` <20200309020900.16756-1-hdanton@sina.com>
2020-03-09  2:17   ` Jens Axboe [this message]
2020-03-07  3:55 syzbot
2020-03-07 17:55 ` syzbot

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=092fab4c-5308-4a14-ab3d-e63707efa2f6@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hdanton@sina.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schatzberg.dan@gmail.com \
    --cc=sfr@canb.auug.org.au \
    --cc=syzbot+889cc963ed79ee90f74f@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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).