GFS2: check NULL return value in gfs2_ok_to_move
authorAbhi Das <adas@redhat.com>
Wed, 12 Mar 2014 08:41:44 +0000 (03:41 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Wed, 12 Mar 2014 09:50:27 +0000 (09:50 +0000)
gfs2_lookupi() can return NULL if the path to the root is broken by
another rename/rmdir. In this case gfs2_ok_to_move() must check for
this NULL pointer and return error.

Resolves: rhbz#1060246
Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/inode.c

index ec455b92091f97480fba5bdb8188cbf5ca2d50f7..b52ebf8553c2e6a672b7c21d2f6b29329a8b78c0 100644 (file)
@@ -1299,6 +1299,10 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
                }
 
                tmp = gfs2_lookupi(dir, &gfs2_qdotdot, 1);
+               if (!tmp) {
+                       error = -ENOENT;
+                       break;
+               }
                if (IS_ERR(tmp)) {
                        error = PTR_ERR(tmp);
                        break;