From: Andrew Morton <akpm@linux-foundation.org>
To: "young dave" <hidave.darkstar@gmail.com>
Cc: "Christoph Lameter" <clameter@sgi.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
Anton Altaparmakov <aia21@cantab.net>
Subject: Re: 2.6.22-rc2-mm1 NTFS & SLUB related fix
Date: Thu, 24 May 2007 22:47:09 -0700 [thread overview]
Message-ID: <20070524224709.0719acfe.akpm@linux-foundation.org> (raw)
In-Reply-To: <a8e1da0705242222n2414a66bo97d20c82c6a497e4@mail.gmail.com>
On Fri, 25 May 2007 05:22:50 +0000 "young dave" <hidave.darkstar@gmail.com> wrote:
> Hi,
>
> > Is this ntfs_init_locked_inode?
>
> Yes, it is.
>
> > > Bytes b4 0xc2959e28: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a
> > > Object 0xc2959e38: 24 00 51 00 00 00 6b a5
> > > Redzone 0xc2959e40: 00 00 cc cc
> >
> > First two bytes after the object overwritten. The allocation for this
> > object should have been two bytes longer.
> >
> > > Last alloc: ntfs_init_locked_inode+0x9e/0x110 jiffies_ago=5140 cpu=0 pid=1604
> >
> > This is the function that allocated a too short object.
> >
>
> Only the last one byte of the string is zeroed, but It malloced 2
> more byte appended the string because size of thentfschar type is 2
> bytes , is this the reason? But why?
>
Thing is, ntfs_inode.name[] is an array of le16's. But local variable `i'
in there is a byte index, not an le16 index. We end up writing that 0x0000
at twice the intended offset.
So I think this was meant:
--- a/fs/ntfs/inode.c~a
+++ a/fs/ntfs/inode.c
@@ -140,7 +140,7 @@ static int ntfs_init_locked_inode(struct
if (!ni->name)
return -ENOMEM;
memcpy(ni->name, na->name, i);
- ni->name[i] = 0;
+ ni->name[na->name_len] = 0;
}
return 0;
}
_
next prev parent reply other threads:[~2007-05-25 5:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 5:01 2.6.22-rc2-mm1 NTFS & SLUB related fix young dave
2007-05-25 5:07 ` Christoph Lameter
2007-05-25 5:22 ` young dave
2007-05-25 5:47 ` Andrew Morton [this message]
2007-05-25 6:27 ` young dave
2007-05-25 6:43 ` Andrew Morton
2007-05-25 6:48 ` young dave
2007-05-25 7:01 ` Andrew Morton
2007-05-25 7:10 ` young dave
2007-05-25 7:18 ` Andrew Morton
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=20070524224709.0719acfe.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aia21@cantab.net \
--cc=clameter@sgi.com \
--cc=hidave.darkstar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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