Commit b003f4e171304234eae9cc11c9fd7f1cbaaf0d6b
Committed by
David S. Miller
1 parent
1e253c3b8a
CAPI: Silence lockdep warning on get_capi_appl_by_nr usage
As long as we hold capi_controller_lock, we can safely access capi_applications without RCU protection as no one can modify the application list underneath us. Introduce an RCU-free __get_capi_appl_by_nr for this purpose. This silences lockdep warnings on suspicious rcu_dereference usage. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 14 additions and 5 deletions Side-by-side Diff
drivers/isdn/capi/kcapi.c
... | ... | @@ -98,6 +98,16 @@ |
98 | 98 | return capi_controller[contr - 1]; |
99 | 99 | } |
100 | 100 | |
101 | +static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid) | |
102 | +{ | |
103 | + lockdep_assert_held(&capi_controller_lock); | |
104 | + | |
105 | + if (applid - 1 >= CAPI_MAXAPPL) | |
106 | + return NULL; | |
107 | + | |
108 | + return capi_applications[applid - 1]; | |
109 | +} | |
110 | + | |
101 | 111 | static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) |
102 | 112 | { |
103 | 113 | if (applid - 1 >= CAPI_MAXAPPL) |
... | ... | @@ -185,10 +195,9 @@ |
185 | 195 | ctr->state = CAPI_CTR_RUNNING; |
186 | 196 | |
187 | 197 | for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { |
188 | - ap = get_capi_appl_by_nr(applid); | |
189 | - if (!ap) | |
190 | - continue; | |
191 | - register_appl(ctr, applid, &ap->rparam); | |
198 | + ap = __get_capi_appl_by_nr(applid); | |
199 | + if (ap) | |
200 | + register_appl(ctr, applid, &ap->rparam); | |
192 | 201 | } |
193 | 202 | |
194 | 203 | wake_up_interruptible_all(&ctr->state_wait_queue); |
... | ... | @@ -215,7 +224,7 @@ |
215 | 224 | memset(ctr->serial, 0, sizeof(ctr->serial)); |
216 | 225 | |
217 | 226 | for (applid = 1; applid <= CAPI_MAXAPPL; applid++) { |
218 | - ap = get_capi_appl_by_nr(applid); | |
227 | + ap = __get_capi_appl_by_nr(applid); | |
219 | 228 | if (ap) |
220 | 229 | capi_ctr_put(ctr); |
221 | 230 | } |