Patch "dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify()" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify()
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
dnotify-handle-errors-from-fsnotify_add_mark_locked-in-fcntl_dirnotify.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
b3a0066005821acdc0cdb092cb72587182ab583fMon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Tue, 31 Oct 2017 09:53:28 +0100
Subject: dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify()
From: Jan Kara <[email protected]>
commit b3a0066005821acdc0cdb092cb72587182ab583f upstream.
fsnotify_add_mark_locked() can fail but we do not check its return value. This didn't matter before commit 9dd813c15b2c "fsnotify: Move mark list head from object into dedicated structure" as none of possible failures could happen for dnotify but after that commit -ENOMEM can be returned. Handle this error properly in fcntl_dirnotify() as otherwise we just hit BUG_ON(dn_mark->dn) in dnotify_free_mark().
--- fs/notify/dnotify/dnotify.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/notify/dnotify/dnotify.c +6 -1
@@ -319,7 +319,11 @@ int fcntl_dirnotify(int fd, struct file dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);spin_lock (&fsn_mark->lock); }else { -fsnotify_add_mark_locked (new_fsn_mark, inode,NULL ,0 ); + error =fsnotify_add_mark_locked (new_fsn_mark, inode,NULL ,0 ); +if (error) { +mutex_unlock (&dnotify_group->mark_mutex); + goto out_err; + }spin_lock (&new_fsn_mark->lock); fsn_mark = new_fsn_mark; dn_mark = new_dn_mark;
@@ -345,6 +349,7 @@ int fcntl_dirnotify(int fd, struct file*/ if (dn_mark == new_dn_mark) destroy =1 ; + error =0 ; goto out; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/dnotify-handle-errors-from-fsnotify_add_mark_locked-in-fcntl_dirnotify.patch