Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9105685pxu; Mon, 28 Dec 2020 06:46:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXOtFYVT6mE1V9r//bZYFy7WeAPeMm6KLes9aUJVVDyULNIMuxqZgkEK7ScDKFVmh3By/m X-Received: by 2002:a17:906:32d6:: with SMTP id k22mr42430150ejk.457.1609166818122; Mon, 28 Dec 2020 06:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166818; cv=none; d=google.com; s=arc-20160816; b=orRKqi96JETgqEdvU79n26rVL6uNP2VfjTO9Q+2sROHg1NXHQnPrOz1GeCOP0TuN5m n0p/Ps/UV1Yp6qzAxMg1MM/FCc4hTug6sFC4o4zENuUxHdm952ZjQxjF/8qG0xH2mldc Lod8vaJfdevO5I6dXuhhdPfCe4yrD6UvjcinZBs8g++UT1tJDdrs+NG2M+icDo/7DLyw vGYYtBi+wsfiaVfMDojrtlF2G6ldfbsjNZ0XbgsSA35TSSWVYWFV/JrBStcw8prPMKOX 1PvQtJp5D8biG2g/gANrGodwyfGyasD4AI7kEBDl7JL8e88AWPby4mxuta56J6Wk1rtU 2L3w== 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=bKc3H4IFHbTZHJWeMk1tHfiBGEKlxZuj7lktVmhdWGE=; b=EmhqmjJUWqypXIhP/1rmG3+rm1D5UigUax7S0nkZRqeAUOcy7Lu/IoeX1wa68aOMQO f8dGYQ5j5z8s7PYJ49knrJeo/Tx07dSgcrrwmZAfzn+xCAn5QT3maBOMQYJwZxMXxr3d o3GJgsg6Pa9tJaCOh8SfWC2gqMyR2W8zN2M6+CyHqYyJ5GGOwGleL1eF5TfrKXe6ASrx O20oMmwjso8ppTz1AVDAEyLritvekPc3uzOUbyAmhzV6Am+XmEAlU+1+BlTHuYW16lQp vjxrP6+h/jg9gn5M/J0jYfC1RZLm4lw9SRooMCRw89N4J2EXFzjBT9i9fxZyE/twfekF q/FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=almREdgT; 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 j17si19367677ejk.231.2020.12.28.06.46.35; Mon, 28 Dec 2020 06:46:58 -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=almREdgT; 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 S2392316AbgL1OoZ (ORCPT + 99 others); Mon, 28 Dec 2020 09:44:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:33142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503205AbgL1OZ1 (ORCPT ); Mon, 28 Dec 2020 09:25:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2402A206D4; Mon, 28 Dec 2020 14:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165511; bh=hZO3f+sU8DLpmWcx9RIoRxYScZUiG1znp4VtXoefxS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=almREdgTXiPwmBn8reYup59gV8k+AgtWs9UcY6E4rPZFP0f4V1Xn425ncBsRchI5G aobWlpXRMojZQCEpDt0qRe8Lu7ETKH0Tt7OanjNxxJ2TRjPCUU1MpB0DshPkqR6IAm kNbKB6YlOVQ7V9x5jsKGhQLdLR24nSjOGyhOHNJo= 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 558/717] s390/dasd: fix list corruption of lcu list Date: Mon, 28 Dec 2020 13:49:16 +0100 Message-Id: <20201228125047.658380897@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 53a7f655834c7c335bf683f248208d4fbe4b47bc upstream. In dasd_alias_disconnect_device_from_lcu the device is removed from any list on the LCU. Afterwards the LCU is removed from the lcu list if it does not contain devices any longer. The lcu->lock protects the lcu from parallel updates. But to cancel all workers and wait for completion the lcu->lock has to be unlocked. If two devices are removed in parallel and both are removed from the LCU the first device that takes the lcu->lock again will delete the LCU because it is already empty but the second device also tries to free the LCU which leads to a list corruption of the lcu list. Fix by removing the device right before the lcu is checked without unlocking the lcu->lock in between. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -256,7 +256,6 @@ void dasd_alias_disconnect_device_from_l return; device->discipline->get_uid(device, &uid); spin_lock_irqsave(&lcu->lock, flags); - list_del_init(&device->alias_list); /* make sure that the workers don't use this device */ if (device == lcu->suc_data.device) { spin_unlock_irqrestore(&lcu->lock, flags); @@ -283,6 +282,7 @@ void dasd_alias_disconnect_device_from_l spin_lock_irqsave(&aliastree.lock, flags); spin_lock(&lcu->lock); + list_del_init(&device->alias_list); if (list_empty(&lcu->grouplist) && list_empty(&lcu->active_devices) && list_empty(&lcu->inactive_devices)) {