linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] s390/dasd fix oops
@ 2022-09-19 15:49 Stefan Haberland
  2022-09-19 15:49 ` [PATCH 1/1] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Stefan Haberland
  2022-09-19 16:19 ` [PATCH 0/1] s390/dasd fix oops Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Haberland @ 2022-09-19 15:49 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

Hi Jens,

please apply the following patch that fixes an Oops in the DASD driver
related to a race in a device structure update function.

Stefan Haberland (1):
  s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing
    pavgroup

 drivers/s390/block/dasd_alias.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup
  2022-09-19 15:49 [PATCH 0/1] s390/dasd fix oops Stefan Haberland
@ 2022-09-19 15:49 ` Stefan Haberland
  2022-09-19 16:19 ` [PATCH 0/1] s390/dasd fix oops Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Haberland @ 2022-09-19 15:49 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

Fix Oops in dasd_alias_get_start_dev() function caused by the pavgroup
pointer being NULL.

The pavgroup pointer is checked on the entrance of the function but
without the lcu->lock being held. Therefore there is a race window
between dasd_alias_get_start_dev() and _lcu_update() which sets
pavgroup to NULL with the lcu->lock held.

Fix by checking the pavgroup pointer with lcu->lock held.

Cc: <stable@vger.kernel.org> # 2.6.25+
Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1")
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
 drivers/s390/block/dasd_alias.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index dc78a523a69f..b6b938aa6615 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -675,12 +675,12 @@ int dasd_alias_remove_device(struct dasd_device *device)
 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device)
 {
 	struct dasd_eckd_private *alias_priv, *private = base_device->private;
-	struct alias_pav_group *group = private->pavgroup;
 	struct alias_lcu *lcu = private->lcu;
 	struct dasd_device *alias_device;
+	struct alias_pav_group *group;
 	unsigned long flags;
 
-	if (!group || !lcu)
+	if (!lcu)
 		return NULL;
 	if (lcu->pav == NO_PAV ||
 	    lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING))
@@ -697,6 +697,11 @@ struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device)
 	}
 
 	spin_lock_irqsave(&lcu->lock, flags);
+	group = private->pavgroup;
+	if (!group) {
+		spin_unlock_irqrestore(&lcu->lock, flags);
+		return NULL;
+	}
 	alias_device = group->next;
 	if (!alias_device) {
 		if (list_empty(&group->aliaslist)) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] s390/dasd fix oops
  2022-09-19 15:49 [PATCH 0/1] s390/dasd fix oops Stefan Haberland
  2022-09-19 15:49 ` [PATCH 1/1] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Stefan Haberland
@ 2022-09-19 16:19 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-09-19 16:19 UTC (permalink / raw)
  To: Stefan Haberland
  Cc: Vasily Gorbik, Christian Borntraeger, linux-s390, Jan Hoeppner,
	Heiko Carstens, linux-block

On Mon, 19 Sep 2022 17:49:30 +0200, Stefan Haberland wrote:
> please apply the following patch that fixes an Oops in the DASD driver
> related to a race in a device structure update function.
> 
> Stefan Haberland (1):
>   s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing
>     pavgroup
> 
> [...]

Applied, thanks!

[1/1] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup
      commit: db7ba07108a48c0f95b74fabbfd5d63e924f992d

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-19 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 15:49 [PATCH 0/1] s390/dasd fix oops Stefan Haberland
2022-09-19 15:49 ` [PATCH 1/1] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Stefan Haberland
2022-09-19 16:19 ` [PATCH 0/1] s390/dasd fix oops Jens Axboe

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