Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18919248rwd; Wed, 28 Jun 2023 02:29:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tNiHmRD2c+M3GSS9fs45UD0sj9Fxjk0vD6+ndiuHY3DRA0rYOqAD5yfDK/XhMwe6pnjyL X-Received: by 2002:a17:907:d0c:b0:973:91f7:508a with SMTP id gn12-20020a1709070d0c00b0097391f7508amr33619107ejc.4.1687944547471; Wed, 28 Jun 2023 02:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687944547; cv=none; d=google.com; s=arc-20160816; b=w3M76pOPEBmB0OYfC0uqxbXfwBHKd0S/EQkHOrfoAHVZ5glXNGji3GhayBI/NHJV8/ NaIVpwYRQfC3uLme/GGTnI5bUccgOx7G+HKQrOq7lPiQjT+l2qJN7teFYxruJdnSR4H6 kNIb7bCwsCwv/k/605HonOk7aV0DOfINabBK+SNfrSexS64lPXH9VVXgxh04r4JTlBt8 NkDRQp8ZEHzii4/2+Ab1lY7+VD0oUU9L/5Pac90JSVnlrOPW+Me0Evh/K8aGPjQ2+MnM 2aCN+7qNur3ovlUB6jNr0ToMmfxjNwAm0r3NOKnOCC4+AU5rd4CGuC5e5hJtB195LSxE 3FXw== 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:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=ajWfjBc2obRqSZwjngX6k4LP7zQP9g2PB1asTBDF7ZA=; fh=xOdf68tCsVPZ3fgyxfdtVBP9HXicSSoYYG7XGZPgQ/8=; b=EtNM5PD+x0SLbSAxBCqYVIEJN8vLUv2wAO8AmTSJ3QtZWsHA7pFWeY2PJpLQfIWmlU AHSXDgWmHraTDsfCk0xHY53Uy2CfIde6dGE21c5S3fZEvd7yTd2InpOhtynaalpf/mT0 A15YKBxRis9o7WNuLOQfFTrPpgM1kuitHB9qn3gMQofoZ7XlYaRQq9qzu3gic064mM44 vIsx+u1OX5ANgA1QrAmoj/8Xqy3QkMPVERb9it1jJSfWFvKFiwFeEr9RiVrkJW15MY93 x2J4u6hZR8sKU7GUBXiZdEiwiFvVYKWrPdUS1NDgX8uCij/RoUSuGnc5XB4zTWGTlGeo J7+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BioGUNGw; 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 va17-20020a17090711d100b0098debb6fa67si5156051ejb.495.2023.06.28.02.28.42; Wed, 28 Jun 2023 02:29:07 -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=BioGUNGw; 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 S236555AbjF1JBb (ORCPT + 99 others); Wed, 28 Jun 2023 05:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236030AbjF1In4 (ORCPT ); Wed, 28 Jun 2023 04:43:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F7B3C21; Wed, 28 Jun 2023 01:36:52 -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 EDE1C612D8; Wed, 28 Jun 2023 06:05:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79D25C433C8; Wed, 28 Jun 2023 06:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687932330; bh=twiHrOPZB7Cgvszl3+g/k/ScexccFFEb5EWUW2A41Fo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BioGUNGwScYPlVG94Dmc41pSG0YnmkxnAjq06pLGC6Xor/LlqTzgKYeDb2fjeMbA/ FLFShvgCLtmU1zzhBbyRYUhfx/q3jpEOnCgFyAMhViU63W0+oL5/TVd+IOoflXyLvW o9DwjALrw6VSPv+qbEnhgdIF2jfBkqtPMWPKxDAJPwUeAZZZ5+s5JU8lfIa0PHLg3d xX5f/aLJdUko24gqPt2gqdrKEbAZn9ogTBHY3zyPYos5/F3s/NGyXukm33NwESzlix HT7TO0Zz5NovQwWwfEVcfwGbGSF2V67tiaY1NF09bn3sf3r3XND3jE7if5Rz8iZf4k xqiNEnh40EJrw== Message-ID: <6232885e-d841-8067-b238-dda6f89f33f2@kernel.org> Date: Wed, 28 Jun 2023 15:05:28 +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 v3] block: add check that partition length needs to be aligned with block size Content-Language: en-US To: Min Li , axboe@kernel.dk, willy@infradead.org, hch@lst.de, gregkh@linuxfoundation.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, stable@kernel.org References: <20230628130941.10690-1-min15.li@samsung.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20230628130941.10690-1-min15.li@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 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_MED,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/28/23 22:09, Min Li wrote: > Before calling add partition or resize partition, there is no check > on whether the length is aligned with the logical block size. > If the logical block size of the disk is larger than 512 bytes, > then the partition size maybe not the multiple of the logical block size, > and when the last sector is read, bio_truncate() will adjust the bio size, > resulting in an IO error if the size of the read command is smaller than > the logical block size.If integrity data is supported, this will also > result in a null pointer dereference when calling bio_integrity_free. > > Signed-off-by: Min Li Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research