mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
relay: check return of create_buf_file() properly
If create_buf_file() returns an error, don't try to reference it later
as a valid dentry pointer.
This problem was exposed when debugfs started to return errors instead
of just NULL for some calls when they do not succeed properly.
Also, the check for WARN_ON(dentry) was just wrong :)
Reported-by: Kees Cook <[email protected]>
Reported-and-tested-by: [email protected]
Reported-by: Tetsuo Handa <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: David Rientjes <[email protected]>
Fixes: ff9fb72bc0 ("debugfs: return error values, not NULL")
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
37ea7b630a
commit
2c1cf00eea
1 changed files with 3 additions and 1 deletions
|
|
@ -428,6 +428,8 @@ static struct dentry *relay_create_buf_file(struct rchan *chan,
|
|||
dentry = chan->cb->create_buf_file(tmpname, chan->parent,
|
||||
S_IRUSR, buf,
|
||||
&chan->is_global);
|
||||
if (IS_ERR(dentry))
|
||||
dentry = NULL;
|
||||
|
||||
kfree(tmpname);
|
||||
|
||||
|
|
@ -461,7 +463,7 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
|
|||
dentry = chan->cb->create_buf_file(NULL, NULL,
|
||||
S_IRUSR, buf,
|
||||
&chan->is_global);
|
||||
if (WARN_ON(dentry))
|
||||
if (IS_ERR_OR_NULL(dentry))
|
||||
goto free_buf;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue