Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9093526pxu; Mon, 28 Dec 2020 06:29:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOIwKn/8EpaqCZ7TYPvSPLb92l0nX3xqBPTBVZ+BQKVGZ7t4xyFJDAC6A8C64opsTY4tYe X-Received: by 2002:a17:907:1010:: with SMTP id ox16mr42214431ejb.439.1609165752888; Mon, 28 Dec 2020 06:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165752; cv=none; d=google.com; s=arc-20160816; b=m8G1nhzrgS9Y5iWrtr77JrnRfl9+Lsig6+vrbr5uLQT5bielEDqZSl9Ce0WGRbY5aw dV+C8CnG110GANTp5LuitahJu4OzhzgWrT19ZZU/sGOTzQKJgCOixUIQaJotCeroIW5X qWRwKGWNub/O2Ya336FCUfaRxEZ6ajZXqAU38W00Dz3CUjG4Kzo+B22APIoSia01YviM sTy2akSpzaPA+bHOixIxsyIGMg5Sv/5dMC/IW3QCZxGR9MEpKDOyI2+nGz7WKElUtoDF sIWVGZdOPjWHOF49VILpmm1ORLgnGKK/FTzU1opvSCe3pnMopi2AjWWpmm4BicNh/Qst OSaQ== 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=o8jyBhlx8Sb4B4+VAGSqZRRb4iKsoP30yohbDSERrhg=; b=n6Nqb2goCWurapA3QAlXqhf9KYLzRziLHH8r3dQi54xUZbYoKlDmSc6CvveFuP9B3D ao4ZZJjgW9aTkqgLAXoEUMwYiDlTm64kE68O/6IxV1lw4fAbuOyw8DuJoeBo7Q14hIZL LYL/iNMr3m2jdZ+iIs7AU2D+qxny7dKrJ3Nr5O26s+dDF7TPndoAJCTNbviRdTSKDl2y /D03o/osfuoBGwug17ywsdhO1M8L9DNpvX0sby0v79vxsI2YH5DzKQeKO7kQGsp1jLJ3 pC71D9XC9mhgcuLva1SU/oTv33aEQC+fca2IfNH6n8TeM1rgQXTjfz8VXMay81ZutTJH 38JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0pFNtAub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si20525019edv.261.2020.12.28.06.28.50; Mon, 28 Dec 2020 06:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0pFNtAub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2503308AbgL1OZt (ORCPT + 99 others); Mon, 28 Dec 2020 09:25:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:33684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503304AbgL1OZt (ORCPT ); Mon, 28 Dec 2020 09:25:49 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C5AD22B2E; Mon, 28 Dec 2020 14:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165508; bh=nZMrMAamCH8fxLv4x7n/eb5SNkknL3x8hgvUN8jEIWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pFNtAubDAOu2ygPfwTmyRuLTsYnwWP02KeVTK2AAw0R9wFmizGk2ygEOAzNyevQ8 RmoanEGHh8wN/5d6aWmUC/zwfrWFrIg7SEOYbFcm6PNnHdWbP0TdwRQe3GVoXWTR/Y twioHsW7ZWgeSJruiS86qQGAShesY+reGc5OCph4= 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.10 557/717] s390/dasd: fix list corruption of pavgroup group list Date: Mon, 28 Dec 2020 13:49:15 +0100 Message-Id: <20201228125047.619220403@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Haberland commit 0ede91f83aa335da1c3ec68eb0f9e228f269f6d8 upstream. dasd_alias_add_device() moves devices to the active_devices list in case of a scheduled LCU update regardless if they have previously been in a pavgroup or not. Example: device A and B are in the same pavgroup. Device A has already been in a pavgroup and the private->pavgroup pointer is set and points to a valid pavgroup. While going through dasd_add_device it is moved from the pavgroup to the active_devices list. In parallel device B might be removed from the same pavgroup in remove_device_from_lcu() which in turn checks if the group is empty and deletes it accordingly because device A has already been removed from there. When now device A enters remove_device_from_lcu() it is tried to remove it from the pavgroup again because the pavgroup pointer is still set and again the empty group will be cleaned up which leads to a list corruption. Fix by setting private->pavgroup to NULL in dasd_add_device. If the device has been the last device on the pavgroup an empty pavgroup remains but this will be cleaned up by the scheduled lcu_update which iterates over all existing pavgroups. Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") Cc: stable@vger.kernel.org Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd_alias.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -642,6 +642,7 @@ int dasd_alias_add_device(struct dasd_de } if (lcu->flags & UPDATE_PENDING) { list_move(&device->alias_list, &lcu->active_devices); + private->pavgroup = NULL; _schedule_lcu_update(lcu, device); } spin_unlock_irqrestore(&lcu->lock, flags);