aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/inode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 2c489378b4cd..9fff9f3b17e4 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -677,18 +677,19 @@ static int fill_inode(struct inode *inode,
677 case S_IFLNK: 677 case S_IFLNK:
678 inode->i_op = &ceph_symlink_iops; 678 inode->i_op = &ceph_symlink_iops;
679 if (!ci->i_symlink) { 679 if (!ci->i_symlink) {
680 int symlen = iinfo->symlink_len; 680 u32 symlen = iinfo->symlink_len;
681 char *sym; 681 char *sym;
682 682
683 BUG_ON(symlen != inode->i_size);
684 spin_unlock(&ci->i_ceph_lock); 683 spin_unlock(&ci->i_ceph_lock);
685 684
685 err = -EINVAL;
686 if (WARN_ON(symlen != inode->i_size))
687 goto out;
688
686 err = -ENOMEM; 689 err = -ENOMEM;
687 sym = kmalloc(symlen+1, GFP_NOFS); 690 sym = kstrndup(iinfo->symlink, symlen, GFP_NOFS);
688 if (!sym) 691 if (!sym)
689 goto out; 692 goto out;
690 memcpy(sym, iinfo->symlink, symlen);
691 sym[symlen] = 0;
692 693
693 spin_lock(&ci->i_ceph_lock); 694 spin_lock(&ci->i_ceph_lock);
694 if (!ci->i_symlink) 695 if (!ci->i_symlink)