linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: Put leaked request on error path of fuse_retrieve()
@ 2018-11-06  9:13 Kirill Tkhai
  2018-11-06  9:23 ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Tkhai @ 2018-11-06  9:13 UTC (permalink / raw)
  To: miklos, ktkhai, linux-fsdevel, linux-kernel

fuse_request_send_notify_reply() may fail, and this case
it remains leaked (fuse_retrieve_end(), which is called
on error path, does not do that). Also, fc->num_waiting,
will never be decremented, and fuse_wait_aborted() will
never finish. So, put the request patently.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/dev.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index ae813e609932..6fe330cc9709 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1768,8 +1768,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
 	req->in.args[1].size = total_len;
 
 	err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique);
-	if (err)
+	if (err) {
 		fuse_retrieve_end(fc, req);
+		fuse_put_request(fc, req);
+	}
 
 	return err;
 }

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

* Re: [PATCH] fuse: Put leaked request on error path of fuse_retrieve()
  2018-11-06  9:13 [PATCH] fuse: Put leaked request on error path of fuse_retrieve() Kirill Tkhai
@ 2018-11-06  9:23 ` Miklos Szeredi
  2018-11-06  9:25   ` Kirill Tkhai
  0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2018-11-06  9:23 UTC (permalink / raw)
  To: Kirill Tkhai; +Cc: linux-fsdevel, linux-kernel

On Tue, Nov 6, 2018 at 10:13 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
> fuse_request_send_notify_reply() may fail, and this case
> it remains leaked (fuse_retrieve_end(), which is called
> on error path, does not do that). Also, fc->num_waiting,
> will never be decremented, and fuse_wait_aborted() will
> never finish. So, put the request patently.
>
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>

Posted same patch yesterday for a syzbot report.   How did you notice this?

Thanks,
Miklos


> ---
>  fs/fuse/dev.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index ae813e609932..6fe330cc9709 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -1768,8 +1768,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
>         req->in.args[1].size = total_len;
>
>         err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique);
> -       if (err)
> +       if (err) {
>                 fuse_retrieve_end(fc, req);
> +               fuse_put_request(fc, req);
> +       }
>
>         return err;
>  }
>

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

* Re: [PATCH] fuse: Put leaked request on error path of fuse_retrieve()
  2018-11-06  9:23 ` Miklos Szeredi
@ 2018-11-06  9:25   ` Kirill Tkhai
  2018-11-06  9:33     ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Tkhai @ 2018-11-06  9:25 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel

On 06.11.2018 12:23, Miklos Szeredi wrote:
> On Tue, Nov 6, 2018 at 10:13 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>> fuse_request_send_notify_reply() may fail, and this case
>> it remains leaked (fuse_retrieve_end(), which is called
>> on error path, does not do that). Also, fc->num_waiting,
>> will never be decremented, and fuse_wait_aborted() will
>> never finish. So, put the request patently.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> 
> Posted same patch yesterday for a syzbot report.   How did you notice this?

I've found this by code review. I did this last week and I have 10 patches more
on different theme. I was waiting for when the merge window opens.
 
> 
>> ---
>>  fs/fuse/dev.c |    4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>> index ae813e609932..6fe330cc9709 100644
>> --- a/fs/fuse/dev.c
>> +++ b/fs/fuse/dev.c
>> @@ -1768,8 +1768,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
>>         req->in.args[1].size = total_len;
>>
>>         err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique);
>> -       if (err)
>> +       if (err) {
>>                 fuse_retrieve_end(fc, req);
>> +               fuse_put_request(fc, req);
>> +       }
>>
>>         return err;
>>  }
>>

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

* Re: [PATCH] fuse: Put leaked request on error path of fuse_retrieve()
  2018-11-06  9:25   ` Kirill Tkhai
@ 2018-11-06  9:33     ` Miklos Szeredi
  2018-11-06  9:34       ` Kirill Tkhai
  0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2018-11-06  9:33 UTC (permalink / raw)
  To: Kirill Tkhai; +Cc: linux-fsdevel, linux-kernel

On Tue, Nov 6, 2018 at 10:25 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
> On 06.11.2018 12:23, Miklos Szeredi wrote:
>> On Tue, Nov 6, 2018 at 10:13 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>>> fuse_request_send_notify_reply() may fail, and this case
>>> it remains leaked (fuse_retrieve_end(), which is called
>>> on error path, does not do that). Also, fc->num_waiting,
>>> will never be decremented, and fuse_wait_aborted() will
>>> never finish. So, put the request patently.
>>>
>>> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
>>
>> Posted same patch yesterday for a syzbot report.   How did you notice this?
>
> I've found this by code review. I did this last week and I have 10 patches more
> on different theme. I was waiting for when the merge window opens.

Well, the merge window just closed.  But never worry, bugfixes can go
in at anytime.

If you notice a bug, such as this, you don't need to hold back until
any particular time, the sooner it's known, the better.

Thanks,
Miklos

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

* Re: [PATCH] fuse: Put leaked request on error path of fuse_retrieve()
  2018-11-06  9:33     ` Miklos Szeredi
@ 2018-11-06  9:34       ` Kirill Tkhai
  0 siblings, 0 replies; 5+ messages in thread
From: Kirill Tkhai @ 2018-11-06  9:34 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel

On 06.11.2018 12:33, Miklos Szeredi wrote:
> On Tue, Nov 6, 2018 at 10:25 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>> On 06.11.2018 12:23, Miklos Szeredi wrote:
>>> On Tue, Nov 6, 2018 at 10:13 AM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote:
>>>> fuse_request_send_notify_reply() may fail, and this case
>>>> it remains leaked (fuse_retrieve_end(), which is called
>>>> on error path, does not do that). Also, fc->num_waiting,
>>>> will never be decremented, and fuse_wait_aborted() will
>>>> never finish. So, put the request patently.
>>>>
>>>> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
>>>
>>> Posted same patch yesterday for a syzbot report.   How did you notice this?
>>
>> I've found this by code review. I did this last week and I have 10 patches more
>> on different theme. I was waiting for when the merge window opens.
> 
> Well, the merge window just closed.  But never worry, bugfixes can go
> in at anytime.
> 
> If you notice a bug, such as this, you don't need to hold back until
> any particular time, the sooner it's known, the better.

Ok, no problem :)

Thanks,
Kirill

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

end of thread, other threads:[~2018-11-06 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06  9:13 [PATCH] fuse: Put leaked request on error path of fuse_retrieve() Kirill Tkhai
2018-11-06  9:23 ` Miklos Szeredi
2018-11-06  9:25   ` Kirill Tkhai
2018-11-06  9:33     ` Miklos Szeredi
2018-11-06  9:34       ` Kirill Tkhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).