Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4334226ybl; Mon, 9 Dec 2019 09:06:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzQdlkBaswnqgWZaJgGH1KHn6r7FmD23FG3v+93vLtx6q3CW0Jgffpyv/bH2lJbT79QmrdF X-Received: by 2002:aca:c646:: with SMTP id w67mr24181177oif.171.1575911202662; Mon, 09 Dec 2019 09:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575911202; cv=none; d=google.com; s=arc-20160816; b=SjVUQ96ixKM552DmmyGXKIvv3L2i8o1U6HIMzA4hUvUtZBesimnKe1lsIuXDL4AJVz SD8LUcQXRxIYCvtuoQmfYnw4xheSSbgzv1f5ur+D1a5Un+/eJAPp+z5EiPh3ClSocAQ0 NvxbSlB1+QmtsRzcJGWKMOLZilHkH+oio34KWJgZrM+HQn3mL6NhyMlHDJiHT46teZ+0 v7yI55IrepDP98vPpCkrPfQsaJDZG3d2qvNexKI4Jkytjp9CtxRDDFodzTJ0nXy5b2tb eEM6MqNvWRePCiBH9D8BbuR3F1hLbcx2dnQum3UZXqN4p49+1b1RxIU18j/ZkdxOz8k4 eTeA== 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:reply-to:autocrypt:from:cc:references:to; bh=gH9b/JKQN180XqrOwZv5Ek0ujBJf+ota8Io7VWO3t8A=; b=YpLCBExjw7F6Pv64wBwEjSK/FAf/MxxXBxnRTiAlLYqBAZ7WKLgZ4rVfCoRUfucC6/ YaUa+wfrzyOK8seHjBB+GxTSG+M5oLw5m+jLyLwCQc+h7OvljC/hLx3HMnYilvLa/ojI /URiHeriVu/bT7B2EjuIVixD1/vwi7vYV8O0X9Jybl03RX5ugoANjZAxqdGF/yC/+Tn8 ChylGWWUS744zsBTinmn6P1s8HjYWWuO7Olz3jIdM/OcUE1FIwE0A2P+tT5NNPn9IzJI Eed92c1W1vFWq4lKiYjGzzbjOv+Zgeq3kCnkUrvCOGl1xZUx97NXyVA8ISPAOeDugRbj mpvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si126040otl.158.2019.12.09.09.06.28; Mon, 09 Dec 2019 09:06:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbfLIREh (ORCPT + 99 others); Mon, 9 Dec 2019 12:04:37 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52794 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726290AbfLIREh (ORCPT ); Mon, 9 Dec 2019 12:04:37 -0500 Received: by mail-wm1-f67.google.com with SMTP id p9so76868wmc.2; Mon, 09 Dec 2019 09:04:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:cc:from:autocrypt:reply-to:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=gH9b/JKQN180XqrOwZv5Ek0ujBJf+ota8Io7VWO3t8A=; b=TKS0XMEP6XtszZCthM7zYEAOiHd1NMxLIygzRZr+n/0HNnlbXxXnU2knumBxhllgAG JmeaTyZIebdcbj1GFnwK5YxgIl7QvcLmPYRiF3Fcg0X4Kt4/C0lTYn08YA8I+Rd+kjkX yMPacLNuNBfNzko58K6HTRAyJ10juizpOkdv6hSBkZMwCRQ0Iej3IYMCqo+qNPRY/Rod wNCT1o1GAQM0KJ2sWa/W9ZN5N0jSOErVwqgwHi1kVLCxrfOT6ewTMhNN/lTP7GmQWtR4 9ZYknFF0TTLnDnQoem/+sjpterz349/R8CT83Na+StjcP40qYmCMdE9JyyUzsCeBkixG d2vw== X-Gm-Message-State: APjAAAU1K+7HZH7/pLwsZrsVWBEUGNi194KVi0rk60z3ZQytrYfPmU/V yLvWeK/WbHs5xNRcDGNEW5s= X-Received: by 2002:a05:600c:54b:: with SMTP id k11mr11719wmc.63.1575911074229; Mon, 09 Dec 2019 09:04:34 -0800 (PST) Received: from [10.10.2.174] (bran.ispras.ru. [83.149.199.196]) by smtp.gmail.com with ESMTPSA id r6sm49671wrq.92.2019.12.09.09.04.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Dec 2019 09:04:33 -0800 (PST) To: "Philip K." References: <20191208194534.32270-1-moritzm.mueller@posteo.de> <87h82ajzqd.fsf@bulbul> Cc: moritzm.mueller@posteo.de, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@i4.cs.fau.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 FYM4gIc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mcbzjz524xdHArR33SoVyLe 0ss42zPJNn5khdBTPvPf4T9dWka7OvqjB0nf7Nzd49IUdlMbLJIvKusfi8VNWh0tBRZEpdJv EomswBndc8uKVwth4Qh7LRduDbuYlSz0cJcRUv/qN5wdWVk8LvCOrNmReUwIAXxDjVeTCGB9 3zm+fq/x2D8nu6bkpkNiwl8u1+SCLJwKMUq3BWKvZxnxzXF4Zucelo2AtCs/JeJX8FqPDyKW fMee74Ex9TyOUeFnUUIoy8SwlvwGorqBGLjiwKFuPNV7WW9BkUXvk5vc/3wm5BL3sj4gyu6G WoQTO0HVhBFfJqiaDmd8cajJSa8SjPUgxfmrgeM1hs+YxswgwMf9KjFK1Z9vr/IuKBCluiFH Ve2sVjZPWvhBeSUk2379CQWHkhyt1kZJUmC3bDEYWgioUm8KPF4J/5umvdnyndzZzm70Xu+o iBDEsOtImoDROgBRc7hfxr6CB29qA1CF+M/vw9EwVh/QAzabZrhPi2Z5T1AABM0YFBbZTeS7 ST/KYQ== Reply-To: efremov@linux.com Subject: Re: [PATCH] floppy: hide invalid floppy disk types Message-ID: <04f0dfb9-d25a-d9a3-74cd-538165a8bfa2@linux.com> Date: Mon, 9 Dec 2019 20:04:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <87h82ajzqd.fsf@bulbul> 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 On 12/9/19 12:04 AM, Philip K. wrote: > Denis Efremov writes: > >> 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 Well, this is a ten years old bug. It seems like that time it was decided to fix the problem either by blacklisting the driver or by disabling the BIOS option. I doubt that many people are facing this problem since then. I think that more-or-less modern motherboards don't have this issue. >>> >>> 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? > > No there were not, and blacklisting would solve the bug too. We just > thought that fixing the bug this way would prevent the issue from > appearing in the first place on systems that have the floppy module > enabled, in the first place. Hmm, I would say that driver blacklisting is a more proper solution in this case. I doubt there are people with this issue and real floppy drives in their setup. Altering the default driver's initialization scheme seems superfluous to me. This will force users (if there are ones) who depends on this behavior to rebuild the kernel. blacklisting doesn't require kernel rebuild. > >>> 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 > > Oops, you're right, will fix. > >>> 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 >