mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Quentin Casasnovas <quentin.casasnovas@oracle.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Vegard Nossum <vegard.nossum@oracle.com>,
	Sasha Levin <sasha.levin@oracle.com>, Jan Kara <jack@suse.cz>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>
Subject: [PATCH] isofs: memory leaks when reading corrupted filesystems.
Date: Sat,  5 Dec 2015 18:05:42 +0100	[thread overview]
Message-ID: <1449335142-6798-1-git-send-email-quentin.casasnovas@oracle.com> (raw)

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


             reply	other threads:[~2015-12-05 17:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-05 17:05 Quentin Casasnovas [this message]
2015-12-09  9:51 ` Jan Kara
2015-12-09  9:52 ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449335142-6798-1-git-send-email-quentin.casasnovas@oracle.com \
    --to=quentin.casasnovas@oracle.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®