test-tool: Avoid that using receive_copy_results() triggers a use-after-free
Move the scsi_free_scsi_task() call from receive_copy_results() to the callers of this function to avoid that accessing the unmarshalled data triggers a use-after-free. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
cacc144a29
commit
be9b803334
@@ -30,16 +30,17 @@ void
|
||||
test_receive_copy_results_op_params(void)
|
||||
{
|
||||
int ret;
|
||||
struct scsi_task *op_task;
|
||||
struct scsi_copy_results_op_params *opp;
|
||||
|
||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||
logging(LOG_VERBOSE, "Test RECEIVE COPY RESULTS, OPERATING PARAMS");
|
||||
|
||||
ret = receive_copy_results(sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
|
||||
ret = receive_copy_results(&op_task, sd, SCSI_COPY_RESULTS_OP_PARAMS, 0,
|
||||
(void **)&opp, EXPECT_STATUS_GOOD);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] RECEIVE_COPY_RESULT is not implemented.");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
@@ -47,4 +48,7 @@ test_receive_copy_results_op_params(void)
|
||||
"max_target_desc=%d, max_seg_desc=%d",
|
||||
opp->max_target_desc_count,
|
||||
opp->max_segment_desc_count);
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(op_task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user