History

tracing: Fix return while holding a lock in register_tracer()

commit d39cdd2036a6 ("tracing: Make tracer_flags use the right set_flag callback") introduces a potential mutex deadlock issue, as it forgets to free the mutex when allocaing the tracer_flags gets fail. The issue was found by Dan Carpenter through Smatch static code check tool. Link: http://lkml.kernel.org/r/1457958941-30265-1-git-send-email-chuhu@redhat.com

Chunyu Hu committed 10 years ago

Commit c8ca0031 parent 6363c6b1 file · +4 −2Browse files

Showing the changes to kernel/trace (1 of 1 file). Show all

Unified · Split

kernel/trace/trace.c+4−2
@@ -1256,8 +1256,10 @@ int __init register_tracer(struct tracer *type) · 1255 unmodified lines
1256 if (!type->flags) {1256 if (!type->flags) {
1257 /*allocate a dummy tracer_flags*/1257 /*allocate a dummy tracer_flags*/
1258 type->flags = kmalloc(sizeof(*type->flags), GFP_KERNEL);1258 type->flags = kmalloc(sizeof(*type->flags), GFP_KERNEL);
1259 if (!type->flags)1259 if (!type->flags) {
1260 return -ENOMEM;1260 ret = -ENOMEM;
1261 goto out;
1262 }
1261 type->flags->val = 0;1263 type->flags->val = 0;
1262 type->flags->opts = dummy_tracer_opt;1264 type->flags->opts = dummy_tracer_opt;
1263 } else1265 } else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t