Check trans before dereferencing it.

Signed-off-by: Eryu Guan <[email protected]>
---
 ctree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctree.c b/ctree.c
index 1434007..f9d972a 100644
--- a/ctree.c
+++ b/ctree.c
@@ -356,7 +356,7 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
                WARN_ON(1);
        }
        */
-       if (trans->transid != root->fs_info->generation) {
+       if (trans && trans->transid != root->fs_info->generation) {
                printk(KERN_CRIT "trans %llu running %llu\n",
                        (unsigned long long)trans->transid,
                        (unsigned long long)root->fs_info->generation);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to