Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iser-target: Fix error path in isert_create_pi_ctx()

We don't assign pi_ctx to desc->pi_ctx until we're certain to succeed
in the function. That means the cleanup path should use the local
pi_ctx variable, not desc->pi_ctx.

This was detected by Coverity (CID 1260062).

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Roland Dreier and committed by
Nicholas Bellinger
b2feda4f a3541703

+3 -3
+3 -3
drivers/infiniband/ulp/isert/ib_isert.c
··· 547 return 0; 548 549 err_prot_mr: 550 - ib_dereg_mr(desc->pi_ctx->prot_mr); 551 err_prot_frpl: 552 - ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl); 553 err_pi_ctx: 554 - kfree(desc->pi_ctx); 555 556 return ret; 557 }
··· 547 return 0; 548 549 err_prot_mr: 550 + ib_dereg_mr(pi_ctx->prot_mr); 551 err_prot_frpl: 552 + ib_free_fast_reg_page_list(pi_ctx->prot_frpl); 553 err_pi_ctx: 554 + kfree(pi_ctx); 555 556 return ret; 557 }