Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp885362rwb; Mon, 26 Sep 2022 07:06:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Zlu6Hbn3/hQ2NBynOtOMHvUuatSHx/2kaXIQ5NOOIAaK6i7GBXqnyyN/u9tFpcYxd62PC X-Received: by 2002:a05:6402:3705:b0:454:e006:82 with SMTP id ek5-20020a056402370500b00454e0060082mr22658625edb.360.1664201219473; Mon, 26 Sep 2022 07:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664201219; cv=none; d=google.com; s=arc-20160816; b=Vhty1BOjwKsaU+hceSiiulGlk7t4+gN6MVOyAiILFhiCL7IyEVtGardaVKWAx28Oen owjD+2CD5DXLpx3f3+tdHNPtFOoP8MkeZ6j7vE9Qn4B33x5CtPJ1+yCLtdAhbI5r2k8v v02JtZMD6gHPKRUIaRAb5GtZLojBb9zb9Ms4ofik8AD5fsnyP0MiiGD1rHxfMy9r8RNF McxHqQKml8vl7rKUBZJc13QUMw7z1EMuA9I6OXTY/mkOWJJEAt0Vr5AG2V3+2qYodb9Y wuGvWNHd7lRTV3pFUPlr8Dt6qyrHCLd8Q20Pjh9BDwTQLmWyJ5L+qCPiJex9A+NWn8Uy EB8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BR8sOzNPQXw89FlEvGkaVq3mAMS0TW63638sjmMel64=; b=iclvsnv5KXsJf300Lxb7oa3UztNgUCMn7bxvGKzmZt4QkvA5tqb8wD0qlvD2m3CInf 091xoCEadLJXmynA7DemFGqY5MXiXbnkt2YUafq2oF0gTtqjQNPxpYls6q4OqNVjDzlS /keORiCGdRuz1qN3/xLd/lFpMcOKhtQzemJbg9zvUYxx6hNG0a6L3rUwPfL/zBct8m57 IFK+tApf4BakBF4TbU+3Wi4uGLnKjuKMamzAtHgjiFwgVo5cUPTBRk5bG1R/JvsGCnCp cfOEfkUlUZ5rJUPYFSOUXEX3FQ7gwe55CWe3+THGicIFhkhv08aDbUPRFt5o23sruTyV zHtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EEHSSawh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a17090658c900b00783286f155fsi6873159ejs.311.2022.09.26.07.06.25; Mon, 26 Sep 2022 07:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EEHSSawh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238991AbiIZL7Q (ORCPT + 99 others); Mon, 26 Sep 2022 07:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239490AbiIZLzn (ORCPT ); Mon, 26 Sep 2022 07:55:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FE05852B; Mon, 26 Sep 2022 03:51:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92B6460BAF; Mon, 26 Sep 2022 10:49:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACD2C433C1; Mon, 26 Sep 2022 10:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189396; bh=75DfJ5Yqg1z2SFT3L+O7MKMIFpGoOqNpgcehWq6lixc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEHSSawhAJfRsVeNEpHR7QwmZhcB7y55fx4gxpAsxZFP13nejiUzFCt3I9zZ5ZuvF nrE3X7kE6EguyMFvMCSG+WMVR151wcthge7LEV6DnFtS0Gjc02Z9zpu9xz/1MzI5WC 0GEEOoyG2pRsCJJLebdhqtmIU0SFjWIg/Y1LC/QA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Jens Axboe Subject: [PATCH 5.19 166/207] s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup Date: Mon, 26 Sep 2022 12:12:35 +0200 Message-Id: <20220926100814.089405843@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Haberland commit db7ba07108a48c0f95b74fabbfd5d63e924f992d upstream. 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: # 2.6.25+ Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Link: https://lore.kernel.org/r/20220919154931.4123002-2-sth@linux.ibm.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd_alias.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- 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 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 } 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)) {