[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120504190939.GA12976@kroah.com>
Date: Fri, 4 May 2012 12:09:39 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Timo Warns <warns@...-sense.de>
Cc: WANG Cong <amwang@...hat.com>,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
Miklos Szeredi <mszeredi@...e.cz>,
Sage Weil <sage@...dream.net>, Eugene Teo <eteo@...hat.com>,
Roman Zippel <zippel@...ux-m68k.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@....de>,
Alexey Dobriyan <adobriyan@...il.com>,
Dave Anderson <anderson@...hat.com>,
stable <stable@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] hfsplus: Fix potential buffer overflows
commit ec81aecb29668ad71f699f4e7b96ec46691895b6 (hfs: fix a potential
buffer overflow) fixed a few potential buffer overflows in the hfs
filesystem. But as Timo Warns pointed out, these changes also need to
be made on the hfsplus filesystem as well.
Reported-by: Timo Warns <warns@...-sense.de>
Cc: WANG Cong <amwang@...hat.com>
Cc: Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc: Cong Wang <amwang@...hat.com>
Cc: Miklos Szeredi <mszeredi@...e.cz>
Cc: Sage Weil <sage@...dream.net>
Cc: Eugene Teo <eteo@...hat.com>
Cc: Roman Zippel <zippel@...ux-m68k.org>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Christoph Hellwig <hch@....de>
Cc: Alexey Dobriyan <adobriyan@...il.com>
Cc: Dave Anderson <anderson@...hat.com>
Cc: stable <stable@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/hfsplus/catalog.c | 4 ++++
fs/hfsplus/dir.c | 11 +++++++++++
2 files changed, 15 insertions(+)
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid,
err = hfs_brec_find(&src_fd);
if (err)
goto out;
+ if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
+ err = -EIO;
+ goto out;
+ }
hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
src_fd.entrylength);
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *
filp->f_pos++;
/* fall through */
case 1:
+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
+ err = -EIO;
+ goto out;
+ }
+
hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
fd.entrylength);
if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
@@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *
err = -EIO;
goto out;
}
+
+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
+ err = -EIO;
+ goto out;
+ }
+
hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
fd.entrylength);
type = be16_to_cpu(entry.type);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists