[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231124174356.GH18929@suse.cz>
Date: Fri, 24 Nov 2023 18:43:56 +0100
From: David Sterba <dsterba@...e.cz>
To: Jann Horn <jannh@...gle.com>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Alex Lyakas <alex.bolshoy.btrfs@...il.com>,
Alexander Block <ablock84@...glemail.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH] btrfs: send: Ensure send_fd is writable
On Fri, Nov 24, 2023 at 05:48:31PM +0100, Jann Horn wrote:
> kernel_write() requires the caller to ensure that the file is writable.
> Let's do that directly after looking up the ->send_fd.
>
> (We don't need a separate bailout path because the "out" path already
> does fput() if ->send_filp is non-NULL.)
>
> This has no security impact for two reasons:
>
> - the ioctl requires CAP_SYS_ADMIN
> - __kernel_write() bails out on read-only files - but only since 5.8,
> see commit a01ac27be472 ("fs: check FMODE_WRITE in __kernel_write")
>
> Reported-and-tested-by: syzbot+12e098239d20385264d3@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=12e098239d20385264d3
> Fixes: 31db9f7c23fb ("Btrfs: introduce BTRFS_IOC_SEND for btrfs send/receive")
> Cc: stable@...r.kernel.org
> Signed-off-by: Jann Horn <jannh@...gle.com>
Added to misc-next, thanks.
Powered by blists - more mailing lists