Re: [PATCH for-5.7] splice: move f_mode checks to do_{splice,tee}()
From: Pavel Begunkov
Date: Tue May 05 2020 - 18:15:00 EST
On 06/05/2020 01:00, Clay Harris wrote:
> On Wed, May 06 2020 at 00:38:05 +0300, Pavel Begunkov quoth thus:
>
>> On 06/05/2020 00:10, Clay Harris wrote:
>>> On Mon, May 04 2020 at 22:39:35 +0300, Pavel Begunkov quoth thus:
>>>
>>>> do_splice() is used by io_uring, as will be do_tee(). Move f_mode
>>>> checks from sys_{splice,tee}() to do_{splice,tee}(), so they're
>>>> enforced for io_uring as well.
>>>
>>> I'm not seeing any check against splicing a pipe to itself in the
>>> io_uring path, although maybe I just missed it. As the comment
>>> below says: /* Splicing to self would be fun, but... */ .
>>
>> io_uring just forwards a request to do_splice(), which do the check at the exact
>> place you mentioned. The similar story is with do_tee().
>
> Okay. I'd been thinking that since you were moving the file mode
> checks into io_uring that the previous place they were called wasn't
> on the path. Evidently, you're just moving the mode checks earlier.
I move them from sys_splice() later to do_splice(). Even though the patch
doesn't touch io_uring directly, it fixes a problem in there. And as a nice
addition, it looks prettier and removes a couple of useless checks.
--
Pavel Begunkov