]> git.baikalelectronics.ru Git - kernel.git/commit
target: Prevent cmd->se_queue_node double add
authorRoland Dreier <roland@purestorage.com>
Thu, 29 Sep 2011 05:12:07 +0000 (22:12 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 24 Oct 2011 03:17:51 +0000 (03:17 +0000)
commitad9a90821fffd51409df95b1af10c0eb97dd02db
tree85919eb3addb0b488f9d5361a375c961e5e311a3
parentb0a9177ce8f90245240f20551336e1a867fc28ad
target: Prevent cmd->se_queue_node double add

This patch addresses a bug with the lio-core-2.6.git conversion of
transport_add_cmd_to_queue() to use a single embedded list_head, instead
of individual struct se_queue_req allocations allowing a single se_cmd to
be added to the queue mulitple times.  This was changed in the following:

commit 2a9e4d5ca5d99f4c600578d6285d45142e7e5208
Author: Andy Grover <agrover@redhat.com>
Date:   Tue Apr 26 17:45:51 2011 -0700

    target: Embed qr in struct se_cmd

The problem is that some target code still assumes performing multiple
adds is allowed via transport_add_cmd_to_queue(), which ends up causing
list corruption in qobj->qobj_list code.  This patch addresses this
by removing an existing struct se_cmd from the list before the add, and
removes an unnecessary list walk in transport_remove_cmd_from_queue()

It also changes cmd->t_transport_queue_active to use explict sets intead
of increment/decrement to prevent confusion during exception path handling.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Andy Grover <agrover@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
drivers/target/target_core_tmr.c
drivers/target/target_core_transport.c