hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/eventfd.c
....@@ -187,11 +187,14 @@
187187 return events;
188188 }
189189
190
-static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt)
190
+void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt)
191191 {
192
- *cnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count;
192
+ lockdep_assert_held(&ctx->wqh.lock);
193
+
194
+ *cnt = ((ctx->flags & EFD_SEMAPHORE) && ctx->count) ? 1 : ctx->count;
193195 ctx->count -= *cnt;
194196 }
197
+EXPORT_SYMBOL_GPL(eventfd_ctx_do_read);
195198
196199 /**
197200 * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue.