Skip to content

Commit

Permalink
staging: dgrp: check for NULL pointer in (un)register_proc_table
Browse files Browse the repository at this point in the history
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: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bill Pemberton authored and Greg Kroah-Hartman committed Oct 17, 2012
1 parent 367ff45 commit d7c4660
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/staging/dgrp/dgrp_specproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ static void register_proc_table(struct dgrp_proc_entry *table,
int len;
mode_t mode;

if (table == NULL)
return;

for (; table->id; table++) {
/* Can't do anything without a proc name. */
if (!table->name)
Expand Down Expand Up @@ -297,6 +300,9 @@ static void unregister_proc_table(struct dgrp_proc_entry *table,
struct proc_dir_entry *de;
struct nd_struct *tmp;

if (table == NULL)
return;

list_for_each_entry(tmp, &nd_struct_list, list) {
if ((table == dgrp_net_table) && (tmp->nd_net_de)) {
unregister_dgrp_device(tmp->nd_net_de);
Expand Down

0 comments on commit d7c4660

Please sign in to comment.