[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;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux