Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp564200ybt; Wed, 8 Jul 2020 06:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNAv3WP7kw7aDmkgEQFhMmR6euzVDCBCLEAqascWMNs1bMsEw2FFmQBNyiv0Y6jhkIoGQ3 X-Received: by 2002:a17:906:e213:: with SMTP id gf19mr2491004ejb.433.1594215363580; Wed, 08 Jul 2020 06:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594215363; cv=none; d=google.com; s=arc-20160816; b=Ui1x5Ows/ef73E56h/CplC7oKeXjucKEUXpTksx7BJEQeOgsSrWN4fgoMMHz3GM4vZ DEWOEsQqR2d/yEXEfXkcOJoQJO6SkoTLG40IlL7BDTQ6ZLe6ngDF2bCoy3XslkakpCVU GfnJhym0DllU3Lf8laUncw6nOetHtoM204PUSYYKv1la8xffxiFfJJ9aLPwMal+70acU zp2DdenI4cfgX6cYHGZWaSWH7e5s280H/ofakupoqO43PWMrOX2qohXxaJDyDyHlzNqE II8FxNTNsBlSRoNceNale/wUWEfkBFSv+f04vH5VwvorHY0xNWv2MH/gBUb/VGN0TsoL 0Ugw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:date:from:message-id; bh=gA2n6FT8GaywJiZLxw0aRp7knQCooIjjS6BBC72qBd4=; b=TlA4Wz/aYQJ2eD8yJ1IVo42XcbC9LeIAh1vacuQ/MEIa5Q6JP6u3WgVZBdXDidNo88 IlIpf5377IA53hDggIWpJypy2DVx+w4u66BqIly2DLpdd9QrJOiw+SAk+lXf6DSNzWpB MZ+070F4NzRI4DeAnw1SWSdQn+qA6tz70XlKTT/X8CZXoejehrQWn1T06mH/5eMnnpxI 8clyqUzbQia3HyYODujCiwU9dPStmUeE9R757GH2azzVKnEYfGEXeRB404qk2jpawiSz DVyK3ftcSce2LLHW1EUKHbC5eyJYnGR87AR9qtlJNezeHaM3cldknZ8rHSaLpTkM6/rl wzPQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dv20si16980326ejb.582.2020.07.08.06.35.40; Wed, 08 Jul 2020 06:36:03 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729684AbgGHNeH (ORCPT + 99 others); Wed, 8 Jul 2020 09:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729436AbgGHNeG (ORCPT ); Wed, 8 Jul 2020 09:34:06 -0400 X-Greylist: delayed 420 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 08 Jul 2020 06:34:06 PDT Received: from mailout1.hostsharing.net (mailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5fcc:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E0F1C061A0B for ; Wed, 8 Jul 2020 06:34:06 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by mailout1.hostsharing.net (Postfix) with ESMTPS id 517EB10190FA4; Wed, 8 Jul 2020 15:27:04 +0200 (CEST) Received: from localhost (unknown [87.130.102.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 0F1416106EC8; Wed, 8 Jul 2020 15:27:04 +0200 (CEST) X-Mailbox-Line: From 40dc1c5997ecc8784fc98706c5321f9d48240310 Mon Sep 17 00:00:00 2001 Message-Id: From: Lukas Wunner Date: Wed, 8 Jul 2020 14:48:47 +0200 Subject: [PATCH 0/3] Fix races on device removal To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Dan Williams , Geert Uytterhoeven , Pantelis Antoniou , Alexander Duyck , Mark Brown , linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prevent dynamic SPI device addition below a controller which is being removed. To do so, set the controller's "dead" flag using kill_device() (patch [3/3]). Serialize access to a device's "dead" flag with a newly introduced rw_semaphore in lieu of the device_lock to avoid deadlocks occurring with the new use case (patch [2/3]). Add a missing check for the "dead" flag upon driver binding (patch [1/3]). Lukas Wunner (3): driver core: Avoid binding drivers to dead devices driver core: Use rwsem for kill_device() serialization driver core: Avoid adding children below a dead parent drivers/base/base.h | 2 ++ drivers/base/core.c | 47 ++++++++++++++++++++++++++++++++------------ drivers/base/dd.c | 12 ++++++++++- drivers/nvdimm/bus.c | 8 +------- drivers/spi/spi.c | 3 +++ 5 files changed, 51 insertions(+), 21 deletions(-) -- 2.27.0