Commit dcd72f54 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pullstaging driver fixes from Greg KH:
 "Here are two staging driver fixes for 5.17-rc4.  These are:

   - fbtft error path fix

   - vc04_services rcu dereference fix

  Both of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: fbtft: Fix error path in fbtft_driver_module_init()
  staging: vc04_services: Fix RCU dereference check
parents 522e7d03 426aca16
...@@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) \ ...@@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) \
ret = spi_register_driver(&fbtft_driver_spi_driver); \ ret = spi_register_driver(&fbtft_driver_spi_driver); \
if (ret < 0) \ if (ret < 0) \
return ret; \ return ret; \
return platform_driver_register(&fbtft_driver_platform_driver); \ ret = platform_driver_register(&fbtft_driver_platform_driver); \
if (ret < 0) \
spi_unregister_driver(&fbtft_driver_spi_driver); \
return ret; \
} \ } \
\ \
static void __exit fbtft_driver_module_exit(void) \ static void __exit fbtft_driver_module_exit(void) \
......
...@@ -1058,15 +1058,27 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, ...@@ -1058,15 +1058,27 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
rcu_read_lock();
service = handle_to_service(handle); service = handle_to_service(handle);
if (WARN_ON(!service)) if (WARN_ON(!service)) {
rcu_read_unlock();
return VCHIQ_SUCCESS; return VCHIQ_SUCCESS;
}
user_service = (struct user_service *)service->base.userdata; user_service = (struct user_service *)service->base.userdata;
instance = user_service->instance; instance = user_service->instance;
if (!instance || instance->closing) if (!instance || instance->closing) {
rcu_read_unlock();
return VCHIQ_SUCCESS; return VCHIQ_SUCCESS;
}
/*
* As hopping around different synchronization mechanism,
* taking an extra reference results in simpler implementation.
*/
vchiq_service_get(service);
rcu_read_unlock();
vchiq_log_trace(vchiq_arm_log_level, vchiq_log_trace(vchiq_arm_log_level,
"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx", "%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
...@@ -1097,6 +1109,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, ...@@ -1097,6 +1109,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
bulk_userdata); bulk_userdata);
if (status != VCHIQ_SUCCESS) { if (status != VCHIQ_SUCCESS) {
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
return status; return status;
} }
} }
...@@ -1105,10 +1118,12 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, ...@@ -1105,10 +1118,12 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
if (wait_for_completion_interruptible(&user_service->remove_event)) { if (wait_for_completion_interruptible(&user_service->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__); vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
return VCHIQ_RETRY; return VCHIQ_RETRY;
} else if (instance->closing) { } else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__); vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
return VCHIQ_ERROR; return VCHIQ_ERROR;
} }
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
...@@ -1137,6 +1152,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, ...@@ -1137,6 +1152,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
header = NULL; header = NULL;
} }
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
if (skip_completion) if (skip_completion)
return VCHIQ_SUCCESS; return VCHIQ_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment