affs: fix missing unlocks in affs_remove_link
[linux-2.6.git] / fs / affs / amigaffs.c
index ccd624e..7d0f0a3 100644 (file)
@@ -170,21 +170,27 @@ affs_remove_link(struct dentry *dentry)
                if (!link_bh)
                        goto done;
 
-               dir = iget(sb, be32_to_cpu(AFFS_TAIL(sb, link_bh)->parent));
-               if (!dir)
+               dir = affs_iget(sb, be32_to_cpu(AFFS_TAIL(sb, link_bh)->parent));
+               if (IS_ERR(dir)) {
+                       retval = PTR_ERR(dir);
                        goto done;
+               }
 
                affs_lock_dir(dir);
                affs_fix_dcache(dentry, link_ino);
                retval = affs_remove_hash(dir, link_bh);
-               if (retval)
+               if (retval) {
+                       affs_unlock_dir(dir);
                        goto done;
+               }
                mark_buffer_dirty_inode(link_bh, inode);
 
                memcpy(AFFS_TAIL(sb, bh)->name, AFFS_TAIL(sb, link_bh)->name, 32);
                retval = affs_insert_hash(dir, bh);
-               if (retval)
+               if (retval) {
+                       affs_unlock_dir(dir);
                        goto done;
+               }
                mark_buffer_dirty_inode(bh, inode);
 
                affs_unlock_dir(dir);
@@ -445,7 +451,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
        va_list  args;
 
        va_start(args,fmt);
-       vsprintf(ErrorBuffer,fmt,args);
+       vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
        va_end(args);
 
        printk(KERN_CRIT "AFFS error (device %s): %s(): %s\n", sb->s_id,
@@ -461,7 +467,7 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
        va_list  args;
 
        va_start(args,fmt);
-       vsprintf(ErrorBuffer,fmt,args);
+       vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
        va_end(args);
 
        printk(KERN_WARNING "AFFS warning (device %s): %s(): %s\n", sb->s_id,