aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2016-06-01Input: raydium_i2c_ts - do not ignore EPROBE_DEFER from gpiod_get_optionalDmitry Torokhov1-6/+5
We should not be ignoring -EPROBE_DEFER reported by devm_gpiod_get_optional(), but report it as any other error to the upper layers. While we are at it simplify check for the presence of reset GPIO and instead of using IS_ERR_OR_NULL just use boolean. Also do not return -ENOMEM from suspend handler when the device in bootloader mode as that does not make sense and switch to -EBUSY instead. Reported-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-27Input: add Raydium I2C touchscreen driverJeffrey Lin5-0/+1250
This adds support for Raydium I2C touch controllers compatible with RM32380. Signed-off-by: Jeffrey Lin <jeffrey.lin@rad-ic.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-27Input: surface3_spi - add surface pen support for Surface 3Stephen Just1-2/+112
This change creates a second input device which will handle input from a Surface Pen. The Surface Pen supplies a different packet header than touch events, so it is simple to handle one or the other. This patch handles both the newer Surface Pen with one button, and the older variant with a second button to switch to Eraser mode. Signed-off-by: Stephen Just <stephenjust@gmail.com> Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-27Input: surface3_spi - Prepare to add support for Surface PenStephen Just1-13/+26
Surface Pens can be supported by handling a second report type. Prepare for this change. Signed-off-by: Stephen Just <stephenjust@gmail.com> Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-25Input: tc3589x-keypad - remove stray ')'Clifton Barnes1-1/+1
The end ')' needs to be removed if the macro is ever used or there would be a compiler error as it does not have a matching '('. Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-19Input: add new driver for the Surface 3Benjamin Tissoires3-0/+318
This is a basic driver for the Surface 3. I am not so sure it will work with any firmwares as most values are encoded, but given that I only have access to my current device with its firmware and I don't have the datasheet, it should be OK for now. The Surface Pen is not supported (if it is supposed to be). I'll work on this when I get one. Tested-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-19Input: feed more data into entropy poolDmitry Torokhov1-4/+3
Commit 4369c64c79a22 ("Input: Send events one packet at a time") significantly reduced amount of entropy input core was feeding to the rest of the system, because only the very first event in the event block would be used as source of entropy. With this change we will be calling add_input_randomness() for every event that is not filtered by the input core as a duplicate. In addition, all EV_SYN events are ignored. Acked-by: Henrik Rydberg <rydberg@bitmath.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-19Input: synaptics-rmi4 - fix spelling in definesNick Dyer1-11/+11
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Reviewed-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-19Input: migor-ts - mark PM functions as __maybe_unusedArnd Bergmann1-2/+2
The migor touchscreen driver is now available for COMPILE_TEST, so we run into a harmless randconfig warning on ARM when CONFIG_PM is disabled: drivers/input/touchscreen/migor_ts.c:216:12: error: 'migor_ts_resume' defined but not used [-Werror=unused-function] drivers/input/touchscreen/migor_ts.c:205:12: error: 'migor_ts_suspend' defined but not used [-Werror=unused-function] This shuts up the warning by marking the two functions as __maybe_unused. We could do the same thing by adding an #ifdef, but this version is more reliable. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-19Input: atmel_captouch - add dependence on i2cArnd Bergmann1-0/+1
The newly added Atmal captouch driver fails to build when CONFIG_I2C is disabled: drivers/input/misc/atmel_captouch.c: In function 'atmel_read': drivers/input/misc/atmel_captouch.c:115:8: error: implicit declaration of function 'i2c_transfer' [-Werror=implicit-function-declaration] This adds an explicit Kconfig dependency to prevent the broken configuration. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: b06d43f7a3db ("Input: add Atmel Captouch Button driver") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-18Input: add Atmel Captouch Button driverDaniel Hung-yu Wu4-0/+340
Add I2C driver for Atmel Capacitive Touch Button device. Signed-off-by: Hung-yu Wu <hywu@google.com> Signed-off-by: Grant Grundler <grundler@chromium.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-18Input: migor-ts - allow driver to build if COMPILE_TEST is enabledJavier Martinez Canillas1-1/+1
The driver only has runtime but no build time dependency with SH_MIGOR, so it can be built for testing purposes if the COMPILE_TEST option is enabled. This is useful to have more build coverage and make sure that drivers are not affected by changes that could cause build regressions. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-18Input: migor-ts - fix error for modular buildJavier Martinez Canillas1-1/+1
There is a typo in the driver for the I2C device table that is passed to the MODULE_DEVICE_TABLE() macro, this leads to the following build error: CC [M] drivers/input/touchscreen//migor_ts.o drivers/input/touchscreen//migor_ts.c:233:21: error: 'migor_ts' undeclared here (not in a function) MODULE_DEVICE_TABLE(i2c, migor_ts); ^ drivers/input/touchscreen//migor_ts.c:233:31: error: '__mod_i2c__migor_ts_device_table' aliased to undefined symbol 'migor_ts' MODULE_DEVICE_TABLE(i2c, migor_ts); ^ scripts/Makefile.build:295: recipe for target 'drivers/input/touchscreen//migor_ts.o' failed make[1]: *** [drivers/input/touchscreen//migor_ts.o] Error 1 Makefile:1446: recipe for target '_module_drivers/input/touchscreen/' failed make: *** [_module_drivers/input/touchscreen/] Error 2 Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-09Input: rotary-encoder - fix bare use of 'unsigned'Clifton Barnes1-4/+4
fix checkpatch.pl warning about 'Prefer 'unsigned int' to bare use of 'unsigned'' Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-04Input: cm109 - spin_lock in complete() cleanupMing Lei1-4/+6
Complete() will be run with interrupt enabled, so change to spin_lock_irqsave(). Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-05-04Input: cm109 - fix handling of volume and mute buttonsFlorian Euchner1-7/+30
The CM109 driver reported key press events of volume up / down and record / playback mute buttons, but no release events. Report those events properly by handling volume and mute keys seperately. For the record and playback mute buttons, only presses are registered by the CM109, therefore simulate press-n-release. This fixes the volume control buttons of various USB headsets. Signed-off-by: Florian Euchner <florian.euchner@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-29Input: byd - don't wipe dynamically allocated memory twiceVladimir Zapolskiy1-1/+0
Since memory for a private data is allocated by kzalloc() there is no need to fill it with zeroes immediately after the allocation. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-29Input: twl4030 - fix unsafe macro definitionRui Teng1-12/+16
The bitwise shift operator has lower priority than plus operator. So the values on macros should be enclosed in parentheses. For example, "(1 << 4 + 1)" means "(1 << (4 + 1))", but it is not expected by the macros. And also fix other two coding style problems reported by scripts/checkpatch.pl. Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-25Input: twl6040-vibra - remove mutexH. Nikolaus Schaller1-13/+2
The mutex does not seem to be needed. twl4030-vibra doesn't use one either. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-20Input: bcm_iproc_tsc - DT spelling s/clock-name/clock-names/Geert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-06Input: bcm_iproc_tsc - use syscon to access shared registersRaveendra Padasalagi3-41/+68
In Cygnus SOC touch screen controller registers are shared with ADC and flex timer. Using readl/writel could lead to race condition. So touch screen driver is enhanced to support register access using syscon framework API's to take care of mutually exclusive access. Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-05Input: ti_am335x_tsc - use SIMPLE_DEV_PM_OPSDmitry Torokhov1-12/+4
Instead of doing the dance with macro that either resolves to a pointer or NULL, let's switch to using SIMPLE_DEV_PM_OPS(). Also let's mark suspend and resume methods as __maybe_unused instead of guarding them with an #ifdef and rely on linker to drop unused code. Doing so should allow better compile coverage. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-05Input: omap-keypad - remove set_col_gpio_val() and get_row_gpio_val()Dmitry Torokhov1-25/+0
Commit f799a3d8fe170159257b75c1baf48a7c1f625d1d ("Input: omap-keypad: Remove dependencies to mach includes") removed users of the above functions, but left them in the code. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-05Input: omap-keypad - drop empty PM stubsDmitry Torokhov1-21/+0
There is no reason to have empty suspend and resume stubs. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-04-05Input: omap-keypad - remove adjusting of scan delayDmitry Torokhov1-5/+1
As of 35f8679f577ae5673a778598bcbe7b45cbec8923 ("Input: omap-keypad - remove dead check") we no longer declare keypresses as spurious, therefore we can use constant delay between scans. Suggested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-31Input: gpio-keys - clean up device tree binding exampleAndreas Färber1-5/+5
Drop #address-cells and #size-cells, which are not required by the gpio-keys binding documentation, as button sub-nodes are not devices. Rename sub-nodes to avoid new dtc unit address warnings when copied. While at it, adopt the dashes convention for the node name. Reported-by: Julien Chauveau <chauveau.julien@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Reviewed-by: Julien Chauveau <chauveau.julien@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-31Input: kbtab - stop saving struct usb_deviceOliver Neukum1-4/+4
The device can now easily be derived from the interface. Stop leaving a private copy. Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-31Input: gtco - stop saving struct usb_deviceOliver Neukum1-12/+12
The device can now easily be derived from the interface. Stop leaving a private copy. Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-31Input: aiptek - stop saving struct usb_deviceOliver Neukum1-9/+11
The device can now easily be derived from the interface. Stop leaving a private copy. Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-31Input: acecad - stop saving struct usb_deviceOliver Neukum1-6/+6
The device can now easily be derived from the interface. Stop leaving a private copy. Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-23Input: sur40 - fix DMA on stackOliver Neukum1-7/+14
During the initialisation the driver uses a buffer on the stack for DMA. That violates the cache coherency rules. The fix is to allocate the buffer with kmalloc(). Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-23Input: ati_remote2 - fix crashes on detecting device with invalid descriptorVladis Dronov1-6/+30
The ati_remote2 driver expects at least two interfaces with one endpoint each. If given malicious descriptor that specify one interface or no endpoints, it will crash in the probe function. Ensure there is at least two interfaces and one endpoint for each interface before using it. The full disclosure: http://seclists.org/bugtraq/2016/Mar/90 Reported-by: Ralf Spenneberg <ralf@spenneberg.net> Signed-off-by: Vladis Dronov <vdronov@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-17Input: synaptics - handle spurious release of trackstick buttons, againBenjamin Tissoires1-2/+3
Looks like the fimware 8.2 still has the extra buttons spurious release bug. Link: https://bugzilla.kernel.org/show_bug.cgi?id=114321 Cc: stable@vger.kernel.org Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-17Input: synaptics-rmi4 - remove check of Non-NULL arrayAndrew Duggan1-3/+2
Originally the irq_mask member of rmi_function was a pointer. Then it was switched to being a zero length array. However, the checks for a NULL pointer where not removed. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-17Input: byd - enable absolute modeRichard Pospesel2-198/+369
The Windows driver's settings dialog contains a visualization of the regions for the hardware edge scrolling capability, which uses a temporarily-enabled limited-resolution absolute mode. This patch enables this during normal operation, and combines the absolute packets with the existing relative packets to provide accurate absolute position and touch reporting. It also adds documentation for all known gesture packets and initialization commands. Reviewed-by: Chris Diamand <chris@diamand.org> Signed-off-by: Richard Pospesel <pospeselr@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-17Input: ims-pcu - sanity check against missing interfacesOliver Neukum1-0/+4
A malicious device missing interface can make the driver oops. Add sanity checking. Signed-off-by: Oliver Neukum <ONeukum@suse.com> CC: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-16Input: melfas_mip4 - add hw_version sysfs attributeSangwon Jee1-1/+27
Add hw_version sysfs attribute for retrieving hardware information from firmware. Signed-off-by: Sangwon Jee <jeesw@melfas.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-15ARM: pxa/raumfeld: use PROPERTY_ENTRY_INTEGER to define propsArnd Bergmann1-11/+4
gcc-6.0 notices that the use of the property_entry in this file that was recently introduced cannot work right, as we initialize the wrong field: raumfeld.c:387:3: error: the address of 'raumfeld_rotary_encoder_steps' will always evaluate as 'true' [-Werror=address] DEV_PROP_U32, 1, &raumfeld_rotary_encoder_steps, }, ^~~~~~~~~~~~ raumfeld.c:389:3: error: the address of 'raumfeld_rotary_encoder_axis' will always evaluate as 'true' [-Werror=address] DEV_PROP_U32, 1, &raumfeld_rotary_encoder_axis, }, ^~~~~~~~~~~~ raumfeld.c:391:3: error: the address of 'raumfeld_rotary_encoder_relative_axis' will always evaluate as 'true' [-Werror=address] DEV_PROP_U32, 1, &raumfeld_rotary_encoder_relative_axis, }, ^~~~~~~~~~~~ The problem appears to stem from relying on an old definition of 'struct property', but it has changed several times since the code could have last been correct. This changes the code to use the PROPERTY_ENTRY_INTEGER() macro instead, which works fine for the current definition and is a safer way of doing the initialization. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: a9e340dce3c3 ("Input: rotary_encoder - move away from platform data structure") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-15Input: synaptics-rmi4 - using logical instead of bitwise ANDDan Carpenter1-2/+2
There is a typo so we have && instead of &. Fixes: ff8f83708b3e ('Input: synaptics-rmi4 - add support for 2D sensors and F11') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-14Input: powermate - fix oops with malicious USB descriptorsJosh Boyer1-0/+3
The powermate driver expects at least one valid USB endpoint in its probe function. If given malicious descriptors that specify 0 for the number of endpoints, it will crash. Validate the number of endpoints on the interface before using them. The full report for this issue can be found here: http://seclists.org/bugtraq/2016/Mar/85 Reported-by: Ralf Spenneberg <ralf@spenneberg.net> Cc: stable <stable@vger.kernel.org> Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-13Linux 4.5Linus Torvalds1-1/+1
2016-03-13MIPS: smp.c: Fix uninitialised temp_foreign_mapJames Hogan1-0/+1
When calculate_cpu_foreign_map() recalculates the cpu_foreign_map cpumask it uses the local variable temp_foreign_map without initialising it to zero. Since the calculation only ever sets bits in this cpumask any existing bits at that memory location will remain set and find their way into cpu_foreign_map too. This could potentially lead to cache operations suboptimally doing smp calls to multiple VPEs in the same core, even though the VPEs share primary caches. Therefore initialise temp_foreign_map using cpumask_clear() before use. Fixes: cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT cores") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12759/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-13MIPS: Fix build error when SMP is used without GICHauke Mehrtens1-3/+4
The MIPS_GIC_IPI should only be selected when MIPS_GIC is also selected, otherwise it results in a compile error. smp-gic.c uses some functions from include/linux/irqchip/mips-gic.h like plat_ipi_call_int_xlate() which are only added to the header file when MIPS_GIC is set. The Lantiq SoC does not use the GIC, but supports SMP. The calls top the functions from smp-gic.c are already protected by some #ifdefs The first part of this was introduced in commit 72e20142b2bf ("MIPS: Move GIC IPI functions out of smp-cmp.c") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: Paul Burton <paul.burton@imgtec.com> Cc: stable@vger.kernel.org # v3.15+ Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12774/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-13ld-version: Fix awk regex compile failureJames Hogan1-1/+1
The ld-version.sh script fails on some versions of awk with the following error, resulting in build failures for MIPS: awk: scripts/ld-version.sh: line 4: regular expression compile failed (missing '(') This is due to the regular expression ".*)", meant to strip off the beginning of the ld version string up to the close bracket, however brackets have a meaning in regular expressions, so lets escape it so that awk doesn't expect a corresponding open bracket. Fixes: ccbef1674a15 ("Kbuild, lto: add ld-version and ld-ifversion ...") Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: James Hogan <james.hogan@imgtec.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Cc: Michal Marek <mmarek@suse.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: linux-mips@linux-mips.org Cc: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org # 4.4.x- Patchwork: https://patchwork.linux-mips.org/patch/12838/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-13MIPS: Fix build with DEBUG_ZBOOT and MACH_JZ4780Aaro Koskinen1-1/+1
Ingenic SoC declares ZBOOT support, but debug definitions are missing for MACH_JZ4780 resulting in a build failure when DEBUG_ZBOOT is set. The UART addresses are same as with JZ4740, so fix by covering JZ4780 with those as well. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12830/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-12block: don't optimize for non-cloned bio in bio_get_last_bvec()Ming Lei1-5/+0
For !BIO_CLONED bio, we can use .bi_vcnt safely, but it doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1] because the start postion may have been moved in the middle of the bvec, such as splitting in the middle of bvec. Fixes: 7bcd79ac50d9(block: bio: introduce helpers to get the 1st and last bvec) Cc: stable@vger.kernel.org Reported-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
2016-03-12x86/efi: Fix boot crash by always mapping boot service regions into new EFI page tablesMatt Fleming1-17/+62
Some machines have EFI regions in page zero (physical address 0x00000000) and historically that region has been added to the e820 map via trim_bios_range(), and ultimately mapped into the kernel page tables. It was not mapped via efi_map_regions() as one would expect. Alexis reports that with the new separate EFI page tables some boot services regions, such as page zero, are not mapped. This triggers an oops during the SetVirtualAddressMap() runtime call. For the EFI boot services quirk on x86 we need to memblock_reserve() boot services regions until after SetVirtualAddressMap(). Doing that while respecting the ownership of regions that may have already been reserved by the kernel was the motivation behind this commit: 7d68dc3f1003 ("x86, efi: Do not reserve boot services regions within reserved areas") That patch was merged at a time when the EFI runtime virtual mappings were inserted into the kernel page tables as described above, and the trick of setting ->numpages (and hence the region size) to zero to track regions that should not be freed in efi_free_boot_services() meant that we never mapped those regions in efi_map_regions(). Instead we were relying solely on the existing kernel mappings. Now that we have separate page tables we need to make sure the EFI boot services regions are mapped correctly, even if someone else has already called memblock_reserve(). Instead of stashing a tag in ->numpages, set the EFI_MEMORY_RUNTIME bit of ->attribute. Since it generally makes no sense to mark a boot services region as required at runtime, it's pretty much guaranteed the firmware will not have already set this bit. For the record, the specific circumstances under which Alexis triggered this bug was that an EFI runtime driver on his machine was responding to the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event during SetVirtualAddressMap(). The event handler for this driver looks like this, sub rsp,0x28 lea rdx,[rip+0x2445] # 0xaa948720 mov ecx,0x4 call func_aa9447c0 ; call to ConvertPointer(4, & 0xaa948720) mov r11,QWORD PTR [rip+0x2434] # 0xaa948720 xor eax,eax mov BYTE PTR [r11+0x1],0x1 add rsp,0x28 ret Which is pretty typical code for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE handler. The "mov r11, QWORD PTR [rip+0x2424]" was the faulting instruction because ConvertPointer() was being called to convert the address 0x0000000000000000, which when converted is left unchanged and remains 0x0000000000000000. The output of the oops trace gave the impression of a standard NULL pointer dereference bug, but because we're accessing physical addresses during ConvertPointer(), it wasn't. EFI boot services code is stored at that address on Alexis' machine. Reported-by: Alexis Murzeau <amurzeau@gmail.com> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Ben Hutchings <ben@decadent.org.uk> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Raphael Hertzog <hertzog@debian.org> Cc: Roger Shimizu <rogershimizu@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1457695163-29632-2-git-send-email-matt@codeblueprint.co.uk Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815125 Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-03-12x86/fpu: Fix eager-FPU handling on legacy FPU machinesBorislav Petkov2-2/+4
i486 derived cores like Intel Quark support only the very old, legacy x87 FPU (FSAVE/FRSTOR, CPUID bit FXSR is not set), and our FPU code wasn't handling the saving and restoring there properly in the 'eagerfpu' case. So after we made eagerfpu the default for all CPU types: 58122bf1d856 x86/fpu: Default eagerfpu=on on all CPUs these old FPU designs broke. First, Andy Shevchenko reported a splat: WARNING: CPU: 0 PID: 823 at arch/x86/include/asm/fpu/internal.h:163 fpu__clear+0x8c/0x160 which was us trying to execute FXRSTOR on those machines even though they don't support it. After taking care of that, Bryan O'Donoghue reported that a simple FPU test still failed because we weren't initializing the FPU state properly on those machines. Take care of all that. Reported-and-tested-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Yu-cheng <yu-cheng.yu@intel.com> Link: http://lkml.kernel.org/r/20160311113206.GD4312@pd.tnic Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-03-11Input: snvs_pwrkey - fix returned value check of syscon_regmap_lookup_by_phandle()Vladimir Zapolskiy1-2/+2
On error syscon_regmap_lookup_by_phandle() returns ERR_PTR() value, which makes a check for NULL invalid and may lead to oops on error path. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-11mm/mempool: avoid KASAN marking mempool poison checks as use-after-freeMatthew Dawson1-1/+1
When removing an element from the mempool, mark it as unpoisoned in KASAN before verifying its contents for SLUB/SLAB debugging. Otherwise KASAN will flag the reads checking the element use-after-free writes as use-after-free reads. Signed-off-by: Matthew Dawson <matthew@mjdsystems.ca> Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>