Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3400804pxb; Wed, 13 Oct 2021 05:23:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym+n+fEcHymV8tTnSSG/NSEl91KbMy0AcXP0S9nIQCosxyhf3bDO1gxaLd7bhlEy/EGALN X-Received: by 2002:a17:902:cece:b0:13f:2799:62c2 with SMTP id d14-20020a170902cece00b0013f279962c2mr22201016plg.73.1634127779764; Wed, 13 Oct 2021 05:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634127779; cv=none; d=google.com; s=arc-20160816; b=IAzClbcKxEK4Xfj48dID+dC3BrT1gc+7/tpmnWm/Z/QrGSQk68SRFVu6k+EOYBK7I/ GrZbX4EBXrTbW0xvz8jyZVfm0TJqwKYnyFelw/4t/dB/+P6r+j5+Pc0tqZZU24MkEVOZ i8OcYGasdgH9ktLQ02ohIzwj5KvV0wJYvvWQOQF15vsRX49eQGqvuO5wsjdj8bUQVhkP u3lpsocP+1EEKK+IM/UOJtFB3K03fTYN79RGFzbP53IT7QvQnBzHDE79QPsFS712a4d6 0Z4JwDVw7z9zvpprGyZWxsv9SeYNUshVnlK+Im8vovS+TFHVWIuFfcUl1Hy9vHwpHJcX Zd9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aI/a1CuIplLBzfM7K3SKE+P3jJtMmkhDmL35+rhqKP0=; b=ivrDAxX0XBNKQ0324vDDw5WvYTJu1DAy4jZa0MVQBHn5bvU3tORlhtOF+H332J1KvL RWlj7sH9tbPbJgfC/as1u+GtNLC8xtCFuoDhZjvcW2+78GjW592kodk++3zuV97UOUo0 laRhBkUdFExe1ZvIgpnfyc931l0LccnFsSCrDUe2EInWTDSEA0bUT20mHswhcwUfHjHf he0w3/ASoWz3ZSd6z9rCun67c823HAAWzvnU6pDGbSa9oXeUGxkmpsQHmfgqwxE+ZIeu RKC6omVedxyiXXmARi4C0i+i3JggO+D0nIt1YNzFbj9L4ZFvyw8oSEuTj5T/lX9g8ctQ Ko4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C4LauQ+o; 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 v11si17534654pgj.19.2021.10.13.05.22.46; Wed, 13 Oct 2021 05:22:59 -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=C4LauQ+o; 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 S229715AbhJMMXi (ORCPT + 99 others); Wed, 13 Oct 2021 08:23:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51360 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbhJMMXg (ORCPT ); Wed, 13 Oct 2021 08:23:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634127693; 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: in-reply-to:in-reply-to:references:references; bh=aI/a1CuIplLBzfM7K3SKE+P3jJtMmkhDmL35+rhqKP0=; b=C4LauQ+o9aqPqS48sQDqIGOFb3fS8HOAbMFB29oMK8POZgiuOaYWLRuebzXGiGK8AmR/XG AuWoBsNVLkljQaCkEAVHvBG4Gm0snKVtKB7fKY6RKopb4UC3dqsYCW47oNIg++IY9rYAzC ybbeuJnS8h8TdT7821V4Iz7rA8q863M= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-tuALkpf8NCG9-SPeCijViw-1; Wed, 13 Oct 2021 08:21:32 -0400 X-MC-Unique: tuALkpf8NCG9-SPeCijViw-1 Received: by mail-wr1-f71.google.com with SMTP id 10-20020a5d47aa000000b001610cbda93dso1788341wrb.23 for ; Wed, 13 Oct 2021 05:21:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aI/a1CuIplLBzfM7K3SKE+P3jJtMmkhDmL35+rhqKP0=; b=bUeRSH40GCWRf8o6dGMrBCsVFIhyHUUd3/WXXeLk+IpjoXUQl5kSvFCTaHKEFUK2Dd Z2C533yARz60cTvpxfJiarauFKdPF7CpB73tQBCNfDNfPmJFkcXREYQgaxmVL6H/x1ao CB+70l1CkyIN8GhGD+3RLF2PRdCpeF62saFqf4Qa7RD69oVo6VihYoWCIaeQca2DWd2s RbE3TErIO66Ksr03MSb595K9SXvctJqAKNkNnDs/uGbSjQjXVo16mtZmCWVR6Ym/Jbyd PdsH8MR07zqG49PV9evrbxblUknTd4XPHIg834ftdPVrISHBk1IoJbohZ7MQlyPTLrHq 2lMQ== X-Gm-Message-State: AOAM531TtD8EmWpJ9QI1c/8ALIruuysY+PJ0ns3iBTWAvGqxA5gLSE0o DllXWXUGFWMglDHLQ/A56u7LUkuUC6vkbxn4/VZPKTnkh1xkYKM+fz+0F+F4LIKHNBcAIVr77lZ vx+ca3s/IsI/1a7f1YCO7YFuW X-Received: by 2002:adf:a390:: with SMTP id l16mr39148256wrb.291.1634127691196; Wed, 13 Oct 2021 05:21:31 -0700 (PDT) X-Received: by 2002:adf:a390:: with SMTP id l16mr39148230wrb.291.1634127690995; Wed, 13 Oct 2021 05:21:30 -0700 (PDT) Received: from redhat.com ([2.55.30.112]) by smtp.gmail.com with ESMTPSA id q14sm5174087wmq.4.2021.10.13.05.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 05:21:30 -0700 (PDT) Date: Wed, 13 Oct 2021 08:21:26 -0400 From: "Michael S. Tsirkin" To: Christoph Hellwig Cc: Xie Yongji , jasowang@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Wolf , Jens Axboe Subject: Re: [PATCH v5] virtio-blk: Add validation for block size in config space Message-ID: <20211013082025-mutt-send-email-mst@kernel.org> References: <20210809101609.148-1-xieyongji@bytedance.com> <20211004112623-mutt-send-email-mst@kernel.org> <20211005062359-mutt-send-email-mst@kernel.org> <20211011114041.GB16138@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211011114041.GB16138@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 01:40:41PM +0200, Christoph Hellwig wrote: > On Tue, Oct 05, 2021 at 06:42:43AM -0400, Michael S. Tsirkin wrote: > > Stefan also pointed out this duplicates the logic from > > > > if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize)) > > return -EINVAL; > > > > > > and a bunch of other places. > > > > > > Would it be acceptable for blk layer to validate the input > > instead of having each driver do it's own thing? > > Maybe inside blk_queue_logical_block_size? > > I'm pretty sure we want down that before. Let's just add a helper > just for that check for now as part of this series. Actually validating > in in blk_queue_logical_block_size seems like a good idea, but returning > errors from that has a long tail. Xie Yongji, I think I will revert this patch for now - can you please work out adding that helper and using it in virtio? Thanks, -- MST