summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre
diff options
context:
space:
mode:
authorNiu Yawei <yawei.niu@intel.com>2016-05-04 10:28:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-09 14:01:14 +0200
commit2ff1d8fbba493538e0d0c4f0e2dcd9c4bb0eb21a (patch)
tree7adab4b52d75a289ec3cbbb157a99f4fe8e3bd88 /drivers/staging/lustre
parent4fd9a8e937368781ac830402a3bcb87646999946 (diff)
downloadop-kernel-dev-2ff1d8fbba493538e0d0c4f0e2dcd9c4bb0eb21a.zip
op-kernel-dev-2ff1d8fbba493538e0d0c4f0e2dcd9c4bb0eb21a.tar.gz
staging: lustre: ptlrpc: fix nrs cleanup
When service start failed due to short of memory, the cleanup code could operate on uninitialized structure and cause crash at the end. This patch fix the nrs_svcpt_cleanup_locked() to perform cleanup only on the nrs which has been properly initialized. Signed-off-by: Niu Yawei <yawei.niu@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3772 Reviewed-on: http://review.whamcloud.com/7410 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/nrs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
index 99ff6e8..c444f51 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
@@ -975,7 +975,11 @@ static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt)
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
again:
- nrs = nrs_svcpt2nrs(svcpt, hp);
+ /* scp_nrs_hp could be NULL due to short of memory. */
+ nrs = hp ? svcpt->scp_nrs_hp : &svcpt->scp_nrs_reg;
+ /* check the nrs_svcpt to see if nrs is initialized. */
+ if (!nrs || !nrs->nrs_svcpt)
+ return;
nrs->nrs_stopping = 1;
list_for_each_entry_safe(policy, tmp, &nrs->nrs_policy_list, pol_list) {
OpenPOWER on IntegriCloud