aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
AgeCommit message (Collapse)Author
2008-10-13tty: Make get_current_tty use a krefAlan Cox
We now return a kref covered tty reference. That ensures the tty structure doesn't go away when you have a return from get_current_tty. This is not enough to protect you from most of the resources being freed behind your back - yet. [Updated to include fixes for SELinux problems found by Andrew Morton and an s390 leak found while debugging the former] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: compare the tty winsizeAlan Cox
We always use the real tty one for stuff so the pty one should not be compared. As we propagate window changes to both it doesn't currently matter but will when we tidy up the pty termios logic a bit more Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: Termios locking - sort out real_tty confusions and lock readsAlan Cox
This moves us towards sanity and should mean our termios locking is now complete and comprehensive. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: Add termioxAlan Cox
We need a way to describe the various additional modes and flow control features that random weird hardware shows up and software such as wine wants to emulate as Windows supports them. TCGETX/TCSETX and the termiox ioctl are a SYS5 extension that we might as well adopt. This patches adds the structures and the basic ioctl interfaces when the TCGETX etc defines are added for an architecture. Drivers wishing to use this stuff need to add new methods. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: ipw need reworkingAlan Cox
This came in via another tree and unfortunately is rather broken on the tty side. Comment the apparent locking problems for someone who knows the driver to look at. Fix the termios and other ioctl handling. The driver was calling the wrong methods for what it wanted to do but the right ones existed so its a simple fix up. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: use krefs to protect driver module countsAlan Cox
The tty layer keeps driver module counts that are used so the driver knows when it can be unloaded. For obvious reasons we want to tie that to the refcounting properly. At this point the driver side itself isn't refcounted nicely but we can do that later and kref the drivers. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: Add a kref countAlan Cox
Introduce a kref to the tty structure and use it to protect the tty->signal tty references. For now we don't introduce it for anything else. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: Split tty_port into its own fileAlan Cox
Not much in it yet but this will grow a lot Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: split the buffering from tty_ioAlan Cox
The two are basically independent chunks of code so lets split them up for readability and sanity. It also makes the API boundaries much clearer. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13tty: move tioclinux from a special caseAlan Cox
Right now we have ifdefs and hooks in the core ioctl handler for TIOCLINUX and then test if its a console. This is brain dead. Instead call the tioclinux helper from the relevant driver ioctl methods. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13nozomi: Fix close on errorAlan Cox
Nozomi assumes the close method isn't called if open errors. The tty layer is different to other drives in this respect however. Pointed out by Denis J Barrow. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13audit: Handle embedded NUL in TTY input auditingMiloslav Trmac
Data read from a TTY can contain an embedded NUL byte (e.g. after pressing Ctrl-2, or sent to a PTY). After the previous patch, the data would be logged only up to the first NUL. This patch modifies the AUDIT_TTY record to always use the hexadecimal format, which does not terminate at the first NUL byte. The vast majority of recorded TTY input data will contain either ' ' or '\n', so the hexadecimal format would have been used anyway. Signed-off-by: Miloslav Trmac <mitr@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13ip2: avoid add_timer with pending timerAkinobu Mita
add_timer() is not supposed to be called when the timer is pending. ip2 driver attempts to avoid that condition by setting and resetting a flag (TimerOn) in timer function. But there is some gap between add_timer() and setting TimerOn. This patch fix this problem by using mod_timer() and remove TimerOn which has been unnecessary by this change. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13ip2: init/deinit cleanupJiri Slaby
Cleanup of module_init/exit: - mostly whitespace - remove empty functions - replace c++ comments - remove useless prints (module loaded, unloaded) - mark the calls as __exit and __init - use break; and return; to save some indent levels after it - note resource leakage It's still mess, but now it's readable. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13ip2: fix sparse warningsJiri Slaby
Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13ip2: cleanup globalsJiri Slaby
- do not init .bss zeroed data to zero again (by memset or explicit assignment) - use char [] instead of char * for string constants Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13Char: merge ip2main and ip2baseJiri Slaby
It's pretty useless to have one setup() function separated along with module_init() which only calls a function from ip2main anyway. Get rid of ip2base. Remove also checks of always-true now. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13Char: sx, fix io unmappingJiri Slaby
board->base is increased for CF cards after mapping. Use board->base2 for unmapping the region, since it holds the original/correct address. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13Char: cyclades. remove bogus iomapJiri Slaby
readl/writel are not expected to accept iomap return value. Replace bogus mapping by standard ioremap. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13epca: call tty_port_initAlan Cox
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13drivers/char/hvc_console.c: adjust call to put_tty_driverJulia Lawall
The call to put_tty_driver is out of place and is applied to the wrong argument. The function enclosing the patched code calls alloc_tty_driver and stores the result in drv. Subsequently, there are two occurrences of error handling code, one making a goto to put_tty and one making a goto to stop_thread. At the point of the first one the assignment hvc_driver = drv has not yet been executed, and from inspecting the rest of the file it seems that hvc_driver would be NULL. Thus the current call to put_tty_driver is useless, and one applied to drv is needed. The goto stop_thread is in the error handling code for a call to tty_register_driver, but the error cases in tty_register_driver do not free its argument, so it should be done here. Thus, I have moved the put_tty label after the stop_thread label, so that put_tty_driver is called in both cases. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; expression E,f; position p1,p2,p3; identifier l; statement S; @@ x = alloc_tty_driver@p1(...) ... if (x == NULL) S ... when != E = x when != put_tty_driver(x) goto@p2 l; ... when != E = x when != f(...,x,...) when any ( return \(0\|x\); | return@p3 ...; ) @script:python@ p1 << r.p1; p2 << r.p2; p3 << r.p3; @@ print "%s: call on line %s not freed or saved before return on line %s via line %s" % (p1[0].file,p1[0].line,p3[0].line,p2[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13Merge branches 'oprofile-v2' and 'timers/hpet' into x86/core-v4Ingo Molnar
2008-10-13Merge branch 'next' into for-linusJames Morris
2008-10-12Merge branch 'x86-core-v2-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip This merges in: x86/build, x86/microcode, x86/spinlocks, x86/memory-corruption-check, x86/early-printk, x86/xsave, x86/quirks, x86/setup, x86/signal, core/signal, x86/urgent, x86/xen * 'x86-core-v2-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (142 commits) x86: make processor type select depend on CONFIG_EMBEDDED x86: extend processor type select help text x86, amd-iommu: propagate PCI device enabling error warnings: fix arch/x86/kernel/io_apic_64.c warnings: fix arch/x86/kernel/early_printk.c x86, fpu: check __clear_user() return value x86: memory corruption check - cleanup x86: ioperm user_regset xen: do not reserve 2 pages of padding between hypervisor and fixmap. xen: use spin_lock_nest_lock when pinning a pagetable x86: xsave: set FP, SSE bits in the xsave header in the user sigcontext x86: xsave: fix error condition in save_i387_xstate() x86: SB450: deprioritize DMI quirks x86: SB450: skip IRQ0 override if it is not routed to INT2 of IOAPIC x86: replace a magic number with a named constant in the VESA boot code x86 setup: remove IMAGE_OFFSET x86 setup: remove DEF_INITSEG and DEF_SETUPSEG Revert "x86: fix ghost EDD devices in /sys again" x86 setup: fix ghost entries under /sys/firmware/edd take 3 x86: signal: remove indent in restore_sigcontext() ...
2008-10-12Merge branch 'linus' into x86/xenIngo Molnar
Conflicts: arch/x86/kernel/cpu/common.c arch/x86/kernel/process_64.c arch/x86/xen/enlighten.c
2008-10-11Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: sound/core/memalloc.c
2008-10-11Merge phase #2 (PAT updates) of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip * 'x86-v28-for-linus-phase2-B' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (27 commits) x86, cpa: make the kernel physical mapping initialization a two pass sequence, fix x86, pat: cleanups x86: fix pagetable init 64-bit breakage x86: track memtype for RAM in page struct x86, cpa: srlz cpa(), global flush tlb after splitting big page and before doing cpa x86, cpa: remove cpa pool code x86, cpa: no need to check alias for __set_pages_p/__set_pages_np x86, cpa: dont use large pages for kernel identity mapping with DEBUG_PAGEALLOC x86, cpa: make the kernel physical mapping initialization a two pass sequence x86, cpa: remove USER permission from the very early identity mapping attribute x86, cpa: rename PTE attribute macros for kernel direct mapping in early boot x86: make sure the CPA test code's use of _PAGE_UNUSED1 is obvious linux-next: fix x86 tree build failure x86: have set_memory_array_{uc,wb} coalesce memtypes, fix agp: enable optimized agp_alloc_pages methods x86: have set_memory_array_{uc,wb} coalesce memtypes. x86: {reverve,free}_memtype() take a physical address x86: fix pageattr-test agp: add agp_generic_destroy_pages() agp: generic_alloc_pages() ...
2008-10-11As pointed out by Jonathan Corbet, the timer must be deleted beforeRajiv Andrade
flushing the work queue in order to avoid a job being submitted after the chip had been released. Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: "Serge E. Hallyn" <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
2008-10-11The tpm_dev_release function is only called for platform devices, not pnpRajiv Andrade
devices, so we implemented the .remove function for pnp ones. Since it's code is very similar to the one inside tpm_dev_release, we've created a helper function tpm_dev_vendor_release, which is called by both. Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Cc: "Serge E. Hallyn" <serue@us.ibm.com> Cc: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
2008-10-11Protect tpm_chip_list when transversing it.Rajiv Andrade
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Acked-by: Serge E. Hallyn <serue@us.ibm.com> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
2008-10-11Renames num_open to is_open, as only one process can open the file at a time.Rajiv Andrade
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Cc: "Serge E. Hallyn" <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
2008-10-11Remove the BKL calls from the TPM driver, which were added in the overallRajiv Andrade
misc-char-dev-BKL-pushdown.patch, as they are not needed. Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Cc: "Serge E. Hallyn" <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Morris <jmorris@namei.org>
2008-10-10Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: selinux: Fix an uninitialized variable BUG/panic in selinux_secattr_to_sid() selinux: use default proc sid on symlinks file capabilities: uninline cap_safe_nice Update selinux info in MAINTAINERS and Kconfig help text SELinux: add gitignore file for mdp script SELinux: add boundary support and thread context assignment securityfs: do not depend on CONFIG_SECURITY selinux: add support for installing a dummy policy (v2) security: add/fix security kernel-doc selinux: Unify for- and while-loop style selinux: conditional expression type validation was off-by-one smack: limit privilege by label SELinux: Fix a potentially uninitialised variable in SELinux hooks SELinux: trivial, remove unneeded local variable SELinux: Trivial minor fixes that change C null character style make selinux_write_opts() static
2008-10-10Merge branch 'linus' into x86/pat2Ingo Molnar
Conflicts: arch/x86/mm/init_64.c
2008-10-10parisc: parisc-agp - fix <asm-parisc/*> -> <asm/*>Kyle McMartin
2008-10-10HPET: Remove spurious HPET busy warning message.David John
On x86 systems with CONFIG_HPET_TIMER enabled, when the HPET driver (drivers/char/hpet.c) is loaded, an incorrect busy message is printed when the driver initializes since the HPET has already been allocated by the core timer code. Remove the warning message. Signed-off-by: David John <davidjon@xenontk.org> Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-10-10Merge commit 'v2.6.27' into timers/hpetIngo Molnar
2008-10-10Merge branch 'next' into for-linusJames Morris
2008-10-09block: don't depend on consecutive minor spaceTejun Heo
* Implement disk_devt() and part_devt() and use them to directly access devt instead of computing it from ->major and ->first_minor. Note that all references to ->major and ->first_minor outside of block layer is used to determine devt of the disk (the part0) and as ->major and ->first_minor will continue to represent devt for the disk, converting these users aren't strictly necessary. However, convert them for consistency. * Implement disk_max_parts() to avoid directly deferencing genhd->minors. * Update bdget_disk() such that it doesn't assume consecutive minor space. * Move devt computation from register_disk() to add_disk() and make it the only one (all other usages use the initially determined value). These changes clean up the code and will help disk->part dereference fix and extended block device numbers. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-10-08Input: keyboard - fix potential out of bound access to key_mapDmitry Torokhov
Reported-by: Michal Roszkowski <michal@roszkowski.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-09-26kgdboc,tty: Fix tty polling search to use name correctlyJason Wessel
The tty_find_polling_driver() routine did not correctly check the base part of the tty name. This can lead to kgdboc selecting an incorrect driver, as well as accepting a completely invalid tty such as "echo ffff0 > /sys/module/kgdboc/parameters/kgdboc". Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2008-09-23powerpc: convert CONFIG_PPC_MERGE to CONFIG_PPC for legacy io checksKumar Gala
Now that arch/ppc is dead CONFIG_PPC_MERGE is always defined for all powerpc platforms and we want to get rid of CONFIG_PPC_MERGE use CONFIG_PPC instead. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-09-21Merge branch 'master' into nextJames Morris
Conflicts: MAINTAINERS Thanks for breaking my tree :-) Signed-off-by: James Morris <jmorris@namei.org>
2008-09-16Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 Conflicts: arch/sparc64/kernel/pci_psycho.c
2008-09-14Merge commit 'v2.6.27-rc6' into timers/hpetIngo Molnar
2008-09-14Merge commit 'v2.6.27-rc6' into x86/patIngo Molnar
2008-09-10Merge branch 'core/xen' into x86/xenIngo Molnar
2008-09-05[ARM] omap: convert OMAP drivers to use ioremap()Russell King
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-09-02drivers/char/random.c: fix a race which can lead to a bogus BUG()Andrew Morton
Fix a bug reported by and diagnosed by Aaron Straus. This is a regression intruduced into 2.6.26 by commit adc782dae6c4c0f6fb679a48a544cfbcd79ae3dc Author: Matt Mackall <mpm@selenic.com> Date: Tue Apr 29 01:03:07 2008 -0700 random: simplify and rename credit_entropy_store credit_entropy_bits() does: spin_lock_irqsave(&r->lock, flags); ... if (r->entropy_count > r->poolinfo->POOLBITS) r->entropy_count = r->poolinfo->POOLBITS; so there is a time window in which this BUG_ON(): static size_t account(struct entropy_store *r, size_t nbytes, int min, int reserved) { unsigned long flags; BUG_ON(r->entropy_count > r->poolinfo->POOLBITS); /* Hold lock while accounting */ spin_lock_irqsave(&r->lock, flags); can trigger. We could fix this by moving the assertion inside the lock, but it seems safer and saner to revert to the old behaviour wherein entropy_store.entropy_count at no time exceeds entropy_store.poolinfo->POOLBITS. Reported-by: Aaron Straus <aaron@merfinllc.com> Cc: Matt Mackall <mpm@selenic.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: <stable@kernel.org> [2.6.26.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-08-31pcmcia: remove unused argument to pcmcia_parse_tuple()Dominik Brodowski
Since we're just parsing the tuple being passed to this function, we don't need any device-specific information. Also, remove the call to pcmcia_validate_cis() from pcmciamtd.c, since it is already called by the PCMCIA core. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>