comparison usr/src/uts/common/io/comstar/port/pppt/pppt_msg.c @ 14069:13ecd3583387

3775 Upstreaming of ALUA use-after-free fixes from Nexenta Reviewed by: Saso Kiselkov <skiselkov.ml@gmail.com> Reviewed by: T Nguyen <truongqnguien@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Dan McDonald <danmcd@nexenta.com>
date Thu, 27 Jun 2013 13:54:16 -0400
parents 1d9a1ccf92e6
children
comparison
equal deleted inserted replaced
14068:2547a41b1162 14069:13ecd3583387
18 * 18 *
19 * CDDL HEADER END 19 * CDDL HEADER END
20 */ 20 */
21 /* 21 /*
22 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 22 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
23 */ 24 */
24 25
25 #include <sys/cpuvar.h> 26 #include <sys/cpuvar.h>
26 #include <sys/types.h> 27 #include <sys/types.h>
27 #include <sys/conf.h> 28 #include <sys/conf.h>
314 */ 315 */
315 ptask->pt_stmf_task = stmf_task_alloc(lport, stmf_sess, 316 ptask->pt_stmf_task = stmf_task_alloc(lport, stmf_sess,
316 scmd->icsc_task_lun_no, 317 scmd->icsc_task_lun_no,
317 scmd->icsc_task_cdb_length, 0); 318 scmd->icsc_task_cdb_length, 0);
318 if (ptask->pt_stmf_task == NULL) { 319 if (ptask->pt_stmf_task == NULL) {
320 /* NOTE: pppt_task_done() will free ptask. */
319 (void) pppt_task_done(ptask); 321 (void) pppt_task_done(ptask);
320 pppt_task_free(ptask);
321 pppt_sess_rele(pppt_sess); 322 pppt_sess_rele(pppt_sess);
322 pppt_msg_tx_status(msg, STMF_ALLOC_FAILURE); 323 pppt_msg_tx_status(msg, STMF_ALLOC_FAILURE);
323 stmf_ic_msg_free(msg); 324 stmf_ic_msg_free(msg);
324 PPPT_INC_STAT(es_scmd_stask_alloc_fail); 325 PPPT_INC_STAT(es_scmd_stask_alloc_fail);
325 return; 326 return;
326 } 327 }
327 328
328 task = ptask->pt_stmf_task; 329 task = ptask->pt_stmf_task;
330 /* task_port_private reference is a real reference. */
331 (void) pppt_task_hold(ptask);
329 task->task_port_private = ptask; 332 task->task_port_private = ptask;
330 task->task_flags = scmd->icsc_task_flags; 333 task->task_flags = scmd->icsc_task_flags;
331 task->task_additional_flags = 0; 334 task->task_additional_flags = 0;
332 task->task_priority = 0; 335 task->task_priority = 0;
333 336