greybus: es2: fix arpc active-list corruption
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 27 Jul 2016 14:37:22 +0000 (16:37 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 28 Jul 2016 17:04:06 +0000 (10:04 -0700)
Fix ARPC active-list corruption due to incorrect list-interface usage.

The corruption manifested itself as ARPC timeouts due to expected
responses not being recognised whenever more than one ARPC was active.

This could be seen for example when two interfaces were being runtime
suspended in parallel:

[  165.739896] usb 1-1.1: invalid arpc response id received: 13
[  165.794743] greybus 1-5.5: gb_interface_refclk_set - 0
[  166.241202] usb 1-1.1: failed to execute ARPC: -110

Fortunately the impact of this bug has so far been limited to such
timeouts and error messages due to ARPC currently only being used for
CPort reset in the connection tear-down path.

Reported-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/es2.c

index a22cb67..2020187 100644 (file)
@@ -1142,7 +1142,7 @@ static void arpc_add(struct es2_ap_dev *es2, struct arpc *rpc)
 {
        rpc->active = true;
        rpc->req->id = cpu_to_le16(es2->arpc_id_cycle++);
-       list_add_tail(&es2->arpcs, &rpc->list);
+       list_add_tail(&rpc->list, &es2->arpcs);
 }
 
 static void arpc_del(struct es2_ap_dev *es2, struct arpc *rpc)