Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp569527ybt; Wed, 8 Jul 2020 06:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmId74zaJpHZzcc92csi+RgIxC7iZ7z5ZW7BvV9aVphmXUS7L9WVW/Ws9bpHEWPBPlQx7a X-Received: by 2002:a17:906:c30b:: with SMTP id s11mr53582863ejz.263.1594215780339; Wed, 08 Jul 2020 06:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594215780; cv=none; d=google.com; s=arc-20160816; b=v91IAEJ2+JjCs7lcTyYlHVG4EN3HcDA6WvZImSiP2C2KAeZ9x1aJUHwal+BeQ9a3MH +H+owCHI7bLLycty0mqC37rXHT5DCLx7zerhQhH0nIp7E02oxRdbTdIQngd3xdBwoa+y NxOTLdG8KwFVfs7LxtVs9nC/3OjwtfoBMr+n9XLoY5JJLAj841QH4makIjsRrsEscgkq go+U+MIzO0NhvWO0XWPcqe8hey68dSbCfPuwNW1U4e8QlYtWx1ORZIhxFz/BEK696J8r 8OtgiPIG/PKcp8vxGVrbkGczAFEIGSde8hS9id1Tz1QV3a023jVMNgVyT3pqDhgC5dH7 BCOg== 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=w7D60vhPRhWWFl6mKWQwbwzRd5CmHC4dTsW8BDUnYos=; b=01DV2wPefxdmjWdEY88uPsRT05A6blphIkqlLeuuzq2/HMA6y1R8SRV5gjHGwS7XlV NkhL5qSaEgZhpGwzDIsoJxFy9hgUC7gQ368cLOuwfstHhc6W94j879gxgteNA7w52MD0 XuOm9AmqCaxfu0EeShBrSzCfgo2eIZZsUT4zcRh2rpKIVUhQEHcI7aKEPKq2l7ofoSbt iR9H1WZDlks9Shslykf627SGMpLfKy1VYKZdRPFrO0mEmR9NZ8RoOLys9HmClymAyrzr gJkyaIzDQ9mZwLDEoK/6qw8+J5tjGqNrvADnH+mDrgfqZ4xSQ5d65oFh9g/mAa1pPsbA CvNw== 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 br6si16187923ejb.203.2020.07.08.06.42.37; Wed, 08 Jul 2020 06:43:00 -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 S1729697AbgGHNi4 (ORCPT + 99 others); Wed, 8 Jul 2020 09:38:56 -0400 Received: from mailout2.hostsharing.net ([83.223.78.233]:37193 "EHLO mailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728210AbgGHNi4 (ORCPT ); Wed, 8 Jul 2020 09:38:56 -0400 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 mailout2.hostsharing.net (Postfix) with ESMTPS id D416B10189C99; Wed, 8 Jul 2020 15:30:00 +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 94A936106EC8; Wed, 8 Jul 2020 15:30:00 +0200 (CEST) X-Mailbox-Line: From f2d349b5ba67b5ca70cb19577725167642eb69c5 Mon Sep 17 00:00:00 2001 Message-Id: From: Lukas Wunner Date: Wed, 8 Jul 2020 15:27:00 +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, linux-spi@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 | 49 ++++++++++++++++++++++++++++++-------------- drivers/base/dd.c | 12 ++++++++++- drivers/nvdimm/bus.c | 8 +------- drivers/spi/spi.c | 3 +++ 5 files changed, 51 insertions(+), 23 deletions(-) -- 2.27.0