Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3323935ybl; Sun, 8 Dec 2019 12:25:50 -0800 (PST) X-Google-Smtp-Source: APXvYqywI6rJRy5ENKaiH2BawzB1oUDZt6ro/oVIo/AwlgjzZcJLBodVd2ZDnApu804p/HlDc0kl X-Received: by 2002:aca:b844:: with SMTP id i65mr16711573oif.56.1575836750580; Sun, 08 Dec 2019 12:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575836750; cv=none; d=google.com; s=arc-20160816; b=duCU5YqvO0gAk+TMpTi63hWzwyamQJW5rEXJi587yXATckA1jdx8W/gaO0PbgAdEcT HeItYbCQjZPsZl4ywsQItN+5OhHOCGQn/RQ88YtjE1sqY+yEJkyEBkxInlCZ9DzgN1Rc mtiVnACqN++PWi0E75zTb4wKwRRZbWh+rKNh8KFHy+UuvKEyBWyvw3mCXYbCFmwBdcXt MUbT3h4+juBIqjqih2W5/Qzejy5Juw8W+ty/E7IrcXd/6HjsMhUDIcD69714QXz1Ark8 +NiBGvPAVY5Don1fJ3redcERkxAYWynZJu68KFjdB0QiIIa5y8dCyFnXZ8EX2GNd+Bzb PAYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to:dkim-signature; bh=kBNic8yjhi7MwhQU+7ms1kdN9cx8HM4qRMBV2epx5jQ=; b=EJkCmfWLpIyseW3Foydc0GfOnRcMl8irNEgCSfnDX2tcGkauoPvgVy6La6WnPjX5Ae c7kwYYMkY6x3i0bVxn05EdJQC7A31HKbRk54uHpCyXlCVXqvPYmCrnwveWTX6eNyqPwn 3Sa2QzJjdWza2DA8PZ4pvBLl+GusYOVED7oWMc1iqgYCQVxIN7K2SJGJpPTClLg4EJqB 83VBsXr21cpgJz5dHWTlnudFKEb8CSlLInQZpUO+vi0y3XKzgAvel7ypy4sOez+Bav7X m3CdOfuArfBvkR7jUoIBZcrH7rWCDUERhLg+j1abNEBS8epwPzgXCuanYR19OZkQ0qib nR7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kpB7c36+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si11349437oto.293.2019.12.08.12.25.37; Sun, 08 Dec 2019 12:25:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kpB7c36+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbfLHUQT (ORCPT + 99 others); Sun, 8 Dec 2019 15:16:19 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40349 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbfLHUQS (ORCPT ); Sun, 8 Dec 2019 15:16:18 -0500 Received: by mail-wm1-f66.google.com with SMTP id t14so12632995wmi.5; Sun, 08 Dec 2019 12:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:references:from:autocrypt:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kBNic8yjhi7MwhQU+7ms1kdN9cx8HM4qRMBV2epx5jQ=; b=kpB7c36+OkSf8XzCEH4D6Eq7IlqPe8VdEJYs8B6VFGm11HMdJ1DSaggVUjottRhEEA OC/rRW1bd4SPY6lcVGNWyrHOBEbkLvHF1l1EONIeWNDvMTnnuuxhmeCepivC5nF7vWCk Y74C6AOERFd8/CzAK18HwM0zbzZKv9ruxyXQJBjkYcFx3Sj//BHv3QBONkl12c8DKZQ7 p1o5NO0AdZ7sh80IDE8BSO7ntNiXMY+5sDptkWPeyOglKRd19Xdwo5/bV9zCAqOqZvYa VG7CMvHayrXdFi9U2yBq/ulb2Qxzdbs4grYHBUxZ6Ogt/3uWiIbbRlstv5k377cMAoZM t3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kBNic8yjhi7MwhQU+7ms1kdN9cx8HM4qRMBV2epx5jQ=; b=I7eAcbr/nYc1sJbEOoE7a/S5Dsf4rR+8ceWq21anQhoOs3MRCMKgFysDiDGzVUPA/j etAqgIVoVYwLL0bcqEDUtojWVuyhFkpGI3RnG/6bAwzYHpRWmyLcgLtp1n84Mtq572PQ ni1GP576Y4rJKlH7CYkxSI9jV4aWAblA6ZAbnrkVHJPM/B+GEtnsN6c1t5o7UXUsuVHn bz+DiQmbO1JyiUAqPFI9AcabkF4YBl2/pkLCx/SjLWSDwtMj4aSSfIbggfGJyJ3APi27 XZtWfAgCxF1jLRLIJ11UCDOJpfiiNYeHxM9M1PA6QFrK38J2fa4yJ+qQ7MYENdM0mnPh t+lw== X-Gm-Message-State: APjAAAWiQ3zgkD3+w//o5JZ75i0Z0+zVmssjL3swH9NOjiXEMor76eTL gPkIVEmvVV0ogOMMO6uUOn0= X-Received: by 2002:a7b:ce81:: with SMTP id q1mr21735651wmj.47.1575836175598; Sun, 08 Dec 2019 12:16:15 -0800 (PST) Received: from [10.68.32.192] (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.gmail.com with ESMTPSA id n12sm11155867wmd.1.2019.12.08.12.16.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Dec 2019 12:16:14 -0800 (PST) To: =?UTF-8?Q?Moritz_M=c3=bcller?= , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@i4.cs.fau.de Cc: "Philip K ." References: <20191208194534.32270-1-moritzm.mueller@posteo.de> From: Denis Efremov Autocrypt: addr=yefremov.denis@gmail.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg3fMxo8+ y6IxmXt5tYvt+FfBqx/1XwXuOSd0WOku+/jscYmBPwyrLdk/pMSnnld6a2Fp1zxWIKz+4VJm QEIlCTe5SO3h5sozpXeWS916VwwCuf8oov6706yC4MlmAqsQpBdoihQEA7zgh+pk10sCvviX FYM4gIcoMkKRex/NSqmeh3VmvQunEv6P+hNMKnIlZ2eJGQpz/ezwqNtV/przO95FSMOQxvQY 11TbyNxudW4FBx6K3fzKjw5dY2PrAUGfHbpI3wtVUNxSjcE6iaJHWUA+8R6FLnTXyEObRzTS fAjfiqcta+iLPdGGkYtmW1muy/v0juldH9uLfD9OfYODsWia2Ve79RB9cHSgRv4nZcGhQmP2 wFpLqskh+qlibhAAqT3RQLRsGabiTjzUkdzO1gaNlwufwqMXjZNkLYu1KpTNUegx3MNEi2p9 CmmDxWMBSMFofgrcy8PJ0jUnn9vWmtn3gz10FgTgqC7B3UvARQARAQABtChEZW5pcyBFZnJl bW92IDx5ZWZyZW1vdi5kZW5pc0BnbWFpbC5jb20+iQJUBBMBC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SUk2379CQWHkhyt1kZJUmC3bDEYWgioUm8KPF4J/5umvdnyndzZzm70Xu+o iBDEsOtImoDROgBRc7hfxr6CB29qA1CF+M/vw9EwVh/QAzabZrhPi2Z5T1AABM0YFBbZTeS7 ST/KYQ== Subject: Re: [PATCH] floppy: hide invalid floppy disk types Message-ID: Date: Sun, 8 Dec 2019 23:16:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20191208194534.32270-1-moritzm.mueller@posteo.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 08.12.2019 22:45, Moritz Müller wrote: > In some cases floppy disks are being indexed, even though no actual > device exists. In our case this was caused by the CMOS-RAM having a few > peculiar bits. This caused a non-existent floppy disk of the type 13 to > be registered as an possibly mountable device, even though it could not > be mounted by any user. > > We believe this to be an instance of this bug, as we had similar logs > and issues: > > https://bugzilla.kernel.org/show_bug.cgi?id=13486 > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/384579 > > This patch adds the option FLOPPY_ALLOW_UNKNOWN_TYPES to prevent the > additional check that fixed the issue on our reference system, and > increases the startup time of affected systems by over a minute. Does driver blacklisting solves your problem? Or you have real floppy drives in your system along with these "spurious" ones? > > Co-developed-by: Philip K. > Signed-off-by: Philip K. > Signed-off-by: Moritz Müller > --- > drivers/block/Kconfig | 10 ++++++++++ > drivers/block/floppy.c | 6 ++++++ > 2 files changed, 16 insertions(+) > > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig > index 1bb8ec575352..9e6b32c50b67 100644 > --- a/drivers/block/Kconfig > +++ b/drivers/block/Kconfig > @@ -72,6 +72,16 @@ config AMIGA_Z2RAM > To compile this driver as a module, choose M here: the > module will be called z2ram. > > +config FLOPPY_ALLOW_UNKNOWN_TYPES > + bool "Allow floppy disks of unknown type to be registered." > + default n > + help > + Select this option if you want the Kernel to register floppy > + disks of an unknown type. > + > + This should usually not be enabled, because of cases where the > + system falsely recognizes a non-existent floppy disk as mountable. > + > config CDROM > tristate > select BLK_SCSI_REQUEST > diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c > index 485865fd0412..9439444d46d0 100644 > --- a/drivers/block/floppy.c > +++ b/drivers/block/floppy.c > @@ -3949,7 +3949,9 @@ static void __init config_types(void) > } else > allowed_drive_mask &= ~(1 << drive); > } else { > +#ifdef CONFIG_FLOPPY_ALLOW_UNKNOWN_TYPES > params = &default_drive_params[0].params; > +#endif You can't just skip it with ifdef. This will result in uninitialized pointer dereference down the code. struct floppy_drive_params *params; ... if (type < ARRAY_SIZE(default_drive_params)) { ... } else { #ifdef CONFIG_FLOPPY_ALLOW_UNKNOWN_TYPES params = &default_drive_params[0].params; #endif ... } ... *UDP = *params; // << HERE > snprintf(temparea, sizeof(temparea), > "unknown type %d (usb?)", type); > name = temparea; > @@ -4518,6 +4520,10 @@ static bool floppy_available(int drive) > return false; > if (fdc_state[FDC(drive)].version == FDC_NONE) > return false; > +#ifndef CONFIG_FLOPPY_ALLOW_UNKNOWN_TYPES > + if (type >= ARRAY_SIZE(default_drive_params)) > + return false; > +#endif > return true; > } > > Thanks, Denis