LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* gfs2_fh_to_parent() array overflow
@ 2007-10-24 16:26 Adrian Bunk
  2007-10-27 21:00 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2007-10-24 16:26 UTC (permalink / raw)
  To: Christoph Hellwig, swhiteho; +Cc: cluster-devel, linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gfs2_fh_to_parent() array overflow
  2007-10-24 16:26 gfs2_fh_to_parent() array overflow Adrian Bunk
@ 2007-10-27 21:00 ` Christoph Hellwig
  2007-10-29  9:11   ` Steven Whitehouse
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2007-10-27 21:00 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Christoph Hellwig, swhiteho, cluster-devel, linux-kernel

On Wed, Oct 24, 2007 at 06:26:26PM +0200, Adrian Bunk wrote:
> The Coverity checker spotted the following array overflow caused by
> commit 34c0d154243dd913c5690ae6ceb9557017429b9c:

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
want a patch for that or could you commit that one-liner directly?

> 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
---end quoted text---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gfs2_fh_to_parent() array overflow
  2007-10-27 21:00 ` Christoph Hellwig
@ 2007-10-29  9:11   ` Steven Whitehouse
  2008-02-13 21:31     ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Whitehouse @ 2007-10-29  9:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Adrian Bunk, cluster-devel, linux-kernel

Hi,

On Sat, 2007-10-27 at 23:00 +0200, Christoph Hellwig wrote:
> On Wed, Oct 24, 2007 at 06:26:26PM +0200, Adrian Bunk wrote:
> > The Coverity checker spotted the following array overflow caused by
> > commit 34c0d154243dd913c5690ae6ceb9557017429b9c:
> 
> 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
> want a patch for that or could you commit that one-liner directly?
> 

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,

Steve.

> > 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
> ---end quoted text---


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gfs2_fh_to_parent() array overflow
  2007-10-29  9:11   ` Steven Whitehouse
@ 2008-02-13 21:31     ` Adrian Bunk
  2008-02-14 10:44       ` Steven Whitehouse
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2008-02-13 21:31 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Christoph Hellwig, cluster-devel, linux-kernel

On Mon, Oct 29, 2007 at 09:11:21AM +0000, Steven Whitehouse wrote:
> Hi,
> 
> On Sat, 2007-10-27 at 23:00 +0200, Christoph Hellwig wrote:
> > On Wed, Oct 24, 2007 at 06:26:26PM +0200, Adrian Bunk wrote:
> > > The Coverity checker spotted the following array overflow caused by
> > > commit 34c0d154243dd913c5690ae6ceb9557017429b9c:
> > 
> > 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
> > want a patch for that or could you commit that one-liner directly?
> > 
> 
> 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,

This issue is still present in 2.6.25-rc1.

> Steve.
> 
> > > 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
> > > 

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gfs2_fh_to_parent() array overflow
  2008-02-13 21:31     ` Adrian Bunk
@ 2008-02-14 10:44       ` Steven Whitehouse
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Whitehouse @ 2008-02-14 10:44 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Christoph Hellwig, cluster-devel, linux-kernel

Hi,

On Wed, 2008-02-13 at 23:31 +0200, Adrian Bunk wrote:
> On Mon, Oct 29, 2007 at 09:11:21AM +0000, Steven Whitehouse wrote:
> > Hi,
> > 
> > On Sat, 2007-10-27 at 23:00 +0200, Christoph Hellwig wrote:
> > > On Wed, Oct 24, 2007 at 06:26:26PM +0200, Adrian Bunk wrote:
> > > > The Coverity checker spotted the following array overflow caused by
> > > > commit 34c0d154243dd913c5690ae6ceb9557017429b9c:
> > > 
> > > 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
> > > want a patch for that or could you commit that one-liner directly?
> > > 
> > 
> > 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,
> 
> This issue is still present in 2.6.25-rc1.
> 
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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-14 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-24 16:26 gfs2_fh_to_parent() array overflow Adrian Bunk
2007-10-27 21:00 ` Christoph Hellwig
2007-10-29  9:11   ` Steven Whitehouse
2008-02-13 21:31     ` Adrian Bunk
2008-02-14 10:44       ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).