[PATCH 01/13] fs/unionfs: Fix a memory leak & null pointer dereference

2007-03-04 Thread Josef 'Jeff' Sipek
From: Erez Zadok <[EMAIL PROTECTED]>

Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>
Signed-off-by: Josef 'Jeff' Sipek <[EMAIL PROTECTED]>
---
 fs/unionfs/commonfops.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 379c525..66d6ce9 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -230,7 +230,7 @@ int unionfs_file_revalidate(struct file *file, int 
willwrite)
unionfs_read_lock(sb);
if (!unionfs_d_revalidate(dentry, NULL) && !d_deleted(dentry)) {
err = -ESTALE;
-   goto out;
+   goto out_nofree;
}
 
sbgen = atomic_read(_SB(sb)->generation);
@@ -286,6 +286,9 @@ int unionfs_file_revalidate(struct file *file, int 
willwrite)
}
 
 out:
+   if (err)
+   kfree(UNIONFS_F(file)->lower_files);
+out_nofree:
unionfs_unlock_dentry(dentry);
unionfs_read_unlock(dentry->d_sb);
return err;
@@ -391,7 +394,7 @@ int unionfs_open(struct inode *inode, struct file *file)
file->private_data = kzalloc(sizeof(struct unionfs_file_info), 
GFP_KERNEL);
if (!UNIONFS_F(file)) {
err = -ENOMEM;
-   goto out;
+   goto out_nofree;
}
fbstart(file) = -1;
fbend(file) = -1;
@@ -444,7 +447,7 @@ out:
kfree(UNIONFS_F(file)->lower_files);
kfree(UNIONFS_F(file));
}
-
+out_nofree:
return err;
 }
 
-- 
1.5.0.2.260.g2eb065

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/13] fs/unionfs: Fix a memory leak null pointer dereference

2007-03-04 Thread Josef 'Jeff' Sipek
From: Erez Zadok [EMAIL PROTECTED]

Signed-off-by: Erez Zadok [EMAIL PROTECTED]
Signed-off-by: Josef 'Jeff' Sipek [EMAIL PROTECTED]
---
 fs/unionfs/commonfops.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 379c525..66d6ce9 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -230,7 +230,7 @@ int unionfs_file_revalidate(struct file *file, int 
willwrite)
unionfs_read_lock(sb);
if (!unionfs_d_revalidate(dentry, NULL)  !d_deleted(dentry)) {
err = -ESTALE;
-   goto out;
+   goto out_nofree;
}
 
sbgen = atomic_read(UNIONFS_SB(sb)-generation);
@@ -286,6 +286,9 @@ int unionfs_file_revalidate(struct file *file, int 
willwrite)
}
 
 out:
+   if (err)
+   kfree(UNIONFS_F(file)-lower_files);
+out_nofree:
unionfs_unlock_dentry(dentry);
unionfs_read_unlock(dentry-d_sb);
return err;
@@ -391,7 +394,7 @@ int unionfs_open(struct inode *inode, struct file *file)
file-private_data = kzalloc(sizeof(struct unionfs_file_info), 
GFP_KERNEL);
if (!UNIONFS_F(file)) {
err = -ENOMEM;
-   goto out;
+   goto out_nofree;
}
fbstart(file) = -1;
fbend(file) = -1;
@@ -444,7 +447,7 @@ out:
kfree(UNIONFS_F(file)-lower_files);
kfree(UNIONFS_F(file));
}
-
+out_nofree:
return err;
 }
 
-- 
1.5.0.2.260.g2eb065

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/