diff options
Diffstat (limited to 'fs/jffs2/fs.c')
-rw-r--r-- | fs/jffs2/fs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 09e5d10b8840..ea1f37d4fc58 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -56,15 +56,20 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
56 | mdatalen = sizeof(dev); | 56 | mdatalen = sizeof(dev); |
57 | D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen)); | 57 | D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen)); |
58 | } else if (S_ISLNK(inode->i_mode)) { | 58 | } else if (S_ISLNK(inode->i_mode)) { |
59 | down(&f->sem); | ||
59 | mdatalen = f->metadata->size; | 60 | mdatalen = f->metadata->size; |
60 | mdata = kmalloc(f->metadata->size, GFP_USER); | 61 | mdata = kmalloc(f->metadata->size, GFP_USER); |
61 | if (!mdata) | 62 | if (!mdata) { |
63 | up(&f->sem); | ||
62 | return -ENOMEM; | 64 | return -ENOMEM; |
65 | } | ||
63 | ret = jffs2_read_dnode(c, f, f->metadata, mdata, 0, mdatalen); | 66 | ret = jffs2_read_dnode(c, f, f->metadata, mdata, 0, mdatalen); |
64 | if (ret) { | 67 | if (ret) { |
68 | up(&f->sem); | ||
65 | kfree(mdata); | 69 | kfree(mdata); |
66 | return ret; | 70 | return ret; |
67 | } | 71 | } |
72 | up(&f->sem); | ||
68 | D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of symlink target\n", mdatalen)); | 73 | D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of symlink target\n", mdatalen)); |
69 | } | 74 | } |
70 | 75 | ||