Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9047552pxu; Mon, 28 Dec 2020 05:21:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsW0ihldao6RIBw/k5myIeoJ3l5Zzu9l6j8Nsxi0UWEoVKU3I6OPQQmwfdN/8sURR2AVDy X-Received: by 2002:aa7:c543:: with SMTP id s3mr41600640edr.88.1609161695282; Mon, 28 Dec 2020 05:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161695; cv=none; d=google.com; s=arc-20160816; b=l4mq2Jy0xMrByQvQri4IAbK0f5kdipYUCbTi3ZOCTC/qWr8Gz9fm4ZO1p7k5A+uXUO TtsKy/e9DxpH5QVsAkvPqu6w7jQm8AxuhOf1vsRFbiu4MMX2QxnqD6Pe4PgNcsZDJwOH 0tezGPxCJfMh6QrcmbfS+iGX/PlYT+ltLYb/kxGYugYwor1CqpXCuge0L3u/LMM6FCbs BOopKTgHBLqeoP4drsIuxKdaoBhbyGuec/A4c2FKtqswLZy+dEBBnQbO92b5cT1ZL0J+ L28JQVXA0oI93CVVbLQ6b17rsM3gBQ7tSRhVWBOs8VKAnrUms8TM8M/r787NVQ5ikv2t 9FTw== 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=5rP8ykdViEe0hAQfJvD3ZkkXJA/oJraR8R/CzXETJxo=; b=aaMOf0778sVTxFa4fs+Yx3BLNcGBTZORYYzHQuCyZGhoEfDcDz5iq+0LQ+F7ZxLEs8 1Jpf6M6H3KT2ZPtRRj0Jdk73sEgs9eP9pL4OdhuuODShrKU787sn1ZT4XpQrCRTPOif7 xw36pK40fA1drC7m+Mnt7uJCXuXD72WmMvzOOH7ohQUwBU3T30jQMTzdpx4ideGnvAMT T25f+nLs6GOURKv+yVxY8XZ4g9woDqAEhwzWqbSeeQuma9PchM14q4vjIi/Yqfs8nR35 EVXdTfGTBiSB4q9m15MfRiYYViMfDrLnWCR+ME9wmS0n+hg7Xc86SQYAdmrE8TRG7msd scPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3sz0qUJ; 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 i8si21235721edv.161.2020.12.28.05.21.12; Mon, 28 Dec 2020 05:21:35 -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=A3sz0qUJ; 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 S2387423AbgL1NRK (ORCPT + 99 others); Mon, 28 Dec 2020 08:17:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:45242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387410AbgL1NQ6 (ORCPT ); Mon, 28 Dec 2020 08:16:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 82495207CF; Mon, 28 Dec 2020 13:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161377; bh=SnmQ7xExflvTQ9e7DPhplcTUzYhGNeJnVXpuzLjSSVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3sz0qUJDR6GMPNCz7+b/bRn7KcPuG0v7X0/8TAERDiaqv03WoSPicF6H4X/Ed0oL yGz9f0riTCHMCNmQGbFN1vSgzEd3Nhl7UwZ0YrQYP1dEcDMjDAcP7Ugf3ILOMwa+xn 704sCel7MJponvTgRBXlw1u4F8Vmy6tCZ5kt7w0o= 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 4.14 193/242] s390/dasd: fix list corruption of pavgroup group list Date: Mon, 28 Dec 2020 13:49:58 +0100 Message-Id: <20201228124914.180944959@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 @@ -634,6 +634,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);