From: Jan Kara <jack@suse.cz>
To: chris.mason@oracle.com
Cc: linux-btrfs@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH] btrfs: Do not return more items that user asked from from search ioctl
Date: Fri, 20 Aug 2010 23:40:32 +0200 [thread overview]
Message-ID: <1282340432-15564-1-git-send-email-jack@suse.cz> (raw)
While searching a tree we didn't properly check number of items we really
stored in user's buffer thus possibly exceeding number of items requested
by user. This was mostly harmless since actual buffer overflow is checked
correctly in a different place. Anyway, let's fix the check.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/btrfs/ioctl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 9254b3d..94e7ab5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -977,7 +977,7 @@ static noinline int copy_to_sk(struct btrfs_root *root,
}
found++;
- if (*num_found >= sk->nr_items)
+ if (*num_found + found >= sk->nr_items)
break;
}
advance_key:
--
1.6.4.2
reply other threads:[~2010-08-20 21:40 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=1282340432-15564-1-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--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).