projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: check reference counts for overflow
[lttng-modules.git]
/
lib
/
ringbuffer
/
ring_buffer_frontend.c
diff --git
a/lib/ringbuffer/ring_buffer_frontend.c
b/lib/ringbuffer/ring_buffer_frontend.c
index c4b797ce8af76faf9ba5209d054b89fb42326656..dbe52c157c71be0ec560bbc6b97dc77d1b1e27ea 100644
(file)
--- a/
lib/ringbuffer/ring_buffer_frontend.c
+++ b/
lib/ringbuffer/ring_buffer_frontend.c
@@
-61,6
+61,7
@@
#include "../../wrapper/ringbuffer/iterator.h"
#include "../../wrapper/ringbuffer/nohz.h"
#include "../../wrapper/atomic.h"
#include "../../wrapper/ringbuffer/iterator.h"
#include "../../wrapper/ringbuffer/nohz.h"
#include "../../wrapper/atomic.h"
+#include "../../wrapper/kref.h"
#include "../../wrapper/percpu-defs.h"
/*
#include "../../wrapper/percpu-defs.h"
/*
@@
-793,7
+794,10
@@
int lib_ring_buffer_open_read(struct lib_ring_buffer *buf)
if (!atomic_long_add_unless(&buf->active_readers, 1, 1))
return -EBUSY;
if (!atomic_long_add_unless(&buf->active_readers, 1, 1))
return -EBUSY;
- kref_get(&chan->ref);
+ if (!lttng_kref_get(&chan->ref)) {
+ atomic_long_dec(&buf->active_readers);
+ return -EOVERFLOW;
+ }
lttng_smp_mb__after_atomic();
return 0;
}
lttng_smp_mb__after_atomic();
return 0;
}
This page took
0.025388 seconds
and
4
git commands to generate.