Skip to content

Commit dcd72f5

Browse files
committed
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
2 parents 522e7d0 + 426aca1 commit dcd72f5

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

drivers/staging/fbtft/fbtft.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) \
334334
ret = spi_register_driver(&fbtft_driver_spi_driver); \
335335
if (ret < 0) \
336336
return ret; \
337-
return platform_driver_register(&fbtft_driver_platform_driver); \
337+
ret = platform_driver_register(&fbtft_driver_platform_driver); \
338+
if (ret < 0) \
339+
spi_unregister_driver(&fbtft_driver_spi_driver); \
340+
return ret; \
338341
} \
339342
\
340343
static void __exit fbtft_driver_module_exit(void) \

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,15 +1058,27 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
10581058

10591059
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
10601060

1061+
rcu_read_lock();
10611062
service = handle_to_service(handle);
1062-
if (WARN_ON(!service))
1063+
if (WARN_ON(!service)) {
1064+
rcu_read_unlock();
10631065
return VCHIQ_SUCCESS;
1066+
}
10641067

10651068
user_service = (struct user_service *)service->base.userdata;
10661069
instance = user_service->instance;
10671070

1068-
if (!instance || instance->closing)
1071+
if (!instance || instance->closing) {
1072+
rcu_read_unlock();
10691073
return VCHIQ_SUCCESS;
1074+
}
1075+
1076+
/*
1077+
* As hopping around different synchronization mechanism,
1078+
* taking an extra reference results in simpler implementation.
1079+
*/
1080+
vchiq_service_get(service);
1081+
rcu_read_unlock();
10701082

10711083
vchiq_log_trace(vchiq_arm_log_level,
10721084
"%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,
10971109
bulk_userdata);
10981110
if (status != VCHIQ_SUCCESS) {
10991111
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
1112+
vchiq_service_put(service);
11001113
return status;
11011114
}
11021115
}
@@ -1105,10 +1118,12 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
11051118
if (wait_for_completion_interruptible(&user_service->remove_event)) {
11061119
vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
11071120
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
1121+
vchiq_service_put(service);
11081122
return VCHIQ_RETRY;
11091123
} else if (instance->closing) {
11101124
vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
11111125
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
1126+
vchiq_service_put(service);
11121127
return VCHIQ_ERROR;
11131128
}
11141129
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
@@ -1137,6 +1152,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
11371152
header = NULL;
11381153
}
11391154
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
1155+
vchiq_service_put(service);
11401156

11411157
if (skip_completion)
11421158
return VCHIQ_SUCCESS;

0 commit comments

Comments
 (0)