Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp281311rdh; Thu, 26 Oct 2023 01:53:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhOY2W8zUeypoKmZdf+gauTr5EN/L2E8m30+QMKddKw0UgSjFvKGx/II4rokvfAfOq7M0y X-Received: by 2002:a25:9b07:0:b0:d7f:d6a7:d57d with SMTP id y7-20020a259b07000000b00d7fd6a7d57dmr16925304ybn.27.1698310386786; Thu, 26 Oct 2023 01:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698310386; cv=none; d=google.com; s=arc-20160816; b=lFeZn1q/zNgv43gc6ZAK2OOEAR0Xe/31z3AhbcgOpWYgDySl8AA6vKzZ11Xztc5yrh DstFTi2mSA9KyN0vaokHH9VUL4cSIZjMMRS+JR9jWUSfXamX1v3oDMgNZb4UFUlztFNF 1cQxDI3x2vbulcpuy4VxyTnp/9IwHYcRS9oHIpprsAYmtoz8T/fwH77hN3zKpiWgrzeo HzpH5w4Eo74j79FDZuM0P9oVNW2TREcMvT05sFf91Ye0N3NOHidbm5c1Ds+UiVbsckZH BqAXVilgRXeGZopyNc7YJMW7RTBGfUUYr27It5TvU1bwFpnreV3e3LBs6qk7RA47v4fC hHRQ== 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:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=4v1TemPtY2kKG+qS/V0nX/arxnOoa2xpqK5jAnHaV6s=; fh=LDrjrfSIPLyUwtUxwlZwegrTTv1drhDstlMV2MEKDTM=; b=S1XQ8k8oAElqyiyp5KrXcHXLcyc6+MqCxFae9zG0vTTvCVzGIAB4AzDw+VGdNxmJzD bMMiGJhu6ttvKAltrDv31rO4dC0OLX4F6DhM19/ZZSXPKQQufUwwPETrWuZhC9gfai8d QaQxc43awpj0CJM5XHdE/kFXj42ZAzj2wGh0MNXk+QSM8XcjtRPES7UpAJelQ0XQKSmO nCYDLeh+riRZUTtPFc1PAPU2LZYwTHmU0/SGbUFhxbFca4Lhzu0ZfgYQXRbDDO5CvA4Q 6E/J9nCro4L97tEh9sOYJn1etLIdpdVMw9YpLL14r+1xeMHdSYEWZdOuNYm8qbx2kA2G SDLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v89-20020a25abe2000000b00da05787ef25si5715243ybi.689.2023.10.26.01.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 01:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0C343807C747; Thu, 26 Oct 2023 01:53:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344667AbjJZIw4 (ORCPT + 99 others); Thu, 26 Oct 2023 04:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjJZIwy (ORCPT ); Thu, 26 Oct 2023 04:52:54 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A29A128; Thu, 26 Oct 2023 01:52:52 -0700 (PDT) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4SGKLk4Kfnz4f3k6R; Thu, 26 Oct 2023 16:52:46 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 88D1B1A016E; Thu, 26 Oct 2023 16:52:48 +0800 (CST) Received: from [10.174.178.159] (unknown [10.174.178.159]) by APP4 (Coremail) with SMTP id gCh0CgCHHt7fKDplmvz0Dw--.39203S3; Thu, 26 Oct 2023 16:52:48 +0800 (CST) Message-ID: <26bafe93-345d-2696-8ee7-7d1baa0e7eb7@huaweicloud.com> Date: Thu, 26 Oct 2023 16:52:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] block: Fix minor range check in device_add_disk() To: Tetsuo Handa , axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhongjinghua@huawei.com, yi.zhang@huawei.com, yukuai3@huawei.com References: <20231025084621.2338604-1-zhongjinghua@huaweicloud.com> <119b7314-10a9-4d62-b40f-19462dc68009@I-love.SAKURA.ne.jp> From: zhongjinghua In-Reply-To: <119b7314-10a9-4d62-b40f-19462dc68009@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCHHt7fKDplmvz0Dw--.39203S3 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUU5R7kC6x804xWl14x267AKxVW8JVW5JwAF c2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII 0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xv wVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4 x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG 64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r 4j6F4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1cAE67vI Y487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxV WUJVW8JwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq3wCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07jUeOJUUU UU= X-CM-SenderInfo: x2kr0wpmlqwxtxd6x35dzhxuhorxvhhfrp/ X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 01:53:04 -0700 (PDT) 在 2023/10/25 18:06, Tetsuo Handa 写道: > On 2023/10/25 17:46, Zhong Jinghua wrote: >> Checks added in patch: >> commit e338924bd05d ("block: check minor range in device_add_disk()") >> ignore the problem of first_minore < 0 and disk->minors < 0. > What is the problem of first_minor < 0 or disk->minors < 0 ? > Are negative values legal/illegal ? These two values are used as the secondary device number and the maximum number of partitions, which is illegal if negative. Then first_minore and disk->minors are signed numbers, and the sum may be less than MINORMASK to bypass the check.