提交 ac4d6888 编写于 作者: C Chandra Seetharaman 提交者: Alex Elder

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: NChandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 9e978d8f
...@@ -2131,6 +2131,8 @@ xlog_recover_buffer_pass2( ...@@ -2131,6 +2131,8 @@ xlog_recover_buffer_pass2(
bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len, bp = xfs_buf_read(mp->m_ddev_targp, buf_f->blf_blkno, buf_f->blf_len,
buf_flags); buf_flags);
if (!bp)
return XFS_ERROR(ENOMEM);
error = xfs_buf_geterror(bp); error = xfs_buf_geterror(bp);
if (error) { if (error) {
xfs_ioerror_alert("xlog_recover_do..(read#1)", mp, xfs_ioerror_alert("xlog_recover_do..(read#1)", mp,
...@@ -2222,6 +2224,10 @@ xlog_recover_inode_pass2( ...@@ -2222,6 +2224,10 @@ xlog_recover_inode_pass2(
bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len,
XBF_LOCK); XBF_LOCK);
if (!bp) {
error = ENOMEM;
goto error;
}
error = xfs_buf_geterror(bp); error = xfs_buf_geterror(bp);
if (error) { if (error) {
xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, xfs_ioerror_alert("xlog_recover_do..(read#2)", mp,
......
...@@ -83,6 +83,8 @@ xfs_readlink_bmap( ...@@ -83,6 +83,8 @@ xfs_readlink_bmap(
bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt),
XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK); XBF_LOCK | XBF_MAPPED | XBF_DONT_BLOCK);
if (!bp)
return XFS_ERROR(ENOMEM);
error = xfs_buf_geterror(bp); error = xfs_buf_geterror(bp);
if (error) { if (error) {
xfs_ioerror_alert("xfs_readlink", xfs_ioerror_alert("xfs_readlink",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册