Re: [PATCH] perf: fix event leak when perf_event_open() failed to create event_file

2016-03-21 Thread Leon Yu
On Mon, Mar 21, 2016 at 4:02 PM, Alexander Shishkin wrote: > Leon Yu writes: > >> If something went wrong in anon_inode_getfile, event_file will be set to >> non-zero error number and able to bypass the NULL test afterward. >> >> Consolidate the error path by testing event_file with handly >> IS_

Re: [PATCH] perf: fix event leak when perf_event_open() failed to create event_file

2016-03-21 Thread Alexander Shishkin
Leon Yu writes: > If something went wrong in anon_inode_getfile, event_file will be set to > non-zero error number and able to bypass the NULL test afterward. > > Consolidate the error path by testing event_file with handly > IS_ERR_OR_NULL() helper since we do want to free event in both cases. >

[PATCH] perf: fix event leak when perf_event_open() failed to create event_file

2016-03-20 Thread Leon Yu
If something went wrong in anon_inode_getfile, event_file will be set to non-zero error number and able to bypass the NULL test afterward. Consolidate the error path by testing event_file with handly IS_ERR_OR_NULL() helper since we do want to free event in both cases. Signed-off-by: Leon Yu Fix