提交 d7c4660c 编写于 作者: B Bill Pemberton 提交者: Greg Kroah-Hartman

staging: dgrp: check for NULL pointer in (un)register_proc_table

register_proc_table and unregister_proc_table didn't deal with the
possibility that the *table pointer could be NULL.  Check for this and
return if table is NULL.
Reported-by: NFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: NBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 367ff459
...@@ -229,6 +229,9 @@ static void register_proc_table(struct dgrp_proc_entry *table, ...@@ -229,6 +229,9 @@ static void register_proc_table(struct dgrp_proc_entry *table,
int len; int len;
mode_t mode; mode_t mode;
if (table == NULL)
return;
for (; table->id; table++) { for (; table->id; table++) {
/* Can't do anything without a proc name. */ /* Can't do anything without a proc name. */
if (!table->name) if (!table->name)
...@@ -297,6 +300,9 @@ static void unregister_proc_table(struct dgrp_proc_entry *table, ...@@ -297,6 +300,9 @@ static void unregister_proc_table(struct dgrp_proc_entry *table,
struct proc_dir_entry *de; struct proc_dir_entry *de;
struct nd_struct *tmp; struct nd_struct *tmp;
if (table == NULL)
return;
list_for_each_entry(tmp, &nd_struct_list, list) { list_for_each_entry(tmp, &nd_struct_list, list) {
if ((table == dgrp_net_table) && (tmp->nd_net_de)) { if ((table == dgrp_net_table) && (tmp->nd_net_de)) {
unregister_dgrp_device(tmp->nd_net_de); unregister_dgrp_device(tmp->nd_net_de);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册