diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2012-10-09 14:18:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-17 17:10:10 -0400 |
commit | d7c4660c12adc5c66351253af381259686fa08a4 (patch) | |
tree | 62743423b33605d87076851693cf1143c89a3ba6 | |
parent | 367ff459e54d1bc471880aef21239d2a0a03b12e (diff) |
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: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/dgrp/dgrp_specproc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c index a5840e7d6665..24327c3bad83 100644 --- a/drivers/staging/dgrp/dgrp_specproc.c +++ b/drivers/staging/dgrp/dgrp_specproc.c | |||
@@ -229,6 +229,9 @@ static void register_proc_table(struct dgrp_proc_entry *table, | |||
229 | int len; | 229 | int len; |
230 | mode_t mode; | 230 | mode_t mode; |
231 | 231 | ||
232 | if (table == NULL) | ||
233 | return; | ||
234 | |||
232 | for (; table->id; table++) { | 235 | for (; table->id; table++) { |
233 | /* Can't do anything without a proc name. */ | 236 | /* Can't do anything without a proc name. */ |
234 | if (!table->name) | 237 | if (!table->name) |
@@ -297,6 +300,9 @@ static void unregister_proc_table(struct dgrp_proc_entry *table, | |||
297 | struct proc_dir_entry *de; | 300 | struct proc_dir_entry *de; |
298 | struct nd_struct *tmp; | 301 | struct nd_struct *tmp; |
299 | 302 | ||
303 | if (table == NULL) | ||
304 | return; | ||
305 | |||
300 | list_for_each_entry(tmp, &nd_struct_list, list) { | 306 | list_for_each_entry(tmp, &nd_struct_list, list) { |
301 | if ((table == dgrp_net_table) && (tmp->nd_net_de)) { | 307 | if ((table == dgrp_net_table) && (tmp->nd_net_de)) { |
302 | unregister_dgrp_device(tmp->nd_net_de); | 308 | unregister_dgrp_device(tmp->nd_net_de); |