aboutsummaryrefslogtreecommitdiffstats
path: root/drivers (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-04-25staging: most: core: replace strcpy() by strscpy()Gustavo A. R. Silva1-1/+1
The strcpy() function is being deprecated. Replace it by the safer strscpy() and fix the following Coverity warning: "You might overrun the 80-character fixed-size string iface->p->name by copying iface->description without checking the length." Addresses-Coverity-ID: 1444760 ("Copy into fixed size buffer") Fixes: 131ac62253db ("staging: most: core: use device description as name") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25staging: kpc2000: fix platform_no_drv_owner.cocci warningsYueHaibing1-1/+0
Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25staging: kpc2000: remove duplicated include from kp2000_module.cYueHaibing1-1/+0
Remove duplicated include. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25staging: kpc2000: Use memset to initialize resourcesNathan Chancellor1-4/+8
Clang warns: drivers/staging/kpc2000/kpc2000/cell_probe.c:96:38: warning: suggest braces around initialization of subobject [-Wmissing-braces] struct resource resources[2] = {0}; ^ {} drivers/staging/kpc2000/kpc2000/cell_probe.c:314:38: warning: suggest braces around initialization of subobject [-Wmissing-braces] struct resource resources[2] = {0}; ^ {} 2 warnings generated. One way to fix these warnings is to add additional braces like Clang suggests; however, there has been a bit of push back from some maintainers, who just prefer memset as it is unambiguous, doesn't depend on a particular compiler version, and properly initializes all subobjects [1][2]. Do that here so there are no more warnings. [1]: https://lore.kernel.org/lkml/022e41c0-8465-dc7a-a45c-64187ecd9684@amd.com/ [2]: https://lore.kernel.org/lkml/20181128.215241.702406654469517539.davem@davemloft.net/ Link: https://github.com/ClangBuiltLinux/linux/issues/455 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25Merge tag 'iio-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman35-246/+2017
Jonathan writes: Second set of IIO new device support, features and cleanup for the 5.2 cycle. New device suport * ad7606 - Support the AD7616 16 channel, 12bit ADC. * fxas21002c - New driver for this gyroscope with I2C and SPI support. * lsm6dsx - Support the lsm6dsr, new device information structure and dt bindings. * srf04 - Addition device IDs for mb1000, mb1010, mb1020, mb1030 and mb1040 + support of different required trigger pulse lengths. * st-accel - Support the ls2de12, new device info and dt bindings. * ti-ads8344 - New driver for this 8 channel, 16 bit SPI ADC. Binding conversions to yaml - we have started doing these in general for IIO. * avia-hx711 * bmp085 Cleanups and minor fixes / additions * ad5758 - Fixup for some changes between preproduction parts and final part. * ad7606 - Refactor handling of oversampling to make it easy to vary between supported devices. * ad9832 - Organise includes. - Clock framework to handle clocks. * ad9834 - Drop unnecessary parenthesis. * bmc150 - Use __func__ rather than hardcoding. * dummy_evgen. - Fix a memleak on error in probe. * kxcjk1013 - Add KXCJ91008 ACPI ID as seen in the wild. - Use __func__ rather than hardcoding. * imx7d - Local dev variable to simplify code a bit. - dev_err replaces pr_err to give more info. - devm_platform_ioremap_resource for small reduction in boilerplate. - Simplify probe and remove by sharing suspend / resume logic. - Devm for iio_device_register as remove only contains the unregister. * lsm6dsx - Remove a variable that was never read. - Open code values where they are effectively described by what is assigned to them rather than using uninformative defines. * max31856 - Avoid an unintialized ret variable in a path that can't actually occur but is hard for a static checker to know. * max9611 - White space * mpu3050 - Reduce a sleep worst case by switching from msleep to usleep_range. * qcom-spmi-adc5 - Add MODULE_DEVICE_TABLE to assist autoloading of this as a module. * stm32-dfsdm - Fix missing dependencies. * stm32-timer trigger - Fix a build issue when disabled. * ti-ads7950 - Fix mising dependency on CONFIG_GPIOLIB. * tag 'iio-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (42 commits) iio: adc: qcom-spmi-adc5: Fix of-based module autoloading iio: dummy_evgen: fix possible memleak in evgen init iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainable iio: adc: stm32-dfsdm: fix triggered buffer build dependency iio: adc: stm32-dfsdm: fix unmet direct dependencies detected iio: trigger: stm32-timer: fix build issue when disabled iio: imx7d_adc: Use devm_iio_device_register() iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend() iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume() drivers/iio/gyro/mpu3050-core.c: This patch fix the following checkpatch warning. iio: dac: ad5758: Modifications for new revision iio: imu: st_lsm6dsx: inline per-sensor data iio: adc: Add driver for the TI ADS8344 A/DC chips dt-bindings: iio: adc: Add bindings for TI ADS8344 A/DC chips MAINTAINERS: add entry for fxas21002c gyro driver iio: gyro: fxas21002c: add spi driver iio: gyro: fxas21002c: add i2c driver iio: gyro: add core driver for fxas21002c iio: gyro: add DT bindings to fxas21002c Kconfig: change configuration of srf04 ultrasonic iio sensor ...
2019-04-22iio: adc: qcom-spmi-adc5: Fix of-based module autoloadingBjorn Andersson1-0/+1
The of_device_id table needs to be registered as module alias in order for automatic module loading to pick the kernel module based on the DeviceTree compatible. So add MODULE_DEVICE_TABLE() to make this happen. Fixes: e13d757279bb ("iio: adc: Add QCOM SPMI PMIC5 ADC driver") Cc: stable@vger.kernel.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: dummy_evgen: fix possible memleak in evgen initPan Bian1-1/+4
The memory allocated in the function iio_dummy_evgen_create is not released if it fails to add the evgen device to device hierarchy. This may result in a memory leak bug. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainableMohan Kumar2-2/+2
It fixes the following checkpatch.pl warning: WARNING: Prefer using '"%s...", __func__' to using function's name, in a string Signed-off-by: Mohan Kumar <mohankumar718@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: adc: stm32-dfsdm: fix triggered buffer build dependencyFabrice Gasnier1-0/+1
This fixes build errors seen when CONFIG_STM32_DFSDM_ADC is set, as stm32-dfsdm-adc driver now also relies on triggered buffer API: Fixes: 11646e81d775 ("iio: adc: stm32-dfsdm: add support for buffer modes") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: adc: stm32-dfsdm: fix unmet direct dependencies detectedFabrice Gasnier1-0/+1
This fixes unmet direct dependencies seen when CONFIG_STM32_DFSDM_ADC is selected: WARNING: unmet direct dependencies detected for IIO_BUFFER_HW_CONSUMER Depends on [n]: IIO [=y] && IIO_BUFFER [=n] Selected by [y]: - STM32_DFSDM_ADC [=y] && IIO [=y] && (ARCH_STM32 [=y] && OF [=y] || COMPILE_TEST [=n]) Fixes: e2e6771c6462 ("IIO: ADC: add STM32 DFSDM sigma delta ADC support") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: imx7d_adc: Use devm_iio_device_register()Andrey Smirnov1-12/+1
Use devm_iio_device_register() and drop imx7d_adc_remove(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend()Andrey Smirnov1-22/+24
Since imx7d_adc_remove() does exactly the same thing as imx7d_adc_suspend() we can use the latter together with devm_add_action_or_reset() to simplify the former. Rename imx7d_adc_suspend() to imx7d_adc_disable() for clarity while at it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume()Andrey Smirnov1-52/+36
Initialization sequence performed in imx7d_adc_resume() is exactly the same as the one being done in imx7d_adc_probe(). Make use of the former in the latter to avoid code duplication. Rename imx7d_adc_resume() to imx7d_adc_enable() for clarity while at it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22drivers/iio/gyro/mpu3050-core.c: This patch fix the following checkpatch warning.Mohan Kumar1-1/+1
As per Documentation/timers/timers-howto.txt Msleep < 20ms can sleep for up to 20ms. so use usleep_range. Signed-off-by: Mohan Kumar <mohankumar718@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: dac: ad5758: Modifications for new revisionMircea Caprioru1-37/+18
This patch will ensure compatibility with the new revision of the AD5758 dac converter. The modifications consist of removing the fault_prot_switch function since this option is no longer available, and enabling the ENABLE_PPC_BUFFERS bit in ADC_CONFIG register before setting the PPC current mode. The previous version of the chip was never released to customers so there is no need to support it going forwards. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: imu: st_lsm6dsx: inline per-sensor dataLorenzo Bianconi1-34/+16
As it has been already done for other st sensors in 'commit 9049531c91b4 ("iio: accel: st_accel: inline per-sensor data")', get rid of some defines and just open code the values into the appropriate struct elements since the semantic meaning is inherent in the name of the C99-addressable fields and there is no reason to duplicate the code Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: adc: Add driver for the TI ADS8344 A/DC chipsGregory CLEMENT3-0/+215
This adds support for the Texas Instruments ADS8344 ADC chip. This chip has a 16-bit 8-Channel ADC and is access directly through SPI. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: fxas21002c: add spi driverRui Miguel Silva3-1/+77
Add driver to talk over spi to a fxas21002c gyroscope device and use the core as main controller. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: fxas21002c: add i2c driverRui Miguel Silva3-0/+76
Add the real driver to talk over i2c and use the fxas21002c core for the main tasks. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: add core driver for fxas21002cRui Miguel Silva4-0/+1166
Add core support for the NXP fxas21002c Tri-axis gyroscope, using the iio subsystem. It supports PM operations, axis reading, temperature, scale factor of the axis, high pass and low pass filtering, and sampling frequency selection. It will have extras modules to support the communication over i2c and spi. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-21Merge 5.1-rc6 into staging-nextGreg Kroah-Hartman315-1491/+2445
We want the fixes in here as well as this resolves an iio driver merge issue. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-20staging: kpc2000: add initial set of Daktronics driversGreg Kroah-Hartman20-0/+2793
These drivers have been outside of the kernel tree since the 2.x days, and it's time to bring them into the tree so they can get properly cleaned up. This first dump of drivers is based on a tarball Matt gave to me, minus an odd "dma" driver that I could not get to build at all. I renamed a few files, added the proper SPDX lines to it, added Kconfig entries and tied it into the kernel build. I also fixed up a number of initial obvious kernel build warnings, but left the odd bitfield warning that gcc is spitting out, as I'm not quite sure what to do about that. There's loads of low-hanging coding style cleanups in here for people to start attacking, as well as the more obvious logic and api cleanups as well. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-20Staging: rtlwifi: Replace return typeMadhumitha Prabakaran1-3/+1
Replace return type and remove the respective assignment. Issue found by Coccinelle. Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-20Staging: rtl8723bs: core: Replace return typesMadhumitha Prabakaran1-5/+2
Remove unwanted assignments and replace return types. Issue suggested by Coccinelle. Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-20Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds6-8/+12
Pull SCSI fixes from James Bottomley: "Three minor fixes: two obvious ones in drivers and a fix to the SG_IO path to correctly return status on error" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: aic7xxx: fix EISA support Revert "scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO" scsi: core: set result when the command cannot be dispatched
2019-04-20Merge tag 'i3c/fixes-for-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linuxLinus Torvalds2-4/+3
Pill i3c fixes from Boris Brezillon: - fix the random PID check - fix the disable controller logic in the designware driver - fix I3C entry in MAINTAINERS * tag 'i3c/fixes-for-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux: MAINTAINERS: Fix the I3C entry i3c: dw: Fix dw_i3c_master_disable controller by using correct mask i3c: Fix the verification of random PID
2019-04-20Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds4-33/+3
Pull timer fixes from Ingo Molnar: "Misc clocksource driver fixes, and a sched-clock wrapping fix" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: timers/sched_clock: Prevent generic sched_clock wrap caused by tick_freeze() clocksource/drivers/timer-ti-dm: Remove omap_dm_timer_set_load_start clocksource/drivers/oxnas: Fix OX820 compatible clocksource/drivers/arm_arch_timer: Remove unneeded pr_fmt macro clocksource/drivers/npcm: select TIMER_OF
2019-04-19Merge tag 'tty-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/ttyLinus Torvalds3-4/+9
Pull tty/serial fixes from Greg KH: "Here are five small fixes for some tty/serial/vt issues that have been reported. The vt one has been around for a while, it is good to finally get that resolved. The others fix a build warning that showed up in 5.1-rc1, and resolve a problem in the sh-sci driver. Note, the second patch for build warning fix for the sc16is7xx driver was just applied to the tree, as it resolves a problem with the previous patch to try to solve the issue. It has not shown up in linux-next yet, unlike all of the other patches, but it has passed 0-day testing and everyone seems to agree that it is correct" * tag 'tty-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: sc16is7xx: put err_spi and err_i2c into correct #ifdef vt: fix cursor when clearing the screen sc16is7xx: move label 'err_spi' to correct section serial: sh-sci: Fix HSCIF RX sampling point adjustment serial: sh-sci: Fix HSCIF RX sampling point calculation
2019-04-19Merge branch 'akpm' (patches from Andrew)Linus Torvalds2-1/+4
Merge misc fixes from Andrew Morton: "16 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping mm/kmemleak.c: fix unused-function warning init: initialize jump labels before command line option parsing kernel/watchdog_hld.c: hard lockup message should end with a newline kcov: improve CONFIG_ARCH_HAS_KCOV help text mm: fix inactive list balancing between NUMA nodes and cgroups mm/hotplug: treat CMA pages as unmovable proc: fixup proc-pid-vm test proc: fix map_files test on F29 mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock mm: swapoff: shmem_unuse() stop eviction without igrab() mm: swapoff: take notice of completion sooner mm: swapoff: remove too limiting SWAP_UNUSE_MAX_TRIES mm: swapoff: shmem_find_swap_entries() filter out other types slab: store tagged freelist for off-slab slabmgmt
2019-04-19Merge tag 'staging-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds21-115/+192
Pull staging and IIO fixes from Greg KH: "Here is a bunch of IIO driver fixes, and some smaller staging driver fixes, for 5.1-rc6. The IIO fixes were delayed due to my vacation, but all resolve a number of reported issues and have been in linux-next for a few weeks with no reported issues. The other staging driver fixes are all tiny, resolving some reported issues in the comedi and most drivers, as well as some erofs fixes. All of these patches have been in linux-next with no reported issues" * tag 'staging-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (24 commits) staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf staging: comedi: ni_usb6501: Fix use of uninitialized mutex staging: erofs: fix unexpected out-of-bound data access staging: comedi: vmk80xx: Fix possible double-free of ->usb_rx_buf staging: comedi: vmk80xx: Fix use of uninitialized semaphore staging: most: core: use device description as name iio: core: fix a possible circular locking dependency iio: ad_sigma_delta: select channel when reading register iio: pms7003: select IIO_TRIGGERED_BUFFER iio: cros_ec: Fix the maths for gyro scale calculation iio: adc: xilinx: prevent touching unclocked h/w on remove iio: adc: xilinx: fix potential use-after-free on probe iio: adc: xilinx: fix potential use-after-free on remove iio: dac: mcp4725: add missing powerdown bits in store eeprom io: accel: kxcjk1013: restore the range after resume. iio:chemical:bme680: Fix SPI read interface iio:chemical:bme680: Fix, report temperature in millidegrees iio: chemical: fix missing Kconfig block for sgp30 iio: adc: at91: disable adc channel interrupt in timeout case iio: gyro: mpu3050: fix chip ID reading ...
2019-04-19Merge tag 'char-misc-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-miscLinus Torvalds4-8/+12
Pull char/misc fixes from Greg KH: "Here are four small misc driver fixes for 5.1-rc6. Nothing major at all, they fix up a Kconfig issues, a SPDX invalid license tag, and two tiny bugfixes. All have been in linux-next for a while with no reported issues" * tag 'char-misc-5.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: drivers: power: supply: goldfish_battery: Fix bogus SPDX identifier extcon: ptn5150: fix COMPILE_TEST dependencies misc: fastrpc: add checked value for dma_set_mask habanalabs: remove low credit limit of DMA #0
2019-04-19Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/inputLinus Torvalds3-4/+44
Pull input updates from Dmitry Torokhov: - several new key mappings for HID - a host of new ACPI IDs used to identify Elan touchpads in Lenovo laptops * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ HID: input: add mapping for "Toggle Display" key HID: input: add mapping for "Full Screen" key HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys HID: input: add mapping for Expose/Overview key HID: input: fix mapping of aspect ratio key [media] doc-rst: switch to new names for Full Screen/Aspect keys Input: document meanings of KEY_SCREEN and KEY_ZOOM Input: elan_i2c - add hardware ID for multiple Lenovo laptops
2019-04-19coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumpingAndrea Arcangeli1-0/+3
The core dumping code has always run without holding the mmap_sem for writing, despite that is the only way to ensure that the entire vma layout will not change from under it. Only using some signal serialization on the processes belonging to the mm is not nearly enough. This was pointed out earlier. For example in Hugh's post from Jul 2017: https://lkml.kernel.org/r/alpine.LSU.2.11.1707191716030.2055@eggly.anvils "Not strictly relevant here, but a related note: I was very surprised to discover, only quite recently, how handle_mm_fault() may be called without down_read(mmap_sem) - when core dumping. That seems a misguided optimization to me, which would also be nice to correct" In particular because the growsdown and growsup can move the vm_start/vm_end the various loops the core dump does around the vma will not be consistent if page faults can happen concurrently. Pretty much all users calling mmget_not_zero()/get_task_mm() and then taking the mmap_sem had the potential to introduce unexpected side effects in the core dumping code. Adding mmap_sem for writing around the ->core_dump invocation is a viable long term fix, but it requires removing all copy user and page faults and to replace them with get_dump_page() for all binary formats which is not suitable as a short term fix. For the time being this solution manually covers the places that can confuse the core dump either by altering the vma layout or the vma flags while it runs. Once ->core_dump runs under mmap_sem for writing the function mmget_still_valid() can be dropped. Allowing mmap_sem protected sections to run in parallel with the coredump provides some minor parallelism advantage to the swapoff code (which seems to be safe enough by never mangling any vma field and can keep doing swapins in parallel to the core dumping) and to some other corner case. In order to facilitate the backporting I added "Fixes: 86039bd3b4e6" however the side effect of this same race condition in /proc/pid/mem should be reproducible since before 2.6.12-rc2 so I couldn't add any other "Fixes:" because there's no hash beyond the git genesis commit. Because find_extend_vma() is the only location outside of the process context that could modify the "mm" structures under mmap_sem for reading, by adding the mmget_still_valid() check to it, all other cases that take the mmap_sem for reading don't need the new check after mmget_not_zero()/get_task_mm(). The expand_stack() in page fault context also doesn't need the new check, because all tasks under core dumping are frozen. Link: http://lkml.kernel.org/r/20190325224949.11068-1-aarcange@redhat.com Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reported-by: Jann Horn <jannh@google.com> Suggested-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Jann Horn <jannh@google.com> Acked-by: Jason Gunthorpe <jgg@mellanox.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-04-19mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lockzhong jiang1-1/+1
When adding memory by probing a memory block in the sysfs interface, there is an obvious issue where we will unlock the device_hotplug_lock when we failed to takes it. That issue was introduced in 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock"). We should drop out in time when failing to take the device_hotplug_lock. Link: http://lkml.kernel.org/r/1554696437-9593-1-git-send-email-zhongjiang@huawei.com Fixes: 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock") Signed-off-by: zhong jiang <zhongjiang@huawei.com> Reported-by: Yang yingliang <yangyingliang@huawei.com> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-04-19staging: speakup: refactor to use existing code in vtOkash Khawaja3-126/+88
This patch replaces speakup's implementations with calls to functions in tty/vt/selection.c. Those functions are: cancel_selection() set_selection_kernel() paste_selection() Currently setting selection is done in interrupt context. However, set_selection_kernel() can sleep - for instance, it requires console_lock which can sleep. Therefore we offload that work to a work_struct thread, following the same pattern which was already set for paste_selection(). When setting selection, we also get a reference to tty and make sure to release the reference before returning. struct speakup_paste_work has been renamed to the more generic speakup_selection_work because it is now used for both pasting as well as setting selection. When paste work is cancelled, the code wasn't setting tty to NULL. This patch also fixes that by setting tty to NULL so that in case of failure we don't get EBUSY forever. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Tested-by: Gregory Nowak <greg@gregn.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19vt: selection: allow functions to be called from inside kernelOkash Khawaja2-19/+34
This patch breaks set_selection() into two functions so that when called from kernel, copy_from_user() can be avoided. The two functions are called set_selection_user() and set_selection_kernel() in order to be explicit about their purposes. This also means updating any references to set_selection() and fixing for name change. It also exports set_selection_kernel() and paste_selection(). These changes are used the following patch where speakup's selection functionality calls into the above functions, thereby doing away with parallel implementation. Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Tested-by: Gregory Nowak <greg@gregn.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: greybus: power_supply: use struct_size() helperGustavo A. R. Silva1-2/+2
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace code of the following form: sizeof(*resp) + props_count * sizeof(struct gb_power_supply_props_desc) with: struct_size(resp, props, props_count) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: use help instead of ---help--- in KconfigMoses Christopher1-127/+127
- Resolve the following warning from the Kconfig, "WARNING: prefer 'help' over '---help---' for new help texts" Signed-off-by: Moses Christopher <moseschristopherb@gmail.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19Staging: rtl8723bs: Avoid typedefs for structureBhanusree Pola2-7/+7
Avoid typedefs for structure types to maintain kernel coding style. Remove typedefs for _ODM_Phy_Dbg_Info and _ODM_Mac_Status_Info_. This part is done by the following semantic patch: <smpl> @r1@ identifier i; type t; @@ typedef struct i { ... }t; @r2@ type r1.t; identifier v; @@ t v; @script:python match@ i << r1.i; x; @@ coccinelle.x = i; @r4@ identifier match.x; type r1.t; @@ - typedef struct x + struct x { ... } - t ; @r5@ type r1.t; identifier r2.v, match.x; @@ - t v; + struct x v; </smpl> Change Structure name _ODM_Phy_Dbg_Info and _ODM_Mac_Status_Info_ to maintain Linux kernel Coding Style. Replace occurences of ODM_PHY_DBG_INFO_T to odm_phy_dbg_info and ODM_MAC_INFO to odm_mac_status_info. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: mt7621-pci-phy: convert driver to use kernel regmap API'sSergio Paracuellos1-34/+54
Instead of using writel and readl use regmap API which makes the driver maintainability easier. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: mt7621-pci-phy: add quirks for 'E2' revision using 'soc_device_attribute'Sergio Paracuellos1-3/+14
Depending on revision of the chip, 'mt7621_bypass_pipe_rst' function must be executed. Add better support for this using 'soc_device_match' in driver probe function. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: mt7621-pci-phy: remove some unnecessary local variablesSergio Paracuellos1-12/+4
Device tree is not using child nodes anymore so the 'child_np' variable can safely removed. This also simplifies the error path to be able to directly return errors removing also the 'ret' variable. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: mt7621-pci-phy: use 'platform_get_resource'Sergio Paracuellos1-6/+5
Driver is using 'of_address_to_resource' to get memory resources. Make use of 'platform_get_resource' instead which is more accurate for a platform driver. This also makes possible to delete a local variable which is not needed anymore. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: rtl8723bs: fix spelling mistake: "nonprintabl" -> "non-printable"Colin Ian King1-1/+1
There is a spelling mistake in an RT_TRACE message, fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: rtlwifi: fix spelling mistake "notity" -> "notify"Colin Ian King1-2/+2
There are two spelling mistake in RT_TRACE messages. Fix them. Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: dt9812: Call mutex_destroy() on private mutexIan Abbott1-4/+1
`dt9812_detach()` is the Comedi "detach" handler for the dt9812 driver. When it is called, the private data for the device is about to be freed. The private data contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. Also remove the calls to `mutex_lock()` and `mutex_unlock()` from `dt9812_detach()` as the mutex is only being used around a call to `usb_set_intfdata()` to clear the USB interface's driver data pointer. The mutex lock seems redundant here, especially as it is about to be destroyed. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: ni_usb6501: Call mutex_destroy() on private mutexIan Abbott1-3/+1
`ni6501_detach()` is the Comedi "detach" handler for the ni_usb6501 driver. It is called when the private data for the device is about to be freed. The private data contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. Also remove the calls to `mutex_lock()` and `mutex_unlock()` from `ni6501_detach()`. The only other locks of the mutex are by some of the Comedi instruction handlers that cannot contend with the "detach" handler for this mutex. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: usbdux: Call mutex_destroy() on private mutexIan Abbott1-0/+2
`usbdux_detach()` is the Comedi "detach" handler for the usbdux driver. When it is called, the private data for the device is about to be freed. The private date contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. The calls to `mutex_lock()` and `mutex_unlock()` are probably not required, especially as the mutex is about to be destroyed, but leave them alone for now. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: usbduxfast: Call mutex_destroy() on private mutexIan Abbott1-0/+2
`usbduxfast_detach()` is the Comedi "detach" handler for the usbduxfast driver. When it is called, the private data for the device is about to be freed. The private date contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. The calls to `mutex_lock()` and `mutex_unlock()` in `usbduxfast_detach()` are probably not required, especially as the mutex is about to be destroyed, but leave them alone for now. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19staging: comedi: usbduxsigma: Call mutex_destroy() on private mutexIan Abbott1-0/+2
`usbduxsigma_detach()` is the Comedi "detach" handler for the usbduxsigma driver. When it is called, the private data for the device is about to be freed. The private date contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. The calls to `mutex_lock()` and `mutex_unlock()` in `usbduxsigma_detach()` are probably not required, especially as the mutex is about to be destroyed, but leave them alone for now. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>