public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: Xiubo Li <xiubli@redhat.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Cc: hamish.martin@alliedtelesis.co.nz, jannh@google.com,
	pkalever@redhat.com, pkarampu@redhat.com, atumball@redhat.com,
	sabose@redhat.com
Subject: Re: [PATCH v3 3/3] uio: fix crash after the device is unregistered
Date: Mon, 9 Jul 2018 11:40:19 -0500	[thread overview]
Message-ID: <5B438FF3.4040707@redhat.com> (raw)
In-Reply-To: <434b1b7c-604d-a446-b73a-8de7a50817c5@redhat.com>

On 07/06/2018 08:47 PM, Xiubo Li wrote:
> On 2018/7/7 2:58, Mike Christie wrote:
>> On 07/05/2018 09:57 PM, xiubli@redhat.com wrote:
>>>   void uio_event_notify(struct uio_info *info)
>>>   {
>>> -    struct uio_device *idev = info->uio_dev;
>>> +    struct uio_device *idev;
>>> +
>>> +    if (!info)
>>> +        return;
>>> +
>>> +    idev = info->uio_dev;
>>>   
>> For this one too, I am not sure if it is needed.
>>
>> uio_interrupt -> uio_event_notify. See other mail.
>>
>> driver XYZ -> uio_event_notify. I think drivers need to handle this and
>> set some bits and/or perform some cleanup to make sure they are not
>> calling uio_event_notify after it has called uio_unregister_device. The
>> problem with the above test is if they do not they could have called
>> uio_unregister_device right after the info test so you could still hit
>> the problem.
> 
> When we are tcmu_destroy_device(), if the netlink notify event to
> userspace is not successful then the TCMU will call the uio unregister,
> which will set the idev->info = NULL, without close and deleting the
> device in userspace. But the TCMU could still queue cmds to the ring
> buffer, then the uio_event_notify will be called.

Before tcmu_destroy_device is called LIO will have stopped new IO and
waited for outstanding IO to be completed, so it would never be called
after uio_unregister_device. If it does, it's a bug in LIO.

  reply	other threads:[~2018-07-09 16:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06  2:57 [PATCH v3 0/3] uio: fix potential crash bug xiubli
2018-07-06  2:57 ` [PATCH v3 1/3] uio: use request_threaded_irq instead xiubli
2018-07-06  2:57 ` [PATCH v3 2/3] uio: change to use the mutex lock instead of the spin lock xiubli
2018-07-06  3:39   ` Hamish Martin
2018-07-06  2:57 ` [PATCH v3 3/3] uio: fix crash after the device is unregistered xiubli
2018-07-06  3:40   ` Hamish Martin
2018-07-06 18:23   ` Mike Christie
2018-07-07  1:28     ` Xiubo Li
2018-07-09 17:06       ` Mike Christie
2018-07-10  2:40         ` Xiubo Li
2018-07-06 18:58   ` Mike Christie
2018-07-07  1:47     ` Xiubo Li
2018-07-09 16:40       ` Mike Christie [this message]
2018-07-10  2:36         ` Xiubo Li
2018-07-06  3:31 ` [PATCH v3 0/3] uio: fix potential crash bug Hamish Martin
2018-07-06 12:04   ` Xiubo Li

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=5B438FF3.4040707@redhat.com \
    --to=mchristi@redhat.com \
    --cc=atumball@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hamish.martin@alliedtelesis.co.nz \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pkalever@redhat.com \
    --cc=pkarampu@redhat.com \
    --cc=sabose@redhat.com \
    --cc=xiubli@redhat.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