aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/greybus.h
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-07-01 12:37:21 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-01 16:43:02 -0700
commit3e136cc9e05e1a34d8602a4d4e31c9d93ccbbdf7 (patch)
treec5e33b5a43625317b9e4213e296328fd1ecbdeac /drivers/staging/greybus/greybus.h
parentgreybus: bundles: remove gb_bundle(s)_init() (diff)
downloadlinux-dev-3e136cc9e05e1a34d8602a4d4e31c9d93ccbbdf7.tar.xz
linux-dev-3e136cc9e05e1a34d8602a4d4e31c9d93ccbbdf7.zip
greybus: operation/esx: fix message-cancellation lifetime bugs
The current host-controller message-cancellation implementation suffer from a lifetime bug as dynamically allocated URBs would complete and be deallocated while being unlinked as part of cancellation. The current locking is also insufficient to prevent the related race where the URB is deallocated before being unlinked. Fix this by pushing the cancellation implementation from greybus core down to the host-controller drivers, and replace the "cookie" pointer with a hcpriv field that those drivers can use to maintain their state with the required locking and reference counting in place. Specifically the drivers need to acquire a reference to the URB under a lock before calling usb_kill_urb as part of cancellation. Note that this also removes the insufficient gb_message_mutex, which also effectively prevented us from implementing support for submissions from atomic context. Instead the host-controller drivers must now explicitly make sure that the pre-allocated URBs are not reused while cancellation is in progress. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/greybus.h')
-rw-r--r--drivers/staging/greybus/greybus.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h
index c1157df9230b..e795016106c2 100644
--- a/drivers/staging/greybus/greybus.h
+++ b/drivers/staging/greybus/greybus.h
@@ -81,9 +81,9 @@ struct svc_msg;
struct greybus_host_driver {
size_t hd_priv_size;
- void *(*message_send)(struct greybus_host_device *hd, u16 dest_cport_id,
+ int (*message_send)(struct greybus_host_device *hd, u16 dest_cport_id,
struct gb_message *message, gfp_t gfp_mask);
- void (*message_cancel)(void *cookie);
+ void (*message_cancel)(struct gb_message *message);
int (*submit_svc)(struct svc_msg *svc_msg,
struct greybus_host_device *hd);
};