All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
@ 2022-03-28 14:57 David Disseldorp
  2022-04-04 16:13 ` David Disseldorp
  0 siblings, 1 reply; 3+ messages in thread
From: David Disseldorp @ 2022-03-28 14:57 UTC (permalink / raw)
  To: David Howells, linux-fsdevel; +Cc: David Disseldorp

From code inspection, the watch_queue_set_size() allocation error paths
return the ret value set via the prior pipe_resize_ring() call, which
will always be zero.

Fixes: c73be61cede58 ("pipe: Add general notification queue support")
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 kernel/watch_queue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 3990e4df3d7b0..a128dedec9db2 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -248,6 +248,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
 	if (ret < 0)
 		goto error;
 
+	ret = -ENOMEM;
 	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
 	if (!pages)
 		goto error;
-- 
2.34.1


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

* Re: [PATCH] watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
  2022-03-28 14:57 [PATCH] watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths David Disseldorp
@ 2022-04-04 16:13 ` David Disseldorp
  2022-04-19 14:32   ` David Disseldorp
  0 siblings, 1 reply; 3+ messages in thread
From: David Disseldorp @ 2022-04-04 16:13 UTC (permalink / raw)
  To: David Howells; +Cc: linux-fsdevel

Hi David,

Any feedback on this? It's a pretty obvious fix IMO.

On Mon, 28 Mar 2022 16:57:46 +0200, David Disseldorp wrote:

> From code inspection, the watch_queue_set_size() allocation error paths
> return the ret value set via the prior pipe_resize_ring() call, which
> will always be zero.
> 
> Fixes: c73be61cede58 ("pipe: Add general notification queue support")
> Signed-off-by: David Disseldorp <ddiss@suse.de>
> ---
>  kernel/watch_queue.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
> index 3990e4df3d7b0..a128dedec9db2 100644
> --- a/kernel/watch_queue.c
> +++ b/kernel/watch_queue.c
> @@ -248,6 +248,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
>  	if (ret < 0)
>  		goto error;
>  
> +	ret = -ENOMEM;
>  	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
>  	if (!pages)
>  		goto error;


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

* Re: [PATCH] watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths
  2022-04-04 16:13 ` David Disseldorp
@ 2022-04-19 14:32   ` David Disseldorp
  0 siblings, 0 replies; 3+ messages in thread
From: David Disseldorp @ 2022-04-19 14:32 UTC (permalink / raw)
  To: David Howells; +Cc: linux-fsdevel

Ping...

On Mon, 4 Apr 2022 18:13:18 +0200, David Disseldorp wrote:

> Hi David,
> 
> Any feedback on this? It's a pretty obvious fix IMO.
> 
> On Mon, 28 Mar 2022 16:57:46 +0200, David Disseldorp wrote:
> 
> > From code inspection, the watch_queue_set_size() allocation error paths
> > return the ret value set via the prior pipe_resize_ring() call, which
> > will always be zero.
> > 
> > Fixes: c73be61cede58 ("pipe: Add general notification queue support")
> > Signed-off-by: David Disseldorp <ddiss@suse.de>
> > ---
> >  kernel/watch_queue.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
> > index 3990e4df3d7b0..a128dedec9db2 100644
> > --- a/kernel/watch_queue.c
> > +++ b/kernel/watch_queue.c
> > @@ -248,6 +248,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
> >  	if (ret < 0)
> >  		goto error;
> >  
> > +	ret = -ENOMEM;
> >  	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
> >  	if (!pages)
> >  		goto error;  
> 


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

end of thread, other threads:[~2022-04-19 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 14:57 [PATCH] watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths David Disseldorp
2022-04-04 16:13 ` David Disseldorp
2022-04-19 14:32   ` David Disseldorp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.