diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2019-11-12 13:49:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-13 10:42:30 +0300 |
commit | ba916a1310661973cd9a5d0509c3f9e3fe59c0c3 (patch) | |
tree | 46b6144cd1f6d5114cb07b95fe02d370dfb034b6 /fs/fuse | |
parent | a266e9072a08bd130eea4c1b8a76d1a6574b23f3 (diff) | |
download | linux-ba916a1310661973cd9a5d0509c3f9e3fe59c0c3.tar.xz |
fuse: verify nlink
commit c634da718db9b2fac201df2ae1b1b095344ce5eb upstream.
When adding a new hard link, make sure that i_nlink doesn't overflow.
Fixes: ac45d61357e8 ("fuse: fix nlink after unlink")
Cc: <stable@vger.kernel.org> # v3.4
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 54d638f9ba1c..7b88677caed4 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -862,7 +862,8 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, spin_lock(&fi->lock); fi->attr_version = atomic64_inc_return(&fc->attr_version); - inc_nlink(inode); + if (likely(inode->i_nlink < UINT_MAX)) + inc_nlink(inode); spin_unlock(&fi->lock); fuse_invalidate_attr(inode); fuse_update_ctime(inode); |