diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-03-25 15:48:06 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2009-03-30 17:14:44 -0400 |
commit | 99b76233803beab302123d243eea9e41149804f3 (patch) | |
tree | 398178210fe66845ccd6fa4258ba762a87e023ad /drivers/video/via | |
parent | 3dec7f59c370c7b58184d63293c3dc984d475840 (diff) |
proc 2/2: remove struct proc_dir_entry::owner
Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
as correctly noted at bug #12454. Someone can lookup entry with NULL
->owner, thus not pinning enything, and release it later resulting
in module refcount underflow.
We can keep ->owner and supply it at registration time like ->proc_fops
and ->data.
But this leaves ->owner as easy-manipulative field (just one C assignment)
and somebody will forget to unpin previous/pin current module when
switching ->owner. ->proc_fops is declared as "const" which should give
some thoughts.
->read_proc/->write_proc were just fixed to not require ->owner for
protection.
rmmod'ed directories will be empty and return "." and ".." -- no harm.
And directories with tricky enough readdir and lookup shouldn't be modular.
We definitely don't want such modular code.
Removing ->owner will also make PDE smaller.
So, let's nuke it.
Kudos to Jeff Layton for reminding about this, let's say, oversight.
http://bugzilla.kernel.org/show_bug.cgi?id=12454
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'drivers/video/via')
-rw-r--r-- | drivers/video/via/viafbdev.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 37b433a08ce8..e327b84820d2 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -2059,25 +2059,21 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry) | |||
2059 | if (viafb_entry) { | 2059 | if (viafb_entry) { |
2060 | entry = create_proc_entry("dvp0", 0, *viafb_entry); | 2060 | entry = create_proc_entry("dvp0", 0, *viafb_entry); |
2061 | if (entry) { | 2061 | if (entry) { |
2062 | entry->owner = THIS_MODULE; | ||
2063 | entry->read_proc = viafb_dvp0_proc_read; | 2062 | entry->read_proc = viafb_dvp0_proc_read; |
2064 | entry->write_proc = viafb_dvp0_proc_write; | 2063 | entry->write_proc = viafb_dvp0_proc_write; |
2065 | } | 2064 | } |
2066 | entry = create_proc_entry("dvp1", 0, *viafb_entry); | 2065 | entry = create_proc_entry("dvp1", 0, *viafb_entry); |
2067 | if (entry) { | 2066 | if (entry) { |
2068 | entry->owner = THIS_MODULE; | ||
2069 | entry->read_proc = viafb_dvp1_proc_read; | 2067 | entry->read_proc = viafb_dvp1_proc_read; |
2070 | entry->write_proc = viafb_dvp1_proc_write; | 2068 | entry->write_proc = viafb_dvp1_proc_write; |
2071 | } | 2069 | } |
2072 | entry = create_proc_entry("dfph", 0, *viafb_entry); | 2070 | entry = create_proc_entry("dfph", 0, *viafb_entry); |
2073 | if (entry) { | 2071 | if (entry) { |
2074 | entry->owner = THIS_MODULE; | ||
2075 | entry->read_proc = viafb_dfph_proc_read; | 2072 | entry->read_proc = viafb_dfph_proc_read; |
2076 | entry->write_proc = viafb_dfph_proc_write; | 2073 | entry->write_proc = viafb_dfph_proc_write; |
2077 | } | 2074 | } |
2078 | entry = create_proc_entry("dfpl", 0, *viafb_entry); | 2075 | entry = create_proc_entry("dfpl", 0, *viafb_entry); |
2079 | if (entry) { | 2076 | if (entry) { |
2080 | entry->owner = THIS_MODULE; | ||
2081 | entry->read_proc = viafb_dfpl_proc_read; | 2077 | entry->read_proc = viafb_dfpl_proc_read; |
2082 | entry->write_proc = viafb_dfpl_proc_write; | 2078 | entry->write_proc = viafb_dfpl_proc_write; |
2083 | } | 2079 | } |
@@ -2086,7 +2082,6 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry) | |||
2086 | viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { | 2082 | viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { |
2087 | entry = create_proc_entry("vt1636", 0, *viafb_entry); | 2083 | entry = create_proc_entry("vt1636", 0, *viafb_entry); |
2088 | if (entry) { | 2084 | if (entry) { |
2089 | entry->owner = THIS_MODULE; | ||
2090 | entry->read_proc = viafb_vt1636_proc_read; | 2085 | entry->read_proc = viafb_vt1636_proc_read; |
2091 | entry->write_proc = viafb_vt1636_proc_write; | 2086 | entry->write_proc = viafb_vt1636_proc_write; |
2092 | } | 2087 | } |