From: Eric Sesterhenn <snakebyte@gmx.de>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
akpm@linux-foundation.org
Subject: Re: [Patch] Check hfs_bnode_find return value
Date: Thu, 4 Sep 2008 14:17:05 +0200 [thread overview]
Message-ID: <20080904121705.GA30173@alice> (raw)
In-Reply-To: <Pine.LNX.4.64.0808290405480.2507@localhost.localdomain>
hi,
sorry i just noticed that the mail from yesterday was broken...
* Roman Zippel (zippel@linux-m68k.org) wrote:
> Hi,
>
> On Tue, 26 Aug 2008, Eric Sesterhenn wrote:
>
> > --- linux/fs/hfsplus/brec.c.orig 2008-08-26 19:18:56.000000000 +0200
> > +++ linux/fs/hfsplus/brec.c 2008-08-26 19:19:27.000000000 +0200
> > @@ -304,6 +304,8 @@ static struct hfs_bnode *hfs_bnode_split
> > /* update next bnode header */
> > if (new_node->next) {
> > struct hfs_bnode *next_node = hfs_bnode_find(tree, new_node->next);
> > + if (IS_ERR(next_node))
> > + return next_node;
> > next_node->prev = new_node->this;
> > hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc));
> > node_desc.prev = cpu_to_be32(next_node->prev);
>
> Al Viro already fixed this for HFS in a better way, could you please adopt
> his solution?
This is the patch from hfs applied to hfsplus (see
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3d10a15d6919488204bdb264050d156ced20d9aa
). Guess Al should sign this off since it is his work?
--- linux/fs/hfsplus/brec.c.orig 2008-09-03 17:00:07.000000000 +0200
+++ linux/fs/hfsplus/brec.c 2008-09-03 17:00:43.000000000 +0200
@@ -216,7 +216,7 @@ skip:
static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
{
struct hfs_btree *tree;
- struct hfs_bnode *node, *new_node;
+ struct hfs_bnode *node, *new_node, *next_node;
struct hfs_bnode_desc node_desc;
int num_recs, new_rec_off, new_off, old_rec_off;
int data_start, data_end, size;
@@ -235,6 +235,17 @@ static struct hfs_bnode *hfs_bnode_split
new_node->type = node->type;
new_node->height = node->height;
+ if (node->next)
+ next_node = hfs_bnode_find(tree, node->next);
+ else
+ next_node = NULL;
+
+ if (IS_ERR(next_node)) {
+ hfs_bnode_put(node);
+ hfs_bnode_put(new_node);
+ return next_node;
+ }
+
size = tree->node_size / 2 - node->num_recs * 2 - 14;
old_rec_off = tree->node_size - 4;
num_recs = 1;
@@ -248,6 +259,8 @@ static struct hfs_bnode *hfs_bnode_split
/* panic? */
hfs_bnode_put(node);
hfs_bnode_put(new_node);
+ if (next_node)
+ hfs_bnode_put(next_node);
return ERR_PTR(-ENOSPC);
}
@@ -302,8 +315,7 @@ static struct hfs_bnode *hfs_bnode_split
hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc));
/* update next bnode header */
- if (new_node->next) {
- struct hfs_bnode *next_node = hfs_bnode_find(tree, new_node->next);
+ if (next_node) {
next_node->prev = new_node->this;
hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc));
node_desc.prev = cpu_to_be32(next_node->prev);
----- End forwarded message -----
prev parent reply other threads:[~2008-09-04 12:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-26 17:23 [Patch] Check hfs_bnode_find return value Eric Sesterhenn
2008-08-29 2:07 ` Roman Zippel
2008-09-04 12:17 ` Eric Sesterhenn [this message]
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=20080904121705.GA30173@alice \
--to=snakebyte@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zippel@linux-m68k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.