Re: [PATCH] cyber2000fb: New framebuffer_alloc API and class_dev changes
From: Russell King <hidden>
Date: 2003-09-15 21:40:48
On Mon, Sep 15, 2003 at 09:43:29PM +0200, Kronos wrote:
quoted hunk
@@ -1635,6 +1638,16 @@ return err; } +static void release_cfb_info(struct fb_info *info) { + struct cfb_info *cfb = info->par; + + iounmap(cfb->region); + fb_alloc_cmap(&info->cmap, 0, 0); + + if (cfb->dev) + pci_release_regions(cfb->dev); +} + static void __devexit cyberpro_pci_remove(struct pci_dev *dev) { struct cfb_info *cfb = pci_get_drvdata(dev);@@ -1645,12 +1658,10 @@ * we will be leaving hooks that could cause * oopsen laying around. */ - if (unregister_framebuffer(&cfb->fb)) + if (unregister_framebuffer(cfb->fb)) printk(KERN_WARNING "%s: danger Will Robinson, " "danger danger! Oopsen imminent!\n", - cfb->fb.fix.id); - iounmap(cfb->region); - cyberpro_free_fb_info(cfb); + cfb->fb->fix.id); /* * Ensure that the driver data is no longer@@ -1659,8 +1670,6 @@ pci_set_drvdata(dev, NULL); if (cfb == int_cfb_info) int_cfb_info = NULL; - - pci_release_regions(dev); } }
There is another reason why the above is fundamentally flawed - who says that "release_cfb_info" will still be in module space by the time you need to call it? Eg, you unload your framebuffer driver module immediately after the device has gone away, but someone is keeping the sysfs files associated with the fb_info open. They close them, you call the release function - oops. -- Russell King (rmk@arm.linux.org.uk) http://www.arm.linux.org.uk/personal/ Linux kernel maintainer of: 2.6 ARM Linux - http://www.arm.linux.org.uk/ 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/ 2.6 Serial core ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf