summaryrefslogtreecommitdiff
path: root/drivers/tty/vt/consolemap.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-08tty: add SPDX identifiers to all remaining files in drivers/tty/Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/tty files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Jiri Slaby <jslaby@suse.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: David Sterba <dsterba@suse.com> Cc: James Hogan <jhogan@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Joachim Eastwood <manabian@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Russell King <linux@armlinux.org.uk> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Baruch Siach <baruch@tkos.co.il> Cc: "Maciej W. Rozycki" <macro@linux-mips.org> Cc: "Uwe Kleine-König" <kernel@pengutronix.de> Cc: Pat Gefre <pfg@sgi.com> Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: David Brown <david.brown@linaro.org> Cc: "Andreas Färber" <afaerber@suse.de> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Barry Song <baohua@kernel.org> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Peter Korsgaard <jacmet@sunsite.dk> Cc: Timur Tabi <timur@tabi.org> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Jiri Slaby <jslaby@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09vt: use memdup_user in PIO_UNIMAP ioctlAdam Borowski1-8/+3
Again, a nice linear transfer that simplifies the code. Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09vt: use copy_to_user instead of __put_user in GIO_UNIMAP ioctlAdam Borowski1-8/+6
A nice big linear transfer, no need to flip stac/PAN/etc every half-entry. Also, yay __put_user() after checking only read. Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09vt: use copy_from/to_user instead of __get/put_user for scrnmap ioctlsAdam Borowski1-24/+7
Linus wants to get rid of these functions, and these uses are especially egregious: they copy a big linear array element by element. Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-24Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds1-1/+1
This was entirely automated, using the script by Al: PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>' sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \ $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h) to do the replacement at the end of the merge window. Requested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-29console: Move userspace I/O out of console_lock to fix lockdep warningWaiman Long1-41/+74
When running certain workload on a debug kernel with lockdep turned on, a ppc64 kvm guest could sometimes hit the following lockdep warning: [ INFO: possible circular locking dependency detected ] Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem); lock(console_lock); lock(&mm->mmap_sem); lock(cpu_hotplug.lock); *** DEADLOCK *** Looking at the console code, the console_lock-->mmap_sem scenario will only happen when reading or writing the console unicode map leading to a page fault. To break this circular locking dependency, all the userspace I/O operations in consolemap.c are now moved outside of the console_lock critical sections so that the mmap_sem won't be acquired when holding the console_lock. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: vt, ignore PIO_UNIMAPCLR paramJiri Slaby1-7/+6
We do not do hashtables for unicode fonts since 1995 (1.3.28). So it is time to remove the second parameter of con_clear_unimap and ignore the advice from userspace completely. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10tty: consolemap.c: move assignment out of if () blockGreg Kroah-Hartman1-23/+37
We should not be doing assignments within an if () block so fix up the code to not do this. change was created using Coccinelle. CC: Jiri Slaby <jslaby@suse.cz> CC: Takashi Iwai <tiwai@suse.de> CC: Imre Deak <imre.deak@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06tty/vt: don't set font mappings on vc not supporting thisImre Deak1-0/+7
We can call this function for a dummy console that doesn't support setting the font mapping, which will result in a null ptr BUG. So check for this case and return error for consoles w/o font mapping support. Reference: https://bugzilla.kernel.org/show_bug.cgi?id=59321 Signed-off-by: Imre Deak <imre.deak@intel.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29console: Remove superfluous readonly checkTakashi Iwai1-13/+3
uni_pagedir.readonly is never set. Let's get rid of superfluous check codes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29console: Use explicit pointer type for vc_uni_pagedir* fieldsTakashi Iwai1-19/+19
The vc_data.vc_uni_pagedir filed is currently long int, supposedly to be served generically. This, however, leads to lots of cast to pointer, and rather it worsens the readability significantly. Actually, we have now only a single uni_pagedir map implementation, and this won't change likely. So, it'd be much more simple and error-prone to just use the exact pointer for struct uni_pagedir instead of long. Ditto for vc_uni_pagedir_loc. It's a pointer to the uni_pagedir, thus it can be changed similarly to the exact type. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-19driver: tty: vt: remove cast for kmalloc return valueZhang Yanfei1-2/+1
remove cast for kmalloc return value. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-27tty: vt: Remove redundant null check before kfree.Sachin Kamat1-4/+2
kfree on a NULL pointer is a no-op. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-25vt: push the tty_lock down into the map handlingAlan Cox1-32/+91
When we do this it becomes clear the lock we should be holding is the vc lock, and in fact many of our other helpers are properly invoked this way. We don't at this point guarantee not to race the keyboard code but the results of that appear harmless and that was true before we started as well. We now have no users of tty_lock in the console driver... Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-16TTY: Wrong unicode value copied in con_set_unimap()Liz Clark1-8/+43
Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map https://bugzilla.kernel.org/show_bug.cgi?id=40012 The unicode font map for the virtual console is a 32x32x64 table which allocates rows dynamically as entries are added. The unicode value increases sequentially and should count all entries even in empty rows. The defect is when copying the unicode font map in con_set_unimap(), the unicode value is not incremented properly. The wrong unicode value is entered in the new font map. Signed-off-by: Liz Clark <liz.clark@hp.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-01-05tty: Fix memory leak in virtual console when enable unicode translationZeng Zhaoming1-1/+1
Virtual console unicode translation map leaks with following message when enable kmemleak: unreferenced object 0xeb5ec450 (size 192): comm "setfont", pid 665, jiffies 4294899028 (age 3696.220s) hex dump (first 32 bytes): e0 5b 9d eb 00 00 00 00 00 00 00 00 80 b9 ea eb .[.............. b0 5a 9d eb 00 00 00 00 00 00 00 00 00 00 00 00 .Z.............. backtrace: [<c1533f8c>] kmemleak_alloc+0x3c/0xa0 [<c114acc2>] kmem_cache_alloc_trace+0xe2/0x250 [<c13498e8>] con_clear_unimap+0x78/0xd0 [<c1345552>] vt_ioctl+0x1562/0x1d00 [<c133aa00>] tty_ioctl+0x230/0x7c0 [<c1171519>] do_vfs_ioctl+0x79/0x2d0 [<c11717df>] sys_ioctl+0x6f/0x80 [<c156601f>] sysenter_do_call+0x12/0x38 [<ffffffff>] 0xffffffff unreferenced object 0xeb9d5be0 (size 128): comm "setfont", pid 660, jiffies 4294899030 (age 3696.212s) hex dump (first 32 bytes): 60 c2 a6 eb 50 c8 a6 eb c0 54 9d eb 80 59 9d eb `...P....T...Y.. 90 53 9d eb 60 52 9d eb 60 92 9b eb 00 00 00 00 .S..`R..`....... backtrace: [<c1533f8c>] kmemleak_alloc+0x3c/0xa0 [<c114acc2>] kmem_cache_alloc_trace+0xe2/0x250 [<c134938c>] con_insert_unipair+0x7c/0x150 [<c1349f8c>] con_set_unimap+0x15c/0x1f0 [<c13456fb>] vt_ioctl+0x170b/0x1d00 [<c133aa00>] tty_ioctl+0x230/0x7c0 [<c1171519>] do_vfs_ioctl+0x79/0x2d0 [<c11717df>] sys_ioctl+0x6f/0x80 [<c156601f>] sysenter_do_call+0x12/0x38 [<ffffffff>] 0xffffffff The leak caused by con_set_default_unimap() not correct free the old map. Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-05TTY: create drivers/tty/vt and move the vt code thereGreg Kroah-Hartman1-0/+745
The vt and other related code is moved into the drivers/tty/vt directory. Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>