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

Unified · Split

kernel/trace/trace.c+4−2
@@ -1256,8 +1256,10 @@ int __init register_tracer(struct tracer *type) · 1255 unmodified lines
12561256 if (!type->flags) {
12571257 /*allocate a dummy tracer_flags*/
12581258 type->flags = kmalloc(sizeof(*type->flags), GFP_KERNEL);
1259− if (!type->flags)
1260− return -ENOMEM;
1259+ if (!type->flags) {
1260+ ret = -ENOMEM;
1261+ goto out;
1262+ }
12611263 type->flags->val = 0;
12621264 type->flags->opts = dummy_tracer_opt;
12631265 } 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