From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:58920 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754224AbdL1RNt (ORCPT ); Thu, 28 Dec 2017 12:13:49 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "David Sterba" , "Omar Sandoval" Date: Thu, 28 Dec 2017 17:05:44 +0000 Message-ID: Subject: [PATCH 3.16 056/204] Btrfs: fix incorrect {node,sector}size endianness from BTRFS_IOC_FS_INFO In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: 3.16.52-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Omar Sandoval commit bea7eafdbda3ba1d4b2ccb9cca829eefb7989bb9 upstream. fs_info->super_copy->{node,sector}size are little-endian, but the ioctl should return the values in native endianness. Use the cached values in btrfs_fs_info instead. Found with sparse. Fixes: 80a773fbfc2d ("btrfs: retrieve more info from FS_INFO ioctl") Signed-off-by: Omar Sandoval Reviewed-by: David Sterba Signed-off-by: David Sterba [bwh: Backported to 3.16: native nodesize and sectorsize are members of struct btrfs_root, not struct btrfs_fs_info] Signed-off-by: Ben Hutchings --- fs/btrfs/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2745,9 +2745,9 @@ static long btrfs_ioctl_fs_info(struct b } mutex_unlock(&fs_devices->device_list_mutex); - fi_args->nodesize = root->fs_info->super_copy->nodesize; - fi_args->sectorsize = root->fs_info->super_copy->sectorsize; - fi_args->clone_alignment = root->fs_info->super_copy->sectorsize; + fi_args->nodesize = root->nodesize; + fi_args->sectorsize = root->sectorsize; + fi_args->clone_alignment = root->sectorsize; if (copy_to_user(arg, fi_args, sizeof(*fi_args))) ret = -EFAULT;