summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
authorChandra Seetharaman2011-08-03 04:18:29 +0200
committerAlex Elder2011-08-12 20:39:29 +0200
commitac4d6888b21a8be373f3e06f1d4011fbe2bbbeac (patch)
tree6a39e3be9bcf99cddc0ce0b0ed15aac794b527f8 /fs/xfs/xfs_vnodeops.c
parent"xfs: fix error handling for synchronous writes" revisited (diff)
downloadkernel-qcow2-linux-ac4d6888b21a8be373f3e06f1d4011fbe2bbbeac.tar.gz
kernel-qcow2-linux-ac4d6888b21a8be373f3e06f1d4011fbe2bbbeac.tar.xz
kernel-qcow2-linux-ac4d6888b21a8be373f3e06f1d4011fbe2bbbeac.zip
xfs: Check the return value of xfs_buf_read() for NULL
Check the return value of xfs_buf_read() for NULL and return ENOMEM if it is NULL. This is necessary in a few spots to avoid subsequent code blindly dereferencing the null buffer pointer. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index dd05360ad56f..2a432d00d4c1 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -83,6 +83,8 @@ xfs_readlink_bmap(
bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),
XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK);
+ if (!bp)
+ return XFS_ERROR(ENOMEM);
error = xfs_buf_geterror(bp);
if (error) {
xfs_ioerror_alert("xfs_readlink",