Re: [PATCH] pipe: Fix memory leaks in create_pipe_files()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <cai@xxxxxxxxxx>
> ---
>  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.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux