[PATCH] fs/affs: fix an error code in affs_write_end_ofs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"prev_bh" is a valid pointer.  "bh" is an error pointer.  "written" is
either an error pointer, or a the number of bytes we have written.  If
we haven't written any bytes then we want to return the error code
stored in "bh".  So we need to that before resetting "bh" to a valid
pointer.

This bug is older than git.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/fs/affs/file.c b/fs/affs/file.c
index 196ee7f6fdc4..99610050199c 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -800,9 +800,9 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
 	return written;
 
 err_bh:
-	bh = prev_bh;
 	if (!written)
 		written = PTR_ERR(bh);
+	bh = prev_bh;
 	goto done;
 }
 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux