Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795037739; b=D5vpHUGGVRPRsF2LNnjfMvB8sIaQ0xoOYPgNZcFd0BieVLVDvV53Zu9hw7/eJ0htqif4 9kCPnkyW3riV2R3wRcv6+MIJ1mv/QRhRhHUi2d/JEOl9pgw4ntTIRcUM4Ykgxq7aMWbWN qwVBvzmAE6HRgjwtQNltxxrHoHMypyw0RzPO3f8bVtXHOIbTAss/g/9+Br+cXsTzN1z9e 2huscQNBpWj/Wl09RAgDqUja7SbZOJmXfL6ZP3QUgKp2Y5W+t0BBhXAw8W3IQPw+Q3Lqm buaEkjVmOV71GTRe0JmWMxwu2OoOUm68AG+Wmu1IFGwnfcOhi4jbjSkOckkJLDKrheA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795037739; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=gtxbXMHhNSQAZEQbP8LcgzlA6YCbkyYjW2yFNKMaTNo=; b=ZerhQ+GVrU/qyXFPPmh5a8zZjk/jtB+c9Sq66N6VnvJvFlHA8fPXRDhZ95f0ldtTO55c tBMQHbQhe6ZECtUChFQFQWce2Bx46irAx/stuzd2miuvn0x6Q3y50XGrG8K2oIhLLyHhz rY6iRvRElvZfRCfQ1d/IvSOuNqU4100OJj3hxIeIZQOYgx6VnCau0FEqHXdPYVqHPPkZC FH+pTiwniCW0eunShI37PY3hmImVc1UBDRPLqOYlSZzMDb3lMgbZNs6l3nNseIVZ6XYh+ IYzB703TtAoHohaFH1jxhvkJR2omCBckhl+0abF1ZO2lXKgHIyrsBUO93jNA4JDnFNQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MIbrb4oo; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6CFD606A320; Wed, 18 Nov 2026 21:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=MIbrb4oo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A62B1F000C4; Wed, 18 Nov 2026 21:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795037738; bh=gtxbXMHhNSQAZEQbP8LcgzlA6YCbkyYjW2yFNKMaTNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MIbrb4ooa5zEXAuFrpyTybsh2mGhgSDc4BGCchhk5mMb8uZj6c5hpIw7MgWK7Bs9n C9mz16tEdFrQPJ6DQzMj2SSMs2Z2KRR0aPz1K5O1Woe4vaZsH7ONml5lfk0slATicJ g0rVQQCKJ1wCDXUHarox42wGKfOU/iaPlKxIC+Ok= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hungyu Lin , Christoph Hellwig , Arnd Bergmann , Jens Axboe , Sasha Levin Subject: [PATCH 6.6 1501/3318] block: Return the soft block size for compat BLKBSZGET Date: Wed, 18 Nov 2026 15:35:23 +0100 Message-ID: <20261118150405.947338935@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hungyu Lin [ Upstream commit 57cd1a08717690e5ea01d7ac7a96bb33a2dca117 ] BLKBSZGET returns the block device's soft block size, while BLKSSZGET returns its logical sector size. The compat BLKBSZGET_32 handler uses bdev_logical_block_size(), so it returns the wrong value when these sizes differ. For example, on an x86_64 kernel a native query of a RAM or loop device with 512-byte logical sectors returns the initial soft block size of 4096 bytes, but an i386 process gets 512 bytes. This makes 32-bit blockdev --getbsz and the BSZ column of --report disagree with native queries, even without a preceding BLKBSZSET. Use block_size() as the native handler and the pre-regression compat handler do, and correct the case comment to describe the soft size. Fixes: 9b81648cb5e3 ("compat_ioctl: simplify up block/ioctl.c") Cc: stable@vger.kernel.org Signed-off-by: Hungyu Lin Reviewed-by: Christoph Hellwig Reviewed-by: Arnd Bergmann Link: https://patch.msgid.link/20261023153645.37546-1-dennylin0707@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 024767fa1e52d..b72dc6ae40a97 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -676,8 +676,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) return compat_put_ulong(argp, bdev_nr_sectors(bdev)); /* The data is compatible, but the command number is different */ - case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */ - return put_int(argp, bdev_logical_block_size(bdev)); + case BLKBSZGET_32: /* get the soft block size (cf. BLKSSZGET) */ + return put_int(argp, block_size(bdev)); case BLKBSZSET_32: return blkdev_bszset(bdev, mode, argp); case BLKGETSIZE64_32: -- 2.53.0