From: "Jan Beulich" <JBeulich@novell.com>
To: "Chris Mason" <chris.mason@oracle.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] fix (latent?) memory corruption in btrfs_encode_fh()
Date: Thu, 07 Oct 2010 10:28:44 +0100 [thread overview]
Message-ID: <4CADAEEC020000780001B32C@vpn.id2.novell.com> (raw)
The earlier checks only cover the two smaller cases, and hence if the
caller specified size is less than what's needed to fit
parent_root_objectid unrelated memory may get overwritten.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
---
fs/btrfs/export.c | 2 ++
1 file changed, 2 insertions(+)
--- linux-2.6.36-rc7/fs/btrfs/export.c
+++ 2.6.36-rc7-btrfs-encode-fh/fs/btrfs/export.c
@@ -46,6 +46,8 @@ static int btrfs_encode_fh(struct dentry
spin_unlock(&dentry->d_lock);
if (parent_root_id != fid->root_objectid) {
+ if (*max_len < BTRFS_FID_SIZE_CONNECTABLE_ROOT)
+ return 255;
fid->parent_root_objectid = parent_root_id;
len = BTRFS_FID_SIZE_CONNECTABLE_ROOT;
type = FILEID_BTRFS_WITH_PARENT_ROOT;
reply other threads:[~2010-10-07 9:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4CADAEEC020000780001B32C@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).