Whamcloud - gitweb
LU-3585 ptlrpc: Fix a crash when dereferencing NULL pointer
authorAmir Shehata <amir.shehata@intel.com>
Thu, 25 Jul 2013 20:13:55 +0000 (13:13 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 8 Aug 2013 06:07:57 +0000 (02:07 -0400)
commit164400dd037cfcaba884a9b5321a5fec3826d116
tree4f8cd777edbd53e35adc89f7d5bf53b0f755dd9f
parentd086ddd0c5397d7eb06d025ce742aa1d465a2adf
LU-3585 ptlrpc: Fix a crash when dereferencing NULL pointer

When a system runs out of memory and the function
ptlrpc_register_bulk() is called from ptl_send_rpc() the call to
LNetMEAttach() fails due to failure to allocate memory.  This forces
the code into an error path, which most probably previously went
untested.  The error path:
if (rc != 0) {
CERROR("%s: LNetMEAttach failed x"LPU64"/%d: rc = %dn",
desc->bd_export->exp_obd->obd_name, xid,
posted_md, rc);
break;
}
This print assumes that desc->bd_export is not NULL.  However, it is.
In fact it is expected to be NULL.  desc->bd_import is the correct
structure to access in this case.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: I772ec757af224b9868956cc3fc9dc00e804fe84d
Reviewed-on: http://review.whamcloud.com/7121
Tested-by: Hudson
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/niobuf.c