From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62B19EB64DA for ; Mon, 19 Jun 2023 01:21:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjFSBVA (ORCPT ); Sun, 18 Jun 2023 21:21:00 -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 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