On Wed, Sep 30, 2020 at 08:58:04PM -0400, Qian Cai wrote:

> Fixes: c73be61cede5 ("pipe: Add general notification queue support")
> Signed-off-by: Qian Cai <c...@redhat.com>
> ---
>  fs/pipe.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/pipe.c b/fs/pipe.c
> index 60dbee457143..5184972cd9c0 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -920,10 +920,13 @@ int create_pipe_files(struct file **res, int flags)
>       if (flags & O_NOTIFICATION_PIPE) {
>  #ifdef CONFIG_WATCH_QUEUE
>               if (watch_queue_init(inode->i_pipe) < 0) {
> +                     free_pipe_info(inode->i_pipe);
>                       iput(inode);
>                       return -ENOMEM;
>               }
>  #else
> +             free_pipe_info(inode->i_pipe);
> +             iput(inode);
>               return -ENOPKG;
>  #endif
>       }

yeccchhhh...  This is too ugly to live.

1) get rid of that sodding ifdef; define watch_queue_init() to fail if
CONFIG_WATCH_QUEUE is not defined.

2) do not ignore the return value.

Reply via email to