提交 3af8e31c 编写于 作者: J Jesper Juhl 提交者: David S. Miller

[NETFILTER]: ipt_recent: avoid a possible NULL pointer deref in recent_seq_open()

If the call to seq_open() returns != 0 then the code calls 
kfree(st) but then on the very next line proceeds to 
dereference the pointer - not good.

Problem spotted by the Coverity checker.
Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 864c5a4d
...@@ -387,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct file *file) ...@@ -387,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct file *file)
st = kzalloc(sizeof(*st), GFP_KERNEL); st = kzalloc(sizeof(*st), GFP_KERNEL);
if (st == NULL) if (st == NULL)
return -ENOMEM; return -ENOMEM;
ret = seq_open(file, &recent_seq_ops); ret = seq_open(file, &recent_seq_ops);
if (ret) if (ret) {
kfree(st); kfree(st);
goto out;
}
st->table = pde->data; st->table = pde->data;
seq = file->private_data; seq = file->private_data;
seq->private = st; seq->private = st;
out:
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册