Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1284596 > unrolled thread

[PATCH] isofs: memory leaks when reading corrupted filesystems.

Started byQuentin Casasnovas <quentin.casasnovas@oracle.com>
First post2015-12-05 18:10 +0100
Last post2015-12-09 11:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] isofs: memory leaks when reading corrupted filesystems. Quentin Casasnovas <quentin.casasnovas@oracle.com> - 2015-12-05 18:10 +0100
    Re: [PATCH] isofs: memory leaks when reading corrupted filesystems. Jan Kara <jack@suse.cz> - 2015-12-09 11:00 +0100
    Re: [PATCH] isofs: memory leaks when reading corrupted filesystems. Jan Kara <jack@suse.cz> - 2015-12-09 11:00 +0100

#1284596 — [PATCH] isofs: memory leaks when reading corrupted filesystems.

FromQuentin Casasnovas <quentin.casasnovas@oracle.com>
Date2015-12-05 18:10 +0100
Subject[PATCH] isofs: memory leaks when reading corrupted filesystems.
Message-ID<qCovn-3R9-1@gated-at.bofh.it>
Vegard and I found that when a directory on isofs is corrupted, we are not
releasing the associated buffer_head, leading to a memory leak.  This was
introduced by:

 2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem")

This was found by fuzzing.

Cc: <stable@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>
Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading...")
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 fs/isofs/dir.c   | 1 +
 fs/isofs/namei.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index b943cbd..2e7d74c 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
 			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
 			       " in block %lu of inode %lu\n", block,
 			       inode->i_ino);
+			brelse(bh);
 			return -EIO;
 		}
 
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 7b543e6..696f255 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
 			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
 			       " in block %lu of inode %lu\n", block,
 			       dir->i_ino);
+			brelse(bh);
 			return 0;
 		}
 
-- 
2.4.9

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

[toc] | [next] | [standalone]


#1287301

FromJan Kara <jack@suse.cz>
Date2015-12-09 11:00 +0100
Message-ID<qDJHt-6FW-37@gated-at.bofh.it>
In reply to#1284596
On Sat 05-12-15 18:05:42, Quentin Casasnovas wrote:
> Vegard and I found that when a directory on isofs is corrupted, we are not
> releasing the associated buffer_head, leading to a memory leak.  This was
> introduced by:
> 
>  2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem")
> 
> This was found by fuzzing.
> 
> Cc: <stable@vger.kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading...")
> Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> Tested-by: Vegard Nossum <vegard.nossum@oracle.com>

BTW, please CC Andrew Morton since he usually merges isofs patches. Thanks!

								Honza
> ---
>  fs/isofs/dir.c   | 1 +
>  fs/isofs/namei.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
> index b943cbd..2e7d74c 100644
> --- a/fs/isofs/dir.c
> +++ b/fs/isofs/dir.c
> @@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
>  			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
>  			       " in block %lu of inode %lu\n", block,
>  			       inode->i_ino);
> +			brelse(bh);
>  			return -EIO;
>  		}
>  
> diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
> index 7b543e6..696f255 100644
> --- a/fs/isofs/namei.c
> +++ b/fs/isofs/namei.c
> @@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
>  			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
>  			       " in block %lu of inode %lu\n", block,
>  			       dir->i_ino);
> +			brelse(bh);
>  			return 0;
>  		}
>  
> -- 
> 2.4.9
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1287305

FromJan Kara <jack@suse.cz>
Date2015-12-09 11:00 +0100
Message-ID<qDJHt-6FW-47@gated-at.bofh.it>
In reply to#1284596
On Sat 05-12-15 18:05:42, Quentin Casasnovas wrote:
> Vegard and I found that when a directory on isofs is corrupted, we are not
> releasing the associated buffer_head, leading to a memory leak.  This was
> introduced by:
> 
>  2deb1acc653c ("isofs: fix access to unallocated memory when reading corrupted filesystem")
> 
> This was found by fuzzing.

Good catch. Thanks! You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> Cc: <stable@vger.kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Fixes: 2deb1acc653c ("isofs: fix access to unallocated memory when reading...")
> Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  fs/isofs/dir.c   | 1 +
>  fs/isofs/namei.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
> index b943cbd..2e7d74c 100644
> --- a/fs/isofs/dir.c
> +++ b/fs/isofs/dir.c
> @@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
>  			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
>  			       " in block %lu of inode %lu\n", block,
>  			       inode->i_ino);
> +			brelse(bh);
>  			return -EIO;
>  		}
>  
> diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
> index 7b543e6..696f255 100644
> --- a/fs/isofs/namei.c
> +++ b/fs/isofs/namei.c
> @@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
>  			printk(KERN_NOTICE "iso9660: Corrupted directory entry"
>  			       " in block %lu of inode %lu\n", block,
>  			       dir->i_ino);
> +			brelse(bh);
>  			return 0;
>  		}
>  
> -- 
> 2.4.9
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web