From patchwork Tue Dec 12 08:57:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 10106511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D34F96032B for ; Tue, 12 Dec 2017 08:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C627229B36 for ; Tue, 12 Dec 2017 08:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB32029B37; Tue, 12 Dec 2017 08:58:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60A3E29B3B for ; Tue, 12 Dec 2017 08:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752303AbdLLI57 (ORCPT ); Tue, 12 Dec 2017 03:57:59 -0500 Received: from mx2.suse.de ([195.135.220.15]:46997 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbdLLI55 (ORCPT ); Tue, 12 Dec 2017 03:57:57 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B63FEADDE; Tue, 12 Dec 2017 08:57:55 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , Bart van Assche , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 1/4] block: check for GENHD_FL_UP in del_gendisk() Date: Tue, 12 Dec 2017 09:57:49 +0100 Message-Id: <1513069072-32514-2-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1513069072-32514-1-git-send-email-hare@suse.de> References: <1513069072-32514-1-git-send-email-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hannes Reinecke When a device is probed asynchronously del_gendisk() might be called before the async probing was run, causing del_gendisk() to crash due to uninitialized sysfs objects. Signed-off-by: Hannes Reinecke --- block/genhd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index c2223f1..cc40d95 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -697,6 +697,9 @@ void del_gendisk(struct gendisk *disk) struct disk_part_iter piter; struct hd_struct *part; + if (!(disk->flags & GENHD_FL_UP)) + return; + blk_integrity_del(disk); disk_del_events(disk);