diff mbox series

btrfs: fix 64bit compat send ioctl arguments not initializing version member

Message ID 20231124000034.27522-1-dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: fix 64bit compat send ioctl arguments not initializing version member | expand

Commit Message

David Sterba Nov. 24, 2023, midnight UTC
When the send protocol versioning was added in 5.16 e77fbf990316
("btrfs: send: prepare for v2 protocol"), the 32/64bit compat code was
not updated (added by 2351f431f727 ("btrfs: fix send ioctl on 32bit with
64bit kernel")), missing the version struct member. The compat code is
probably rarely used, nobody reported any bugs.

Found by tool https://github.com/jirislaby/clang-struct .

Fixes: 2351f431f727 ("btrfs: fix send ioctl on 32bit with 64bit kernel")
CC: stable@vger.kernel.org # 6.1+
Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Filipe Manana Nov. 24, 2023, 12:16 a.m. UTC | #1
On Fri, Nov 24, 2023 at 12:08 AM David Sterba <dsterba@suse.com> wrote:
>
> When the send protocol versioning was added in 5.16 e77fbf990316
> ("btrfs: send: prepare for v2 protocol"), the 32/64bit compat code was
> not updated (added by 2351f431f727 ("btrfs: fix send ioctl on 32bit with
> 64bit kernel")), missing the version struct member. The compat code is
> probably rarely used, nobody reported any bugs.
>
> Found by tool https://github.com/jirislaby/clang-struct .
>
> Fixes: 2351f431f727 ("btrfs: fix send ioctl on 32bit with 64bit kernel")

So this is not the correct commit, you copy-pasted the wrong one from
the change log above, it should be:

e77fbf990316 ("btrfs: send: prepare for v2 protocol")

With that fixed:

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Thanks.

> CC: stable@vger.kernel.org # 6.1+
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/ioctl.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index dfe257e1845b..4e50b62db2a8 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -4356,6 +4356,7 @@ static int _btrfs_ioctl_send(struct inode *inode, void __user *argp, bool compat
>                 arg->clone_sources = compat_ptr(args32.clone_sources);
>                 arg->parent_root = args32.parent_root;
>                 arg->flags = args32.flags;
> +               arg->version = args32.version;
>                 memcpy(arg->reserved, args32.reserved,
>                        sizeof(args32.reserved));
>  #else
> --
> 2.42.1
>
>
David Sterba Nov. 24, 2023, 2:16 p.m. UTC | #2
On Fri, Nov 24, 2023 at 12:16:55AM +0000, Filipe Manana wrote:
> On Fri, Nov 24, 2023 at 12:08 AM David Sterba <dsterba@suse.com> wrote:
> >
> > When the send protocol versioning was added in 5.16 e77fbf990316
> > ("btrfs: send: prepare for v2 protocol"), the 32/64bit compat code was
> > not updated (added by 2351f431f727 ("btrfs: fix send ioctl on 32bit with
> > 64bit kernel")), missing the version struct member. The compat code is
> > probably rarely used, nobody reported any bugs.
> >
> > Found by tool https://github.com/jirislaby/clang-struct .
> >
> > Fixes: 2351f431f727 ("btrfs: fix send ioctl on 32bit with 64bit kernel")
> 
> So this is not the correct commit, you copy-pasted the wrong one from
> the change log above, it should be:
> 
> e77fbf990316 ("btrfs: send: prepare for v2 protocol")

Of course, fixed, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index dfe257e1845b..4e50b62db2a8 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4356,6 +4356,7 @@  static int _btrfs_ioctl_send(struct inode *inode, void __user *argp, bool compat
 		arg->clone_sources = compat_ptr(args32.clone_sources);
 		arg->parent_root = args32.parent_root;
 		arg->flags = args32.flags;
+		arg->version = args32.version;
 		memcpy(arg->reserved, args32.reserved,
 		       sizeof(args32.reserved));
 #else