Commit 5b697f86 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fix from Al Viro:
 "Fixes an obvious bug (memory leak introduced in 5.8)"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  pipe: Fix memory leaks in create_pipe_files()
parents c120ec12 8a018eb5
...@@ -894,19 +894,18 @@ int create_pipe_files(struct file **res, int flags) ...@@ -894,19 +894,18 @@ int create_pipe_files(struct file **res, int flags)
{ {
struct inode *inode = get_pipe_inode(); struct inode *inode = get_pipe_inode();
struct file *f; struct file *f;
int error;
if (!inode) if (!inode)
return -ENFILE; return -ENFILE;
if (flags & O_NOTIFICATION_PIPE) { if (flags & O_NOTIFICATION_PIPE) {
#ifdef CONFIG_WATCH_QUEUE error = watch_queue_init(inode->i_pipe);
if (watch_queue_init(inode->i_pipe) < 0) { if (error) {
free_pipe_info(inode->i_pipe);
iput(inode); iput(inode);
return -ENOMEM; return error;
} }
#else
return -ENOPKG;
#endif
} }
f = alloc_file_pseudo(inode, pipe_mnt, "", f = alloc_file_pseudo(inode, pipe_mnt, "",
......
...@@ -122,6 +122,12 @@ static inline void remove_watch_list(struct watch_list *wlist, u64 id) ...@@ -122,6 +122,12 @@ static inline void remove_watch_list(struct watch_list *wlist, u64 id)
*/ */
#define watch_sizeof(STRUCT) (sizeof(STRUCT) << WATCH_INFO_LENGTH__SHIFT) #define watch_sizeof(STRUCT) (sizeof(STRUCT) << WATCH_INFO_LENGTH__SHIFT)
#else
static inline int watch_queue_init(struct pipe_inode_info *pipe)
{
return -ENOPKG;
}
#endif #endif
#endif /* _LINUX_WATCH_QUEUE_H */ #endif /* _LINUX_WATCH_QUEUE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment