Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9039881pxu; Mon, 28 Dec 2020 05:09:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsb3pnlDNE5wKJGox02HngUMSPRVVkjFl2mKR0d4Xor4m2HfNCcAct7jyXrNXyQoHc43cU X-Received: by 2002:a17:906:c09:: with SMTP id s9mr41540206ejf.539.1609160981159; Mon, 28 Dec 2020 05:09:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609160981; cv=none; d=google.com; s=arc-20160816; b=e4mj/3m1A72OOwVXmyITi9QFCn4I/Xvxhnr6Oyd8mEUimSwIGpOdH6fTslsANm0oLU +t7IyL8aLNquUQjLiqxJ8LydxVuQPwOF3nXE+a7e4VPW9FkL7wNj+OGhRhOxGngV9sSt Hr6lk5f5ZcwUjD0c7Efdu+el+p+7ZJoXCkT9LSFrmA7BbLb075pj/4vRPFvJJtmeAa/I oZPDBOryFJ9adbzKp4sRoFoqZJf93PMNzGCilFxJgpx3XfO4k5kj6ICXdbrbUNDO4Isw Yf/y/HWn97Pboa0J+b7D+Lv7zmlkRbv2RGbPcq5IHUDgQSvgnbTEQEsJTwt7EAlVNMyG 0OnA== 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=4CSd5NSN8Iq3EW3R2YqbKC+QK+CVDCDBvKgEoAhlbHk=; b=YFzXk9BPcplwtFs5TanRI1Gd8DzCuScqItd13SYBD23HJi5MG4V1DEZ6fWL+/iR0mq nGfsajzfV+Fr1gK+F0PgYjV+9NXVS7xzLTG7Q0HDcWbd1Ll0bDKQX//N94GcDhLK66D8 b/W3RI8s0Kzg7cfNlxxgc/TBM4AjhO2K3O6E5Ymo0RiQYE1Tga8pHS/bHC4t3YIPagqF v8qgAl9N0pyCOPvmBdvVoHQl4rpoIoul7QjLyEVdgrPwOd2UfN+LcJqSvdb0hadV4IAT NDXbAyF4vgqjj0/Cn7TOhduX0jxirfNlUwqAkQRl3cuDdaeMT8+BFrzubxzCgEk3rY93 4/lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rmyGNQVI; 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 jg19si17721438ejc.365.2020.12.28.05.09.16; Mon, 28 Dec 2020 05:09:41 -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=rmyGNQVI; 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 S1729568AbgL1NFu (ORCPT + 99 others); Mon, 28 Dec 2020 08:05:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:33420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbgL1NFk (ORCPT ); Mon, 28 Dec 2020 08:05:40 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C3CB22573; Mon, 28 Dec 2020 13:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160699; bh=sWZDXI2SuOQIdjm9N+JmY1fsllal6fy6WFk2SIhExhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmyGNQVIWA7yLubmaTPpJm6+wFS/NtufWv+aYyHV/HOGuBcLkFweVNp+s+aSC/3eT rG7z7SlhwJjIVXEXkZYnqL7j026pJlvkzOKrUPnJKym61jSya+doZXMSwaoBaGwsx+ CV8wwyEQxvOkGac9s82mC+MTnL6lZrlpTIsjU/k8= 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.9 140/175] s390/dasd: fix list corruption of pavgroup group list Date: Mon, 28 Dec 2020 13:49:53 +0100 Message-Id: <20201228124900.031580877@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -633,6 +633,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);