Re: [CHECKER] A derefence of null pointer errorin JFS (jfs2.4,kernel 2.4.19)

From: Dave Kleikamp
Date: Fri Apr 30 2004 - 14:07:58 EST


On Tue, 2004-04-27 at 01:56, Junfeng Yang wrote:
> file fs/jfs/jfs_dtree.c
> -----------------------------------------------------------
> [BUG] get_metapage can return null when grab_cache_page or read_cache_page
> fails in function __get_metapage.

Thanks. This patch should fix it. I'll submit the fix to Linus &
Marcelo.

Shaggy

===== fs/jfs/jfs_dtree.c 1.27 vs edited =====
--- 1.27/fs/jfs/jfs_dtree.c Wed Mar 24 14:11:46 2004
+++ edited/fs/jfs/jfs_dtree.c Fri Apr 30 13:47:31 2004
@@ -982,7 +982,9 @@
split->pxdlist = &pxdlist;
rc = dtSplitRoot(tid, ip, split, &rmp);

- DT_PUTPAGE(rmp);
+ if (!rc)
+ DT_PUTPAGE(rmp);
+
DT_PUTPAGE(smp);

goto freeKeyName;
@@ -1876,6 +1878,9 @@
xlen = lengthPXD(pxd);
xsize = xlen << JFS_SBI(sb)->l2bsize;
rmp = get_metapage(ip, rbn, xsize, 1);
+ if (!rmp)
+ return -EIO;
+
rp = rmp->data;

BT_MARK_DIRTY(rmp, ip);

--
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/