Skip to content

Commit

Permalink
viafb: fix proc entry removal
Browse files Browse the repository at this point in the history
viafb: fix proc entry removal

Trying to remove unregistered proc entries became painful and is
useless anyway. So remove the removal of an entry that was never
registered and duplicate the logic for one which is added
conditionally. Additionally move the removal above releasing fb_info
as we still need the information.
This prevents tainting the kernel by the procfs warn on and
avoiding access to already freed memory is probably also a good idea.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
  • Loading branch information
Florian Tobias Schandinat authored and Jonathan Corbet committed May 7, 2010
1 parent 162fc8c commit 2fed547
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/video/via/viafbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,13 +1702,16 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
}
static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
{
/* no problem if it was not registered */
struct chip_information *chip_info = &viaparinfo->shared->chip_info;

remove_proc_entry("dvp0", viafb_entry);/* parent dir */
remove_proc_entry("dvp1", viafb_entry);
remove_proc_entry("dfph", viafb_entry);
remove_proc_entry("dfpl", viafb_entry);
remove_proc_entry("vt1636", viafb_entry);
remove_proc_entry("vt1625", viafb_entry);
if (chip_info->lvds_chip_info.lvds_chip_name == VT1636_LVDS
|| chip_info->lvds_chip_info2.lvds_chip_name == VT1636_LVDS)
remove_proc_entry("vt1636", viafb_entry);

remove_proc_entry("viafb", NULL);
}

Expand Down Expand Up @@ -1967,12 +1970,10 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
unregister_framebuffer(viafbinfo);
if (viafb_dual_fb)
unregister_framebuffer(viafbinfo1);

viafb_remove_proc(viaparinfo->shared->proc_entry);
framebuffer_release(viafbinfo);
if (viafb_dual_fb)
framebuffer_release(viafbinfo1);

viafb_remove_proc(viaparinfo->shared->proc_entry);
}

#ifndef MODULE
Expand Down

0 comments on commit 2fed547

Please sign in to comment.