public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix 64bit compat send ioctl arguments not initializing version member
@ 2023-11-24  0:00 David Sterba
  2023-11-24  0:16 ` Filipe Manana
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2023-11-24  0:00 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba, stable

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(+)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: fix 64bit compat send ioctl arguments not initializing version member
  2023-11-24  0:00 [PATCH] btrfs: fix 64bit compat send ioctl arguments not initializing version member David Sterba
@ 2023-11-24  0:16 ` Filipe Manana
  2023-11-24 14:16   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Filipe Manana @ 2023-11-24  0:16 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, stable

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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: fix 64bit compat send ioctl arguments not initializing version member
  2023-11-24  0:16 ` Filipe Manana
@ 2023-11-24 14:16   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2023-11-24 14:16 UTC (permalink / raw)
  To: Filipe Manana; +Cc: David Sterba, linux-btrfs, stable

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-24 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-24  0:00 [PATCH] btrfs: fix 64bit compat send ioctl arguments not initializing version member David Sterba
2023-11-24  0:16 ` Filipe Manana
2023-11-24 14:16   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox