diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2019-11-12 11:49:04 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-11-12 11:49:04 +0100 |
commit | c634da718db9b2fac201df2ae1b1b095344ce5eb (patch) | |
tree | 62dc321971b2bd1b977939d5ba69cb5052760450 | |
parent | 8aab336b14c115c6bf1d4baeb9247e41ed9ce6de (diff) | |
download | linux-c634da718db9b2fac201df2ae1b1b095344ce5eb.tar.gz linux-c634da718db9b2fac201df2ae1b1b095344ce5eb.tar.bz2 linux-c634da718db9b2fac201df2ae1b1b095344ce5eb.zip |
fuse: verify nlink
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>
-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 ca4ddbe21ec0..ee190119f45c 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -870,7 +870,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); |