mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 00:52:01 +00:00
staging: dgrp: check for a valid proc dir entry pointer
while proc_create fails, the register_proc_table can do a derefernce of the null pointer causing to oops the system, instead check for a valid pointer at register and unregister Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b194218dba
commit
7b63c5772f
@ -181,13 +181,13 @@ static struct dgrp_proc_entry dgrp_dpa_table[] = {
|
|||||||
|
|
||||||
void dgrp_unregister_proc(void)
|
void dgrp_unregister_proc(void)
|
||||||
{
|
{
|
||||||
unregister_proc_table(dgrp_table, dgrp_proc_dir_entry);
|
|
||||||
net_entry_pointer = NULL;
|
net_entry_pointer = NULL;
|
||||||
mon_entry_pointer = NULL;
|
mon_entry_pointer = NULL;
|
||||||
dpa_entry_pointer = NULL;
|
dpa_entry_pointer = NULL;
|
||||||
ports_entry_pointer = NULL;
|
ports_entry_pointer = NULL;
|
||||||
|
|
||||||
if (dgrp_proc_dir_entry) {
|
if (dgrp_proc_dir_entry) {
|
||||||
|
unregister_proc_table(dgrp_table, dgrp_proc_dir_entry);
|
||||||
remove_proc_entry(dgrp_proc_dir_entry->name,
|
remove_proc_entry(dgrp_proc_dir_entry->name,
|
||||||
dgrp_proc_dir_entry->parent);
|
dgrp_proc_dir_entry->parent);
|
||||||
dgrp_proc_dir_entry = NULL;
|
dgrp_proc_dir_entry = NULL;
|
||||||
@ -231,6 +231,8 @@ static void register_proc_table(struct dgrp_proc_entry *table,
|
|||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
return;
|
return;
|
||||||
|
if (root == 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. */
|
||||||
|
Loading…
Reference in New Issue
Block a user