Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp618205ybh; Tue, 21 Jul 2020 03:54:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyef7U4KdWqnNg7CYRqnFavDi9Ed3Z7LU9aISsA3JcWbr+Vd6xB0xxQEFClh6hjtUuUzN/ X-Received: by 2002:a17:907:426c:: with SMTP id nx20mr24480740ejb.548.1595328840681; Tue, 21 Jul 2020 03:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595328840; cv=none; d=google.com; s=arc-20160816; b=z/vqRX2jeHFfhO0Owg2ommf5Y8I8GuxWD2OWd/ZpT/aN/Vap1Apu6z2p5sbqnuTg/d xsJjYAW3nZN0Nai6z7Pi5bcDOCqdbgx9U9eiukz00fKA0KUzbkhvxAK1Q9Vl1UU8HF7q 4TR+H29rRZuaJfqX/4BzmwqiKnjCHu03GhhyvoO//ubiLUYEypUK8wf6kMczhszwCOkx g069zBx/z0B5FCZeMTWhkGaPKvk0N8K7fB8yHjHuZrrD/fmOw/AwZKzKKbI8LEHL0ocN yjaYLJ/YjVbVXjgkPlQVzgWn+MtlBONQTVqqFGhCWdI+Sk/aUf3DslV3MuYNe9gdB73i 5Dxg== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=a7FGaIHkD38JSVxPqaibb4DmZEBgCel4gb1OIq9hfcg=; b=voghYbiU/kZK1xh2aW/3EoD11EEnJ7sSCubGgQSLlz48m2zujsC5u644sKDnewh5o1 WHwXYVW88SL8TIj68ng5edIpS4GB4vBdQxHLDZG/nBJ00aiKDiJAeH0NRVvUgs5lkptq wCpgIPTd+166y9uUzvYOygkUQ1JDqaIsTBQD0nHHs4NayFTpZVisQnK3Vl/CkDOeD+L3 ec7KQuoePMtMNXoUGjiXgyNS9h6TPum+1ab2Ahwo71xsKyYLHo1ra3oQ0Zf9iLjwb/n4 RAtgFq++I4TDuNack2uhKu2VAjC+RbpxLc4OU+YHupj4KDUsTAPpukRRyLgzWgNlM9/G ZJEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EsifcGbo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si12594715edr.123.2020.07.21.03.53.38; Tue, 21 Jul 2020 03:54: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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EsifcGbo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727905AbgGUKxP (ORCPT + 99 others); Tue, 21 Jul 2020 06:53:15 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56136 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726127AbgGUKxP (ORCPT ); Tue, 21 Jul 2020 06:53:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595328794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a7FGaIHkD38JSVxPqaibb4DmZEBgCel4gb1OIq9hfcg=; b=EsifcGbog3Qg2GNlk10rGZ20HItvhhu0WLS6nNKv85RAs3mkvWqc1PT/XpV6+VDAmOS9Gn LlXN5+kOoi0CuLO1fdONaxGxhpUwQRAx2TuF3avE+vKM3pSu2PLdyVtuD9ncjjf6GRwo6O +eawD5YUfwKDYIPEp3a2N5e7QAA2LDk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-ukSVL_ZBNG-8BMv4MWvP7A-1; Tue, 21 Jul 2020 06:53:12 -0400 X-MC-Unique: ukSVL_ZBNG-8BMv4MWvP7A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 26294100AA21; Tue, 21 Jul 2020 10:53:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCBC78730C; Tue, 21 Jul 2020 10:52:40 +0000 (UTC) From: Maxim Levitsky To: linux-kernel@vger.kernel.org Cc: Keith Busch , Josef Bacik , linux-block@vger.kernel.org (open list:BLOCK LAYER), Sagi Grimberg , Jens Axboe , linux-nvme@lists.infradead.org (open list:NVM EXPRESS DRIVER), linux-scsi@vger.kernel.org (open list:SCSI CDROM DRIVER), Tejun Heo , Bart Van Assche , "Martin K. Petersen" , Damien Le Moal , Jason Wang , Maxim Levitsky , Stefan Hajnoczi , Colin Ian King , "Michael S. Tsirkin" , Paolo Bonzini , Ulf Hansson , Ajay Joshi , Ming Lei , linux-mmc@vger.kernel.org (open list:SONY MEMORYSTICK SUBSYSTEM), Christoph Hellwig , Satya Tangirala , nbd@other.debian.org (open list:NETWORK BLOCK DEVICE (NBD)), Hou Tao , Jens Axboe , virtualization@lists.linux-foundation.org (open list:VIRTIO CORE AND NET DRIVERS), "James E.J. Bottomley" , Alex Dubov , Maxim Levitsky Subject: [PATCH 00/10] RFC: move logical block size checking to the block core Date: Tue, 21 Jul 2020 13:52:29 +0300 Message-Id: <20200721105239.8270-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series aims to move the logical block size checking to the=0D block code.=0D =0D This was inspired by missing check for valid logical block size in=0D virtio-blk which causes the kernel to crash in a weird way later on=0D when it is invalid.=0D =0D I added blk_is_valid_logical_block_size which returns true iff the=0D block size is one of supported sizes.=0D =0D I added this check to virtio-blk, and also converted few block drivers=0D that I am familiar with to use this interface instead of their=0D own implementation.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (10):=0D block: introduce blk_is_valid_logical_block_size=0D block: virtio-blk: check logical block size=0D block: loop: use blk_is_valid_logical_block_size=0D block: nbd: use blk_is_valid_logical_block_size=0D block: null: use blk_is_valid_logical_block_size=0D block: ms_block: use blk_is_valid_logical_block_size=0D block: mspro_blk: use blk_is_valid_logical_block_size=0D block: nvme: use blk_is_valid_logical_block_size=0D block: scsi: sd: use blk_is_valid_logical_block_size=0D block: scsi: sr: use blk_is_valid_logical_block_size=0D =0D block/blk-settings.c | 18 +++++++++++++++++=0D drivers/block/loop.c | 23 +++++----------------=0D drivers/block/nbd.c | 12 ++---------=0D drivers/block/null_blk_main.c | 6 +++---=0D drivers/block/virtio_blk.c | 15 ++++++++++++--=0D drivers/memstick/core/ms_block.c | 2 +-=0D drivers/memstick/core/mspro_block.c | 6 ++++++=0D drivers/nvme/host/core.c | 17 ++++++++--------=0D drivers/scsi/sd.c | 5 +----=0D drivers/scsi/sr.c | 31 ++++++++++++-----------------=0D include/linux/blkdev.h | 1 +=0D 11 files changed, 71 insertions(+), 65 deletions(-)=0D =0D -- =0D 2.26.2=0D =0D