Re: gfs2_fh_to_parent() array overflow

Previous thread: [2.6 patch] acpi/ec.c: fix use-after-free by Adrian Bunk on Wednesday, October 24, 2007 - 12:26 pm. (5 messages)

Next thread: [2.6 patch] mm/: remove unused exports by Adrian Bunk on Wednesday, October 24, 2007 - 12:26 pm. (1 message)
To: Christoph Hellwig <hch@...>, <swhiteho@...>
Cc: <cluster-devel@...>, <linux-kernel@...>
Date: Wednesday, October 24, 2007 - 12:26 pm

The Coverity checker spotted the following array overflow caused by
commit 34c0d154243dd913c5690ae6ceb9557017429b9c:

include/linux/exportfs.h contains:

<-- snip -->

...
struct fid {
...
__u32 raw[6];
};
};

<-- snip -->

fs/gfs2/ops_export.c contains:

<-- snip -->

...
static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type)
{
struct gfs2_inum_host parent;
__be32 *fh = (__force __be32 *)fid->raw; <------------

switch (fh_type) {
case GFS2_LARGE_FH_SIZE:
case GFS2_OLD_FH_SIZE:
parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
parent.no_formal_ino |= be32_to_cpu(fh[5]);
parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
^^^^^
parent.no_addr |= be32_to_cpu(fh[7]);
... ^^^^^

<-- snip -->

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-

To: Adrian Bunk <bunk@...>
Cc: Christoph Hellwig <hch@...>, <swhiteho@...>, <cluster-devel@...>, <linux-kernel@...>
Date: Saturday, October 27, 2007 - 5:00 pm

The line is a left-over from times when gfs stored the mode of the
inode in the file handle. It can simply be deleted. Steve, do you
---end quoted text---
-

To: Christoph Hellwig <hch@...>
Cc: Adrian Bunk <bunk@...>, <cluster-devel@...>, <linux-kernel@...>
Date: Monday, October 29, 2007 - 5:11 am

Hi,

I'm just back from holiday this morning and this is looking a bit more
complicated than that... give me a day or two and I'll try and come up
with a solution,

-

To: Steven Whitehouse <swhiteho@...>
Cc: Christoph Hellwig <hch@...>, <cluster-devel@...>, <linux-kernel@...>
Date: Wednesday, February 13, 2008 - 5:31 pm

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

--

To: Adrian Bunk <bunk@...>
Cc: Christoph Hellwig <hch@...>, <cluster-devel@...>, <linux-kernel@...>
Date: Thursday, February 14, 2008 - 6:44 am

Hi,

Yes, it seems to have slipped off my list somehow... I've opened a bz
(#432775 at bugzilla.redhat.com) to ensure that it doesn't get missed
again,

Steve.

--

Previous thread: [2.6 patch] acpi/ec.c: fix use-after-free by Adrian Bunk on Wednesday, October 24, 2007 - 12:26 pm. (5 messages)

Next thread: [2.6 patch] mm/: remove unused exports by Adrian Bunk on Wednesday, October 24, 2007 - 12:26 pm. (1 message)