]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
proc 2/2: remove struct proc_dir_entry::owner
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 25 Mar 2009 19:48:06 +0000 (22:48 +0300)
committerAlexey Dobriyan <adobriyan@gmail.com>
Mon, 30 Mar 2009 21:14:44 +0000 (01:14 +0400)
commit99b76233803beab302123d243eea9e41149804f3
tree398178210fe66845ccd6fa4258ba762a87e023ad
parent3dec7f59c370c7b58184d63293c3dc984d475840
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>
55 files changed:
Documentation/DocBook/procfs_example.c
arch/alpha/kernel/srm_env.c
arch/blackfin/mm/sram-alloc.c
arch/ia64/kernel/palinfo.c
arch/ia64/sn/kernel/sn2/prominfo_proc.c
arch/powerpc/kernel/rtas_flash.c
arch/sparc/kernel/led.c
arch/x86/kernel/cpu/mtrr/if.c
drivers/acpi/ac.c
drivers/acpi/battery.c
drivers/acpi/button.c
drivers/acpi/fan.c
drivers/acpi/processor_core.c
drivers/acpi/sbs.c
drivers/acpi/thermal.c
drivers/acpi/video.c
drivers/block/ps3vram.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/input/input.c
drivers/isdn/hardware/eicon/divasi.c
drivers/media/video/cpia.c
drivers/message/i2o/i2o_proc.c
drivers/net/bonding/bond_main.c
drivers/net/irda/vlsi_ir.c
drivers/net/wireless/airo.c
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/rtc/rtc-proc.c
drivers/s390/block/dasd_proc.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_proc.c
drivers/video/via/viafbdev.c
fs/afs/proc.c
fs/cifs/cifs_debug.c
fs/jfs/jfs_debug.c
fs/nfs/client.c
fs/proc/inode.c
fs/proc/proc_tty.c
fs/reiserfs/procfs.c
include/linux/ipmi_smi.h
include/linux/proc_fs.h
net/appletalk/atalk_proc.c
net/atm/mpoa_proc.c
net/atm/proc.c
net/can/bcm.c
net/can/proc.c
net/core/pktgen.c
net/irda/irproc.c
net/llc/llc_proc.c
net/sctp/protocol.c
net/sunrpc/cache.c
net/sunrpc/stats.c
sound/core/info.c