X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-events.c;h=d0ebb2987518fd61b68cd6455602c3a39c8135c6;hb=4ce9f32b8ec6ff1de14d734607a5f4a20fb743e5;hp=4b76ea03d72c5f7d31aadf975b2667072a07e857;hpb=9c666164702ea3b2c2b2299b7aaab97203efc0af;p=lttng-modules.git diff --git a/lttng-events.c b/lttng-events.c index 4b76ea03..d0ebb298 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -1043,17 +1043,22 @@ int lttng_session_list_tracker_pids(struct lttng_session *session) ret = PTR_ERR(tracker_pids_list_file); goto file_error; } + if (atomic_long_add_unless(&session->file->f_count, + 1, INT_MAX) == INT_MAX) { + goto refcount_error; + } ret = lttng_tracker_pids_list_fops.open(NULL, tracker_pids_list_file); if (ret < 0) goto open_error; m = tracker_pids_list_file->private_data; m->private = session; fd_install(file_fd, tracker_pids_list_file); - atomic_long_inc(&session->file->f_count); return file_fd; open_error: + atomic_long_dec(&session->file->f_count); +refcount_error: fput(tracker_pids_list_file); file_error: put_unused_fd(file_fd);