Procházet zdrojové kódy

GFS2: Fix refcnt leak on gfs2_follow_link() error path

If ->follow_link handler return the error, it should decrement
nd->path refcnt.

This patch fix it.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
OGAWA Hirofumi před 15 roky
rodič
revize
0f585f14d4
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      fs/gfs2/ops_inode.c

+ 2 - 1
fs/gfs2/ops_inode.c

@@ -1088,7 +1088,8 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
 		error = vfs_follow_link(nd, buf);
 		error = vfs_follow_link(nd, buf);
 		if (buf != array)
 		if (buf != array)
 			kfree(buf);
 			kfree(buf);
-	}
+	} else
+		path_put(&nd->path);
 
 
 	return ERR_PTR(error);
 	return ERR_PTR(error);
 }
 }