Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5751973rwd; Sun, 18 Jun 2023 18:59:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77GdBJVhmFWn4VlqJ31NxOEg6pNWyCbteoLPonLsZMQIDJUaZUubWvFeDNoVPFCunEOHvc X-Received: by 2002:a17:902:d2c8:b0:1b2:43a5:a5e5 with SMTP id n8-20020a170902d2c800b001b243a5a5e5mr12497603plc.34.1687139969464; Sun, 18 Jun 2023 18:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687139969; cv=none; d=google.com; s=arc-20160816; b=MDI7DLXbMgUJsqT0Q7kLVSPfKuWVEC5vr6hykJbH0S5E+DzaKLu9dX6VUgHMT8ku79 Mht8X/IQybTZns9hBdng7v1MVtQq8qQ8tj722nwAaS2HqA9ghyiageMNvoTXKtQolC1d MCjuYvZTAPZjCRi07aCXl+k0BFRPn3gDXWmzvubBtFPZaJr+ABZeB2kWyZqBLIwkyOvv chsdFUyokzgL8TC+xmpeoGh9t+43Iu9tXwnpiezLqiuLhjx13Q4wjyY+nxsleKVOKwxF ExjpD3sgWNDYjuPZE9ScPINT+lr5JX1P9JElCnvdTgmIFEd+9PoaXBolAXanyF1U1jVH 7lKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=4bdl/JRifS5UOaAMrc/nQH6bNJykdUfVP6fFcUyZtjk=; b=pb/CnNowKoLE1mfAq01XP2QAgjAczC2X9uciwph6xOjdSCMrwskXhicRNpNJTCSu+G ckMGFBYKP+lnOX23yB209sIT7+1tZFoEwYPWpirsX52J9AWfxDVqinxMb5PCBWVxfgee 1z+cPG9w8G1Ma9NozoE4Mx6dMPQCx1WcfWfk85IAFpUOTzjXrH8DtFiiXG0W+ZSIhMml AX3hsi4OPeQxIkj1BTymjT5AnIS6JEBcoXDAIfHc/NGZcmYcCPc4EMspu6wYbcMYKmh1 /bu2TAALU8pC+vrwYlNby8afeJWANAj1WymgnRA/9/1sxW+oOWAWOFZOd/2tiQ8jfKia 3vAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pH1B5X4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090322c700b001b53d2870d8si5180031plg.33.2023.06.18.18.59.15; Sun, 18 Jun 2023 18:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pH1B5X4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbjFSBU7 (ORCPT + 99 others); Sun, 18 Jun 2023 21:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjFSBU5 (ORCPT ); Sun, 18 Jun 2023 21:20:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBAE1B4; Sun, 18 Jun 2023 18:20:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADF7660FED; Mon, 19 Jun 2023 01:20:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CDF6C433C0; Mon, 19 Jun 2023 01:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687137656; bh=P/nw2UCR5A0P8VasNf42geCF7CnuqQIE1bIh3grG8k4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=pH1B5X4UTh8/rYYHdnfBA3PtdvmuOVkWvyVorFSzTAy7OpXATBQ6fv+XxSCK7wTze r8Yii+AjgZOg5RAjyXOdPtxuWKtRoxjlQv0Msul8KBHUfzES0ZWqOfSgvDp/rVk6fh KieB271Ixq/qUr0rGUdf66c0uY0pt7RXo6CZJTzgpgQcc6tFEzUYqVMbomFQy5BmC4 CM/csqKxxO2v6IQfvJb2W5FcYmejdowu0n6pucrz4JQSVjw0TSf0tT6DeWy4wRus3o AZ67t0OOimBc7nhwV5s3XdxLKWLdRcuBc8gDOuDKbOldABKiI59g5uoZ0RS4+zdlUn e3urB8auR9xCQ== Message-ID: Date: Mon, 19 Jun 2023 10:20:53 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4] block: add capacity validation in bdev_add_partition() To: Min Li , axboe@kernel.dk, willy@infradead.org, hch@lst.de, gregkh@linuxfoundation.org, wsa@kernel.org, vkoul@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230619091214.31615-1-min15.li@samsung.com> Content-Language: en-US From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20230619091214.31615-1-min15.li@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/19/23 18:12, Min Li wrote: > In the function bdev_add_partition(),there is no check that the start > and end sectors exceed the size of the disk before calling add_partition. > When we call the block's ioctl interface directly to add a partition, > and the capacity of the disk is set to 0 by driver,the command will > continue to execute. > > Signed-off-by: Min Li > Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research