Skip to content

Commit

Permalink
btree: catch NULL value before it does harm
Browse files Browse the repository at this point in the history
Storing NULL values in the btree is illegal and can lead to memory
corruption and possible other fun as well.  Catch it on insert, instead
of waiting for the inevitable.

Signed-off-by: Joern Engel <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Joern Engel authored and torvalds committed Jun 7, 2012
1 parent cbf8ae3 commit 39caa09
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ static int btree_insert_level(struct btree_head *head, struct btree_geo *geo,
int btree_insert(struct btree_head *head, struct btree_geo *geo,
unsigned long *key, void *val, gfp_t gfp)
{
BUG_ON(!val);
return btree_insert_level(head, geo, key, val, 1, gfp);
}
EXPORT_SYMBOL_GPL(btree_insert);
Expand Down

0 comments on commit 39caa09

Please sign in to comment.