From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "mwilck@suse.com" <mwilck@suse.com>,
"hare@suse.de" <hare@suse.de>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "mauricfo@linux.vnet.ibm.com" <mauricfo@linux.vnet.ibm.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 3/3] scsi_dh_alua: do not call BUG_ON when updating port group
Date: Fri, 28 Apr 2017 19:58:08 +0000 [thread overview]
Message-ID: <1493409488.2767.17.camel@sandisk.com> (raw)
In-Reply-To: <20170428130626.32162-4-mwilck@suse.com>
On Fri, 2017-04-28 at 15:06 +0200, Martin Wilck wrote:
> diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
> index 501855bde633..274fb49d0801 100644
> --- a/drivers/scsi/device_handler/scsi_dh_alua.c
> +++ b/drivers/scsi/device_handler/scsi_dh_alua.c
> @@ -652,9 +652,13 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
> rcu_read_lock();
> list_for_each_entry_rcu(h,
> &tmp_pg->dh_list, node) {
> - /* h->sdev should always be valid */
> - BUG_ON(!h->sdev);
> - h->sdev->access_state = desc[0];
> + /*
> + * We might be racing with
> + * alua_bus_detach here
> + */
> + if (h->sdev)
> + h->sdev->access_state =
> + desc[0];
> }
> rcu_read_unlock();
> }
Hello Hannes and Martin,
What will happen if h->sdev is cleared after it has been tested and before
it is dereferenced? Additionally, even if h->sdev would be cached, can the
following sequence of events happen?
* alua_rtpg() tests h->sdev.
* alua_bus_detach() clears h->sdev.
* h->sdev is freed.
* alua_rtpg() dereferences h->sdev.
Thanks,
Bart.
prev parent reply other threads:[~2017-04-28 19:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 13:06 [PATCH 0/3] failover fixes for scsi_dh_alua Martin Wilck
2017-04-28 13:06 ` [PATCH 1/3] scsi_dh_alua: Do not modify the interval value for retries Martin Wilck
2017-04-28 18:35 ` Bart Van Assche
2017-04-28 19:49 ` Martin Wilck
2017-05-02 6:17 ` Hannes Reinecke
2017-04-28 13:06 ` [PATCH 2/3] scsi_dh_alua: Do not retry for unmapped device Martin Wilck
2017-04-28 18:42 ` Bart Van Assche
2017-04-28 19:52 ` Martin Wilck
2017-04-28 13:06 ` [PATCH 3/3] scsi_dh_alua: do not call BUG_ON when updating port group Martin Wilck
2017-04-28 19:58 ` Bart Van Assche [this message]
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=1493409488.2767.17.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=hare@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mauricfo@linux.vnet.ibm.com \
--cc=mwilck@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.