4.14.157-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 1/211 net/mlx4_en: fix mlx4 ethtool -N insertion
In reply to Greg Kroah-HartmanFrom: Luigi Rizzo <[email protected]>
[ Upstream commit 34e59836565e36fade1464e054a3551c1a0364be ]
ethtool expects ETHTOOL_GRXCLSRLALL to set ethtool_rxnfc->data with the total number of entries in the rx classifier table. Surprisingly, mlx4 is missing this part (in principle ethtool could still move forward and try the insert).
Tested: compiled and run command:
phh13:~# ethtool -N eth1 flow-type udp4 queue 4 Added rule with ID 255
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 -0
@@ -1722,6 +1722,7 @@ static int mlx4_en_get_rxnfc(struct net_ err =mlx4_en_get_flow (dev, cmd, cmd->fs.location);break ;case ETHTOOL_GRXCLSRLALL : + cmd->data =MAX_NUM_OF_FS_RULES ;while ((!err || err == -ENOENT ) && priority < cmd->rule_cnt) { err =mlx4_en_get_flow (dev, cmd, i);if (!err)
Greg Kroah-Hartman
maintainercover 4.14.157-stable review
This is the start of the stable review cycle for the 4.14.157 release. There are 211 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 29 Nov 2019 20:18:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.157-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.157-rc1
Sasha Levin <[email protected]>
x86/hyperv: mark hyperv_init as __init function
Michael Ellerman <[email protected]>
KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
Michael Ellerman <[email protected]>
powerpc/book3s64: Fix link stack flush on context switch
Christopher M. Riedl <[email protected]>
powerpc/64s: support nospectre_v2 cmdline option
Bernd Porr <[email protected]>
staging: comedi: usbduxfast: usbduxfast_ai_cmdtest rounding error
Aleksander Morgado <[email protected]>
USB: serial: option: add support for Foxconn T77W968 LTE modules
Aleksander Morgado <[email protected]>
USB: serial: option: add support for DW5821e with eSIM support
Johan Hovold <[email protected]>
USB: serial: mos7840: fix remote wakeup
Johan Hovold <[email protected]>
USB: serial: mos7720: fix remote wakeup
Pavel Löbl <[email protected]>
USB: serial: mos7840: add USB ID to support Moxa UPort 2210
Oliver Neukum <[email protected]>
appledisplay: fix error handling in the scheduled work
Oliver Neukum <[email protected]>
USB: chaoskey: fix error case of a timeout
Greg Kroah-Hartman <[email protected]>
usb-serial: cp201x: support Mark-10 digital force gauge
Suwan Kim <[email protected]>
usbip: Fix uninitialized symbol 'nents' in stub_recv_cmd_submit()
Hewenliang <[email protected]>
usbip: tools: fix fd leakage in the function of read_attr_usbip_status
Halil Pasic <[email protected]>
virtio_ring: fix return code on DMA mapping fails
Sean Young <[email protected]>
media: imon: invalid dereference in imon_touch_event
Vito Caputo <[email protected]>
media: cxusb: detect cxusb_ctrl_msg error in query
Oliver Neukum <[email protected]>
media: b2c2-flexcop-usb: add sanity checking
Laurent Pinchart <[email protected]>
media: uvcvideo: Fix error path in control parsing failure
Kai Shen <[email protected]>
cpufreq: Add NULL checks to show() and store() methods of cpufreq
Alan Stern <[email protected]>
media: usbvision: Fix races among open, close, and disconnect
Alexander Popov <[email protected]>
media: vivid: Fix wrong locking that causes race conditions on streaming stop
Vandana BN <[email protected]>
media: vivid: Set vid_cap_streaming and vid_out_streaming to true
Jouni Hogander <[email protected]>
net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
Oliver Neukum <[email protected]>
nfc: port100: handle command failure cleanly
Ingo Molnar <[email protected]>
x86/pti/32: Calculate the various PTI cpu_entry_area sizes correctly, make the CPU_ENTRY_AREA_PAGES assert precise
Andy Lutomirski <[email protected]>
selftests/x86/sigreturn/32: Invalidate DS and ES when abusing the kernel
Andy Lutomirski <[email protected]>
selftests/x86/mov_ss_trap: Fix the SYSENTER test
Thomas Gleixner <[email protected]>
x86/cpu_entry_area: Add guard page for entry stack on 32bit
Andy Lutomirski <[email protected]>
x86/doublefault/32: Fix stack canaries in the double fault handler
Navid Emamdoost <[email protected]>
nbd: prevent memory leak
Waiman Long <[email protected]>
x86/speculation: Fix redundant MDS mitigation message
Waiman Long <[email protected]>
x86/speculation: Fix incorrect MDS/TAA mitigation status
Alexander Kapshuk <[email protected]>
x86/insn: Fix awk regexp warnings
Alexey Brodkin <[email protected]>
ARC: perf: Accommodate big-endian CPU
Chester Lin <[email protected]>
ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary
Gang He <[email protected]>
ocfs2: remove ocfs2_is_o2cb_active()
Bo Yan <[email protected]>
cpufreq: Skip cpufreq resume if it's not suspended
Hari Vyas <[email protected]>
arm64: fix for bad_mode() handler to always result in panic
Max Uvarov <[email protected]>
net: phy: dp83867: increase SGMII autoneg timer duration
Max Uvarov <[email protected]>
net: phy: dp83867: fix speed 10 in sgmii mode
David Hildenbrand <[email protected]>
mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span()
John Pittman <[email protected]>
md/raid10: prevent access of uninitialized resync_pages offset
Denis Efremov <[email protected]>
ath9k_hw: fix uninitialized variable data
Hui Peng <[email protected]>
ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe
Sean Christopherson <[email protected]>
KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
Tomas Bortoli <[email protected]>
Bluetooth: Fix invalid-free in bcsp_close()
Johannes Berg <[email protected]>
cfg80211: call disconnect_wk when AP stops
David Ahern <[email protected]>
ipv6: Fix handling of LLA with VRF and sockets bound to VRF
zhong jiang <[email protected]>
mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix timeout error after reading 8 bytes
Vignesh R <[email protected]>
spi: omap2-mcspi: Fix DMA and FIFO event trigger size mismatch
Kishon Vijay Abraham I <[email protected]>
PCI: keystone: Use quirk to limit MRRS for K2G
Nathan Chancellor <[email protected]>
pinctrl: zynq: Use define directive for PIN_CONFIG_IO_STANDARD
Nathan Chancellor <[email protected]>
pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT
Brian Masney <[email protected]>
pinctrl: qcom: spmi-gpio: fix gpio-hog related boot issues
Sriram R <[email protected]>
cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces
Frank Rowand <[email protected]>
of: unittest: allow base devicetree to have symbol metadata
David Barmann <[email protected]>
sock: Reset dst when changing sk_mark via setsockopt
YueHaibing <[email protected]>
net: bcmgenet: return correct value 'ret' from bcmgenet_power_down
Colin Ian King <[email protected]>
ACPICA: Use %d for signed int print formatting instead of %u
Mike Manning <[email protected]>
vrf: mark skb for multicast or link-local as enslaved to VRF
Tycho Andersen <[email protected]>
dlm: don't leak kernel pointer to userspace
Tycho Andersen <[email protected]>
dlm: fix invalid free
James Smart <[email protected]>
scsi: lpfc: Correct loss of fc4 type on remote port address change
James Smart <[email protected]>
scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces
Shivasharan S <[email protected]>
scsi: megaraid_sas: Fix goto labels in error handling
Shivasharan S <[email protected]>
scsi: megaraid_sas: Fix msleep granularity
Suganath Prabu <[email protected]>
scsi: mpt3sas: Fix driver modifying persistent data in Manufacturing page11
Suganath Prabu <[email protected]>
scsi: mpt3sas: Don't modify EEDPTagMode field setting on SAS3.5 HBA devices
Suganath Prabu <[email protected]>
scsi: mpt3sas: Fix Sync cache command failure during driver unload
Florian Fainelli <[email protected]>
net: dsa: bcm_sf2: Turn on PHY to allow successful registration
Shaokun Zhang <[email protected]>
rtlwifi: rtl8192de: Fix misleading REG_MCUFWDL information
Dan Carpenter <[email protected]>
wireless: airo: potential buffer overflow in sprintf()
Ali MJ Al-Nasrawy <[email protected]>
brcmsmac: never log "tid x is not agg'able" by default
Gustavo A. R. Silva <[email protected]>
rtl8xxxu: Fix missing break in switch
Christophe JAILLET <[email protected]>
wlcore: Fix the return value in case of error in 'wlcore_vendor_cmd_smart_config_start()'
Lior David <[email protected]>
wil6210: fix locking in wmi_call
Arnd Bergmann <[email protected]>
btrfs: avoid link error with CONFIG_NO_AUTO_INLINE
Richard Guy Briggs <[email protected]>
audit: print empty EXECVE args
Icenowy Zheng <[email protected]>
clk: sunxi-ng: enable so-said LDOs for A64 SoC's pll-mipi clock
Arnd Bergmann <[email protected]>
openvswitch: fix linking without CONFIG_NF_CONNTRACK_LABELS
Valentin Schneider <[email protected]>
sched/fair: Don't increase sd->balance_interval on newidle balance
Peter Zijlstra <[email protected]>
sched/topology: Fix off by one bug
Eric Dumazet <[email protected]>
net: do not abort bulk send on BQL status
Larry Chen <[email protected]>
ocfs2: fix clusters leak in ocfs2_defrag_extent()
Changwei Ge <[email protected]>
ocfs2: don't put and assigning null to bh allocated outside
Victor Kamensky <[email protected]>
arm64: makefile fix build of .i file in external module case
Dave Jiang <[email protected]>
ntb: intel: fix return value for ndev_vec_mask()
Jon Mason <[email protected]>
ntb_netdev: fix sleep time mismatch
Huazhong Tan <[email protected]>
net: hns3: bugfix for buffer not free problem during resetting
Miroslav Lichvar <[email protected]>
igb: shorten maximum PHC timecounter update interval
David Hildenbrand <[email protected]>
mm/memory_hotplug: make add_memory() take the device_hotplug_lock
Colin Ian King <[email protected]>
fs/hfs/extent.c: fix array out of bounds read of array extent
Ernesto A. Fernández <[email protected]>
hfs: update timestamp on truncate()
Ernesto A. Fernández <[email protected]>
hfsplus: update timestamps on truncate()
Ernesto A. Fernández <[email protected]>
hfs: fix return value of hfs_get_block()
Ernesto A. Fernández <[email protected]>
hfsplus: fix return value of hfsplus_get_block()
Ernesto A. Fernández <[email protected]>
hfs: prevent btree data loss on ENOSPC
Ernesto A. Fernández <[email protected]>
hfsplus: prevent btree data loss on ENOSPC
Ernesto A. Fernández <[email protected]>
hfs: fix BUG on bnode parent update
Ernesto A. Fernández <[email protected]>
hfsplus: fix BUG on bnode parent update
Rasmus Villemoes <[email protected]>
linux/bitmap.h: fix type of nbits in bitmap_shift_right()
Rasmus Villemoes <[email protected]>
linux/bitmap.h: handle constant zero-size bitmaps correctly
Michael Ellerman <[email protected]>
selftests/powerpc/cache_shape: Fix out-of-tree build
Michael Ellerman <[email protected]>
selftests/powerpc/switch_endian: Fix out-of-tree build
Joel Stanley <[email protected]>
selftests/powerpc/signal: Fix out-of-tree build
Joel Stanley <[email protected]>
powerpc/xmon: Relax frame size for clang
Darrick J. Wong <[email protected]>
vfs: avoid problematic remapping requests into partial EOF block
Anton Ivanov <[email protected]>
um: Make line/tty semantics use true write IRQ
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix race condition when IRQ is cleared
Masahiro Yamada <[email protected]>
i2c: uniphier-f: fix occasional timeout error
Masahiro Yamada <[email protected]>
i2c: uniphier-f: make driver robust against concurrency
Jianchao Wang <[email protected]>
block: fix the DISCARD request merge
Sabrina Dubroca <[email protected]>
macsec: let the administrator set UP state even if lowerdev is down
Sabrina Dubroca <[email protected]>
macsec: update operstate when lower device changes
Dave Chinner <[email protected]>
mm/page-writeback.c: fix range_cyclic writeback vs writepages deadlock
Jia-Ju Bai <[email protected]>
fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle()
Andrey Ryabinin <[email protected]>
arm64: lib: use C string functions with KASAN enabled
David S. Miller <[email protected]>
sparc64: Rework xchg() definition to avoid warnings.
Felipe Rechia <[email protected]>
powerpc/process: Fix flush_all_to_thread for SPE
Taehee Yoo <[email protected]>
bpf: devmap: fix wrong interface selection in notifier_call
Geert Uytterhoeven <[email protected]>
thermal: rcar_thermal: Prevent hardware access during system suspend
Jerry Hoemann <[email protected]>
selftests: watchdog: Fix error message.
Shuah Khan (Samsung OSG) <[email protected]>
selftests: watchdog: fix message when /dev/watchdog open fails
Masami Hiramatsu <[email protected]>
selftests/ftrace: Fix to test kprobe $comm arg only if available
Marek Szyprowski <[email protected]>
mfd: max8997: Enale irq-wakeup unconditionally
Andy Shevchenko <[email protected]>
mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well
Fabio Estevam <[email protected]>
mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values
Sapthagiri Baratam <[email protected]>
mfd: arizona: Correct calling of runtime_put_sync
Ivan Khoronzhuk <[email protected]>
net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode
Dan Carpenter <[email protected]>
qlcnic: fix a return in qlcnic_dcb_get_capability()
Nathan Chancellor <[email protected]>
mISDN: Fix type of switch control variable in ctrl_teimanager
Chao Yu <[email protected]>
f2fs: fix to spread clear_cold_data()
Nathan Chancellor <[email protected]>
rtc: s35390a: Change buf's type to u8 in s35390a_init
Yan, Zheng <[email protected]>
ceph: fix dentry leak in ceph_readdir_prepopulate
Aravinda Prasad <[email protected]>
powerpc/pseries: Export raw per-CPU VPA data via debugfs
David S. Miller <[email protected]>
sparc: Fix parport build warnings.
Vignesh R <[email protected]>
spi: omap2-mcspi: Set FIFO DMA trigger level to word length
Thomas Richter <[email protected]>
s390/perf: Return error when debug_register fails
Nathan Chancellor <[email protected]>
atm: zatm: Fix empty body Clang warnings
J. Bruce Fields <[email protected]>
sunrpc: safely reallow resvport min/max inversion
Trond Myklebust <[email protected]>
SUNRPC: Fix a compile warning for cmpxchg64()
Heinz Mauelshagen <[email protected]>
dm raid: avoid bitmap with raid4/5/6 journal device
Colin Ian King <[email protected]>
usbip: tools: fix atoi() on non-null terminated string
Mattias Jacobsson <[email protected]>
USB: misc: appledisplay: fix backlight update_status return code
Jon Derrick <[email protected]>
PCI: vmd: Detach resources after stopping root bus
Benjamin Herrenschmidt <[email protected]>
macintosh/windfarm_smu_sat: Fix debug output
Philipp Klocke <[email protected]>
ALSA: i2c/cs8427: Fix int to char conversion
Ulf Hansson <[email protected]>
PM / Domains: Deal with multiple states but no governor in genpd
Steven Rostedt (VMware) <[email protected]>
kprobes, x86/ptrace.h: Make regs_get_kernel_stack_nth() not fault on bad stack
Dave Chinner <[email protected]>
xfs: fix use-after-free race in xfs_buf_rele
Netanel Belgazal <[email protected]>
net: ena: Fix Kconfig dependency on X86
Kyeongdon Kim <[email protected]>
net: fix warning in af_unix
Marek Behún <[email protected]>
net: dsa: mv88e6xxx: Fix 88E6141/6341 2500mbps SERDES speed
Christoph Hellwig <[email protected]>
scsi: dc395x: fix DMA API usage in sg_update_list
Christoph Hellwig <[email protected]>
scsi: dc395x: fix dma API usage in srb_done
Marcel Ziswiler <[email protected]>
ASoC: tegra_sgtl5000: fix device_node refcounting
Alexandre Belloni <[email protected]>
clk: at91: audio-pll: fix audio pmc type
Lubomir Rintel <[email protected]>
clk: mmp2: fix the clock id for sdh2_clk and sdh3_clk
Bart Van Assche <[email protected]>
nvmet-fcloop: suppress a compiler warning
Nathan Chancellor <[email protected]>
crypto: ccree - avoid implicit enum conversion
Nathan Chancellor <[email protected]>
scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param
Nathan Chancellor <[email protected]>
scsi: isci: Change sci_controller_start_task's return type to sci_status
Nathan Chancellor <[email protected]>
scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler
Uros Bizjak <[email protected]>
KVM/x86: Fix invvpid and invept register operand size in 64-bit mode
Sean Christopherson <[email protected]>
KVM: nVMX: reset cache/shadows when switching loaded VMCS
Gustavo A. R. Silva <[email protected]>
scsi: ips: fix missing break in switch
Rahul Verma <[email protected]>
qed: Align local and global PTT to propagate through the APIs.
Omar Sandoval <[email protected]>
amiflop: clean up on errors during setup
Hans de Goede <[email protected]>
pwm: lpss: Only set update bit if we are actually changing the settings
Christophe JAILLET <[email protected]>
pinctrl: sunxi: Fix a memory leak in 'sunxi_pinctrl_build_state()'
Devesh Sharma <[email protected]>
RDMA/bnxt_re: Fix qp async event reporting
Angelo Dureghello <[email protected]>
m68k: fix command-line parsing when passed from u-boot
Julien Folly <[email protected]>
w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size).
Wenwen Wang <[email protected]>
misc: mic: fix a DMA pool free failure
Duncan Laurie <[email protected]>
gsmi: Fix bug in append_to_eventlog sysfs handler
Nikolay Borisov <[email protected]>
btrfs: handle error of get_old_root
Chaotian Jing <[email protected]>
mmc: mediatek: fix cannot receive new request when msdc_cmd_is_ready fail
Sergei Shtylyov <[email protected]>
spi: sh-msiof: fix deferred probing
Jens Axboe <[email protected]>
cdrom: don't attempt to fiddle with cdo->capability
Jens Axboe <[email protected]>
skd: fixup usage of legacy IO API
Carl Huang <[email protected]>
ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem
Ali MJ Al-Nasrawy <[email protected]>
brcmsmac: AP mode: update beacon when TIM changes
Dan Carpenter <[email protected]>
EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr()
Sam Bobroff <[email protected]>
powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field
Joel Stanley <[email protected]>
powerpc/boot: Disable vector instructions
Dan Carpenter <[email protected]>
powerpc: Fix signedness bug in update_flash_db()
Al Viro <[email protected]>
synclink_gt(): fix compat_ioctl()
Al Viro <[email protected]>
pty: fix compat ioctls
Andreas Gruenbacher <[email protected]>
gfs2: Fix marking bitmaps non-full
Sergey Senozhatsky <[email protected]>
printk: fix integer overflow in setup_log_buf()
Takashi Sakamoto <[email protected]>
ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback
Adrian Bunk <[email protected]>
mwifiex: Fix NL80211_TX_POWER_LIMITED
Hans de Goede <[email protected]>
platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi
Kiernan Hager <[email protected]>
platform/x86: asus-nb-wmi: Support ALS on the Zenbook UX430UQ
Chris Wilson <[email protected]>
drm/i915/userptr: Try to acquire the page lock around set_page_dirty()
Andrey Ryabinin <[email protected]>
mm/ksm.c: don't WARN if page is still mapped in remove_stable_node()
Joseph Qi <[email protected]>
Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()"
Laurent Vivier <[email protected]>
virtio_console: allocate inbufs in add_port() only if it is needed
Sun Ke <[email protected]>
nbd:fix memory leak in nbd_get_socket()
Laura Abbott <[email protected]>
tools: gpio: Correctly add make dependencies for gpio_utils
Thierry Reding <[email protected]>
gpio: max77620: Fixup debounce delays
Stefano Garzarella <[email protected]>
vhost/vsock: split packets to send using multiple buffers
Davide Caratti <[email protected]>
net/sched: act_pedit: fix WARN() in the traffic path
Eran Ben Elisha <[email protected]>
net/mlxfw: Verify FSM error code translation doesn't exceed array size
Roi Dayan <[email protected]>
net/mlx5e: Fix set vf link state error flow
Martin Habets <[email protected]>
sfc: Only cancel the PPS workqueue if it exists
Dan Carpenter <[email protected]>
net: rtnetlink: prevent underflows in do_setvfinfo()
Luigi Rizzo <[email protected]>
net/mlx4_en: fix mlx4 ethtool -N insertion
-------------
Diffstat:
Documentation/admin-guide/hw-vuln/mds.rst | 7 +- .../admin-guide/hw-vuln/tsx_async_abort.rst | 5 +- Documentation/admin-guide/kernel-parameters.txt | 11 +++ Makefile | 4 +- arch/arc/kernel/perf_event.c | 4 +- arch/arm/mm/mmu.c | 3 + arch/arm64/Makefile | 2 + arch/arm64/include/asm/string.h | 14 ++-- arch/arm64/kernel/arm64ksyms.c | 7 +- arch/arm64/kernel/traps.c | 1 - arch/arm64/lib/memchr.S | 2 +- arch/arm64/lib/memcmp.S | 2 +- arch/arm64/lib/strchr.S | 2 +- arch/arm64/lib/strcmp.S | 2 +- arch/arm64/lib/strlen.S | 2 +- arch/arm64/lib/strncmp.S | 2 +- arch/arm64/lib/strnlen.S | 2 +- arch/arm64/lib/strrchr.S | 2 +- arch/m68k/kernel/uboot.c | 2 +- arch/powerpc/boot/Makefile | 4 +- arch/powerpc/include/asm/asm-prototypes.h | 3 + arch/powerpc/include/asm/security_features.h | 3 + arch/powerpc/kernel/eeh_pe.c | 2 +- arch/powerpc/kernel/entry_64.S | 6 ++ arch/powerpc/kernel/process.c | 3 +- arch/powerpc/kernel/security.c | 74 +++++++++++++++++-- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 27 +++++++ arch/powerpc/platforms/ps3/os-area.c | 2 +- arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +- arch/powerpc/platforms/pseries/lpar.c | 54 ++++++++++++++ arch/powerpc/xmon/Makefile | 6 ++ arch/s390/kernel/perf_cpum_sf.c | 6 +- arch/sparc/include/asm/cmpxchg_64.h | 7 +- arch/sparc/include/asm/parport.h | 2 + arch/um/drivers/line.c | 2 +- arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/cpu_entry_area.h | 18 +++-- arch/x86/include/asm/pgtable_32_types.h | 8 +-- arch/x86/include/asm/ptrace.h | 42 +++++++++-- arch/x86/kernel/cpu/bugs.c | 30 +++++++- arch/x86/kernel/doublefault.c | 3 + arch/x86/kvm/mmu.c | 8 +-- arch/x86/kvm/vmx.c | 12 ++-- arch/x86/mm/cpu_entry_area.c | 4 +- arch/x86/tools/gen-insn-attr-x86.awk | 4 +- block/blk-merge.c | 46 +++++++++--- drivers/acpi/acpi_memhotplug.c | 2 +- drivers/atm/zatm.c | 42 +++++------ drivers/base/memory.c | 9 ++- drivers/base/power/domain.c | 6 ++ drivers/block/amiflop.c | 84 +++++++++++----------- drivers/block/nbd.c | 6 +- drivers/block/skd_main.c | 4 +- drivers/bluetooth/hci_bcsp.c | 3 + drivers/cdrom/cdrom.c | 27 ++++--- drivers/char/virtio_console.c | 28 ++++---- drivers/clk/at91/clk-audio-pll.c | 2 +- drivers/clk/mmp/clk-of-mmp2.c | 4 +- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 7 +- drivers/cpufreq/cpufreq.c | 9 +++ drivers/edac/thunderx_edac.c | 4 +- drivers/firmware/google/gsmi.c | 5 +- drivers/gpio/gpio-max77620.c | 6 +- drivers/gpu/drm/i915/i915_gem_userptr.c | 22 +++++- drivers/i2c/busses/i2c-uniphier-f.c | 72 +++++++++++++++---- drivers/infiniband/hw/bnxt_re/main.c | 13 ++-- drivers/isdn/mISDN/tei.c | 7 +- drivers/macintosh/windfarm_smu_sat.c | 25 ++----- drivers/md/dm-raid.c | 2 +- drivers/md/raid10.c | 2 +- drivers/media/platform/vivid/vivid-kthread-cap.c | 8 ++- drivers/media/platform/vivid/vivid-kthread-out.c | 8 ++- drivers/media/platform/vivid/vivid-sdr-cap.c | 8 ++- drivers/media/platform/vivid/vivid-vid-cap.c | 3 - drivers/media/platform/vivid/vivid-vid-out.c | 3 - drivers/media/rc/imon.c | 3 +- drivers/media/usb/b2c2/flexcop-usb.c | 3 + drivers/media/usb/dvb-usb/cxusb.c | 3 +- drivers/media/usb/usbvision/usbvision-video.c | 21 +++++- drivers/media/usb/uvc/uvc_driver.c | 28 ++++---- drivers/mfd/arizona-core.c | 8 +-- drivers/mfd/intel_soc_pmic_bxtwc.c | 41 ++++++++--- drivers/mfd/max8997.c | 8 +-- drivers/mfd/mc13xxx-core.c | 3 +- drivers/misc/mic/scif/scif_fence.c | 2 +- drivers/mmc/host/mtk-sd.c | 2 +- drivers/net/dsa/bcm_sf2.c | 4 ++ drivers/net/dsa/mv88e6xxx/chip.c | 4 +- drivers/net/dsa/mv88e6xxx/port.c | 25 ++++++- drivers/net/dsa/mv88e6xxx/port.h | 1 + drivers/net/ethernet/amazon/Kconfig | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 24 ++++++- drivers/net/ethernet/intel/igb/igb_ptp.c | 8 ++- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 + drivers/net/ethernet/qlogic/qed/qed.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_main.c | 22 ++++-- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 27 ++++--- drivers/net/ethernet/qlogic/qed/qed_mcp.h | 5 +- drivers/net/ethernet/qlogic/qed/qed_vf.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- drivers/net/ethernet/sfc/ptp.c | 3 +- drivers/net/ethernet/ti/cpsw.c | 1 + drivers/net/macsec.c | 20 +++++- drivers/net/ntb_netdev.c | 2 +- drivers/net/phy/dp83867.c | 37 ++++++++++ drivers/net/vrf.c | 19 +++-- drivers/net/wireless/ath/ath10k/pci.c | 23 +++--- drivers/net/wireless/ath/ath10k/usb.c | 8 +++ drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- drivers/net/wireless/ath/wil6210/wmi.c | 9 +-- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 30 +++++++- .../wireless/broadcom/brcm80211/brcmsmac/main.h | 1 + drivers/net/wireless/cisco/airo.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 +++- drivers/net/wireless/marvell/mwifiex/ioctl.h | 1 + drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 11 +-- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + .../net/wireless/realtek/rtlwifi/rtl8192de/fw.c | 2 +- drivers/net/wireless/ti/wlcore/vendor_cmd.c | 2 +- drivers/nfc/port100.c | 2 +- drivers/ntb/hw/intel/ntb_hw_intel.c | 2 +- drivers/nvme/target/fcloop.c | 1 + drivers/of/unittest.c | 43 ++++++++--- drivers/pci/dwc/pci-keystone.c | 3 + drivers/pci/host/vmd.c | 2 +- drivers/pinctrl/pinctrl-lpc18xx.c | 10 +-- drivers/pinctrl/pinctrl-zynq.c | 9 +-- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 ++++-- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 11 +-- drivers/platform/x86/asus-nb-wmi.c | 21 +++++- drivers/platform/x86/asus-wmi.c | 2 +- drivers/platform/x86/asus-wmi.h | 1 + drivers/pwm/pwm-lpss.c | 12 ++-- drivers/rtc/rtc-s35390a.c | 2 +- drivers/scsi/dc395x.c | 12 ++-- drivers/scsi/ips.c | 1 + drivers/scsi/isci/host.c | 8 +-- drivers/scsi/isci/host.h | 2 +- drivers/scsi/isci/request.c | 4 +- drivers/scsi/isci/task.c | 4 +- drivers/scsi/iscsi_tcp.c | 3 +- drivers/scsi/lpfc/lpfc_els.c | 28 +++++++- drivers/scsi/lpfc/lpfc_hbadisc.c | 20 ++++++ drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 5 +- drivers/scsi/lpfc/lpfc_sli.c | 11 +-- drivers/scsi/lpfc/lpfc_sli4.h | 1 + drivers/scsi/megaraid/megaraid_sas_base.c | 9 ++- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_config.c | 4 -- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 36 +++++++++- drivers/spi/spi-omap2-mcspi.c | 26 ++----- drivers/spi/spi-sh-msiof.c | 4 +- drivers/staging/ccree/cc_hw_queue_defs.h | 6 +- drivers/staging/comedi/drivers/usbduxfast.c | 21 ++++-- drivers/thermal/rcar_thermal.c | 4 +- drivers/tty/pty.c | 14 +++- drivers/tty/synclink_gt.c | 16 ++--- drivers/usb/misc/appledisplay.c | 15 +++- drivers/usb/misc/chaoskey.c | 24 ++++++- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/mos7720.c | 4 -- drivers/usb/serial/mos7840.c | 16 +++-- drivers/usb/serial/option.c | 7 ++ drivers/usb/usbip/stub_rx.c | 50 ++++++++----- drivers/vhost/vsock.c | 66 ++++++++++++----- drivers/virtio/virtio_ring.c | 2 +- drivers/w1/slaves/w1_ds2438.c | 66 +++++++++++++---- drivers/xen/balloon.c | 3 + fs/btrfs/ctree.c | 4 ++ fs/btrfs/super.c | 6 +- fs/ceph/inode.c | 1 - fs/dlm/member.c | 5 +- fs/dlm/user.c | 2 +- fs/f2fs/data.c | 8 ++- fs/f2fs/dir.c | 1 + fs/f2fs/segment.c | 4 +- fs/gfs2/rgrp.c | 13 +++- fs/hfs/brec.c | 1 + fs/hfs/btree.c | 41 ++++++----- fs/hfs/btree.h | 1 + fs/hfs/catalog.c | 16 +++++ fs/hfs/extent.c | 10 ++- fs/hfs/inode.c | 2 + fs/hfsplus/attributes.c | 10 +++ fs/hfsplus/brec.c | 1 + fs/hfsplus/btree.c | 44 +++++++----- fs/hfsplus/catalog.c | 24 +++++++ fs/hfsplus/extents.c | 8 ++- fs/hfsplus/hfsplus_fs.h | 2 + fs/hfsplus/inode.c | 1 + fs/ocfs2/buffer_head_io.c | 77 +++++++++++++++----- fs/ocfs2/dlm/dlmdebug.c | 2 +- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/move_extents.c | 17 +++++ fs/ocfs2/stackglue.c | 6 -- fs/ocfs2/stackglue.h | 3 - fs/ocfs2/xattr.c | 56 +++++++++------ fs/read_write.c | 33 +++++++++ fs/xfs/xfs_buf.c | 38 +++++++++- include/linux/bitmap.h | 9 ++- include/linux/kvm_host.h | 1 + include/linux/memory_hotplug.h | 1 + include/linux/mfd/intel_soc_pmic.h | 1 + include/linux/mfd/max8997.h | 1 - include/linux/mfd/mc13xxx.h | 1 + kernel/auditsc.c | 2 +- kernel/bpf/devmap.c | 3 +- kernel/printk/printk.c | 2 +- kernel/sched/fair.c | 13 +++- kernel/sched/topology.c | 2 +- mm/ksm.c | 14 ++-- mm/memory_hotplug.c | 48 ++++++++----- mm/page-writeback.c | 33 ++++----- net/core/dev.c | 2 +- net/core/net-sysfs.c | 24 ++++--- net/core/rtnetlink.c | 23 +++++- net/core/sock.c | 6 +- net/ipv6/tcp_ipv6.c | 3 +- net/openvswitch/conntrack.c | 3 +- net/sched/act_pedit.c | 7 +- net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + net/sunrpc/xprtsock.c | 34 ++++----- net/unix/af_unix.c | 2 + net/vmw_vsock/virtio_transport_common.c | 15 +++- net/wireless/ap.c | 2 + net/wireless/core.h | 2 + net/wireless/sme.c | 8 ++- sound/firewire/isight.c | 10 +-- sound/i2c/cs8427.c | 2 +- sound/soc/tegra/tegra_sgtl5000.c | 17 ++++- tools/gpio/Build | 1 + tools/gpio/Makefile | 10 ++- tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk | 4 +- tools/power/acpi/tools/acpidump/apmain.c | 2 +- .../ftrace/test.d/kprobe/kprobe_args_syntax.tc | 3 + .../testing/selftests/powerpc/cache_shape/Makefile | 9 +-- tools/testing/selftests/powerpc/signal/Makefile | 11 +-- .../selftests/powerpc/switch_endian/Makefile | 1 + tools/testing/selftests/watchdog/watchdog-test.c | 16 +++-- tools/testing/selftests/x86/mov_ss_trap.c | 3 +- tools/testing/selftests/x86/sigreturn.c | 13 ++++ tools/usb/usbip/libsrc/usbip_host_common.c | 8 +-- virt/kvm/kvm_main.c | 26 ++++++- 247 files changed, 1992 insertions(+), 806 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 3/211 sfc: Only cancel the PPS workqueue if it exists
From: Martin Habets <[email protected]>
[ Upstream commit 723eb53690041740a13ac78efeaf6804f5d684c9 ]
The workqueue only exists for the primary PF. For other functions we hit a WARN_ON in kernel/workqueue.c.
--- drivers/net/ethernet/sfc/ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/sfc/ptp.c +2 -1
@@ -1320,7 +1320,8 @@ void efx_ptp_remove(struct efx_nic *efx) (void )efx_ptp_disable (efx);cancel_work_sync (&efx->ptp_data->work); -cancel_work_sync (&efx->ptp_data->pps_work); +if (efx->ptp_data->pps_workwq) +cancel_work_sync (&efx->ptp_data->pps_work);skb_queue_purge (&efx->ptp_data->rxq);skb_queue_purge (&efx->ptp_data->txq);
Greg Kroah-Hartman
maintainerPATCH 13/211 mm/ksm.c: dont WARN if page is still mapped in remove_stable_node()
In reply to Greg Kroah-HartmanFrom: Andrey Ryabinin <[email protected]>
commit 9a63236f1ad82d71a98aa80320b6cb618fb32f44 upstream.
It's possible to hit the WARN_ON_ONCE(page_mapped(page)) in remove_stable_node() when it races with __mmput() and squeezes in between ksm_exit() and exit_mmap().
WARNING: CPU: 0 PID: 3295 at mm/ksm.c:888 remove_stable_node+0x10c/0x150 Call Trace: remove_all_stable_nodes+0x12b/0x330 run_store+0x4ef/0x7b0 kernfs_fop_write+0x200/0x420 vfs_write+0x154/0x450 ksys_write+0xf9/0x1d0 do_syscall_64+0x99/0x510 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Remove the warning as there is nothing scary going on.
--- mm/ksm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
mm/ksm.c +7 -7
@@ -849,13 +849,13 @@ static int remove_stable_node(struct stareturn 0 ; } -if (WARN_ON_ONCE (page_mapped (page))) { -/* -* This should not happen: but if it does, just refuse to let -* merge_across_nodes be switched - there is no need to panic. -*/ - err = -EBUSY ; - }else { +/* +* Page could be still mapped if this races with __mmput() running in +* between ksm_exit() and exit_mmap(). Just refuse to let +* merge_across_nodes/max_page_sharing be switched. +*/ + err = -EBUSY ; +if (!page_mapped (page)) {/* * The stable node did not yet appear stale to get_ksm_page(), * since that allows for an unmapped ksm page to be recognized
Greg Kroah-Hartman
maintainerPATCH 15/211 platform/x86: asus-nb-wmi: Support ALS on the Zenbook UX430UQ
In reply to Greg Kroah-HartmanFrom: Kiernan Hager <[email protected]>
[ Upstream commit db2582afa7444a0ce6bb1ebf1431715969a10b06 ]
This patch adds support for ALS on the Zenbook UX430UQ to the asus_nb_wmi driver. It also renames "quirk_asus_ux330uak" to "quirk_asus_forceals" because it is now used for more than one model of computer, and should thus have a more general name.
--- drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-nb-wmi.c +11 -2
@@ -111,7 +111,7 @@ static struct quirk_entry quirk_asus_x550lb = { .xusb2pr = 0x01D9, }; -static struct quirk_entry quirk_asus_ux330uak = { +static struct quirk_entry quirk_asus_forceals = { .wmi_force_als_set = true, };
@@ -387,7 +387,7 @@ static const struct dmi_system_id asus_quirks[] = {DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), DMI_MATCH(DMI_PRODUCT_NAME, "UX330UAK"), }, - .driver_data = &quirk_asus_ux330uak, + .driver_data = &quirk_asus_forceals, }, { .callback = dmi_matched,
@@ -398,6 +398,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_x550lb, }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. UX430UQ", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "UX430UQ"), + }, + .driver_data = &quirk_asus_forceals, + }, {}, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/211 platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 401fee8195d401b2b94dee57383f627050724d5b ]
Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).
The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.
--- drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++ drivers/platform/x86/asus-wmi.c | 2 +- drivers/platform/x86/asus-wmi.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,static struct quirk_entry quirk_asus_unknown = { .wapf =0 , + .wmi_backlight_set_devstate = true, };static struct quirk_entry quirk_asus_q500a = { .i8042_filter = asus_q500a_i8042_filter, + .wmi_backlight_set_devstate = true, };/*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {static struct quirk_entry quirk_asus_x55u = { .wapf =4 , .wmi_backlight_power = true, + .wmi_backlight_set_devstate = true, .no_display_toggle = true, };static struct quirk_entry quirk_asus_wapf4 = { .wapf =4 , + .wmi_backlight_set_devstate = true, };static struct quirk_entry quirk_asus_x200ca = { .wapf =2 , + .wmi_backlight_set_devstate = true, };static struct quirk_entry quirk_asus_ux303ub = { .wmi_backlight_native = true, + .wmi_backlight_set_devstate = true, };static struct quirk_entry quirk_asus_x550lb = { + .wmi_backlight_set_devstate = true, .xusb2pr =0x01D9 , };static struct quirk_entry quirk_asus_forceals = { + .wmi_backlight_set_devstate = true, .wmi_force_als_set = true, };
drivers/platform/x86/asus-wmi.c +1 -1
@@ -2147,7 +2147,7 @@ static int asus_wmi_add(struct platform_device *pdev) err =asus_wmi_backlight_init (asus);if (err && err != -ENODEV ) goto fail_backlight; - }else + }else if (asus->driver->quirks->wmi_backlight_set_devstate) err =asus_wmi_set_devstate (ASUS_WMI_DEVID_BACKLIGHT ,2 ,NULL ); status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +1 -0
@@ -44,6 +44,7 @@ struct quirk_entry {bool store_backlight_power;bool wmi_backlight_power;bool wmi_backlight_native; +bool wmi_backlight_set_devstate;bool wmi_force_als_set;int wapf;/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/211 mwifiex: Fix NL80211_TX_POWER_LIMITED
In reply to Greg Kroah-HartmanFrom: Adrian Bunk <[email protected]>
[ Upstream commit 65a576e27309120e0621f54d5c81eb9128bd56be ]
NL80211_TX_POWER_LIMITED was treated as NL80211_TX_POWER_AUTOMATIC, which is the opposite of what should happen and can cause nasty regulatory problems.
if/else converted to a switch without default to make gcc warn on unhandled enum values.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 +++++++++++-- drivers/net/wireless/marvell/mwifiex/ioctl.h | 1 + drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 11 +++++++---- 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +11 -2
@@ -362,11 +362,20 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,struct mwifiex_power_cfg power_cfg;int dbm =MBM_TO_DBM (mbm); -if (type ==NL80211_TX_POWER_FIXED ) { +switch (type) { +case NL80211_TX_POWER_FIXED : power_cfg.is_power_auto =0 ; + power_cfg.is_power_fixed =1 ; power_cfg.power_level = dbm; - }else { +break ; +case NL80211_TX_POWER_LIMITED : + power_cfg.is_power_auto =0 ; + power_cfg.is_power_fixed =0 ; + power_cfg.power_level = dbm; +break ; +case NL80211_TX_POWER_AUTOMATIC : power_cfg.is_power_auto =1 ; +break ; } priv =mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY );
drivers/net/wireless/marvell/mwifiex/ioctl.h +1 -0
@@ -267,6 +267,7 @@ struct mwifiex_ds_encrypt_key {struct mwifiex_power_cfg {u32 is_power_auto; +u32 is_power_fixed;u32 power_level; };
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +7 -4
@@ -728,6 +728,9 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; txp_cfg->action =cpu_to_le16 (HostCmd_ACT_GEN_SET);if (!power_cfg->is_power_auto) { +u16 dbm_min = power_cfg->is_power_fixed ? + dbm : priv->min_tx_power_level; + txp_cfg->mode =cpu_to_le32 (1 ); pg_tlv = (struct mwifiex_types_power_group *) (buf +sizeof (struct host_cmd_ds_txpwr_cfg ));
@@ -742,7 +745,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, pg->last_rate_code =0x03 ; pg->modulation_class =MOD_CLASS_HR_DSSS ; pg->power_step =0 ; - pg->power_min = (s8 ) dbm; + pg->power_min = (s8 ) dbm_min; pg->power_max = (s8 ) dbm; pg++;/* Power group for modulation class OFDM */
@@ -750,7 +753,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, pg->last_rate_code =0x07 ; pg->modulation_class =MOD_CLASS_OFDM ; pg->power_step =0 ; - pg->power_min = (s8 ) dbm; + pg->power_min = (s8 ) dbm_min; pg->power_max = (s8 ) dbm; pg++;/* Power group for modulation class HTBW20 */
@@ -758,7 +761,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, pg->last_rate_code =0x20 ; pg->modulation_class =MOD_CLASS_HT ; pg->power_step =0 ; - pg->power_min = (s8 ) dbm; + pg->power_min = (s8 ) dbm_min; pg->power_max = (s8 ) dbm; pg->ht_bandwidth =HT_BW_20 ; pg++;
@@ -767,7 +770,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, pg->last_rate_code =0x20 ; pg->modulation_class =MOD_CLASS_HT ; pg->power_step =0 ; - pg->power_min = (s8 ) dbm; + pg->power_min = (s8 ) dbm_min; pg->power_max = (s8 ) dbm; pg->ht_bandwidth =HT_BW_40 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/211 ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 51e68fb0929c29e47e9074ca3e99ffd6021a1c5a ]
In some error paths, reference count of firewire unit is not decreased. This commit fixes the bug.
--- sound/firewire/isight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/firewire/isight.c +5 -5
@@ -639,7 +639,7 @@ static int isight_probe(struct fw_unit *unit,if (!isight->audio_base) {dev_err (&unit->device,"audio unit base not found\n" ); err = -ENXIO ; - goto err_unit; + goto error; }fw_iso_resources_init (&isight->resources, unit);
@@ -668,12 +668,12 @@ static int isight_probe(struct fw_unit *unit,dev_set_drvdata (&unit->device, isight);return 0 ; - -err_unit: -fw_unit_put (isight->unit); -mutex_destroy (&isight->mutex); error:snd_card_free (card); + +mutex_destroy (&isight->mutex); +fw_unit_put (isight->unit); +return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/211 printk: fix integer overflow in setup_log_buf()
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
[ Upstream commit d2130e82e9454304e9b91ba9da551b5989af8c27 ]
The way we calculate logbuf free space percentage overflows signed integer:
int free;
free = __LOG_BUF_LEN - log_next_idx;
pr_info("early log buf free: %u(%u%%)\n",
free, (free * 100) / __LOG_BUF_LEN);We support LOG_BUF_LEN of up to 1<<25 bytes. Since setup_log_buf() is called during early init, logbuf is mostly empty, so
__LOG_BUF_LEN - log_next_idx
is close to 1<<25. Thus when we multiply it by 100, we overflow signed integer value range: 100 is 2^6 + 2^5 + 2^2.
Example, booting with LOG_BUF_LEN 1<<25 and log_buf_len=2G boot param:
[ 0.075317] log_buf_len: -2147483648 bytes [ 0.075319] early log buf free: 33549896(-28%)
Make "free" unsigned integer and use appropriate printk() specifier.
To: Steven Rostedt <[email protected]>
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -1099,7 +1099,7 @@ void __init setup_log_buf(int early) {unsigned long flags;char *new_log_buf; -int free; +unsigned int free;if (log_buf != __log_buf)return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/211 gfs2: Fix marking bitmaps non-full
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit ec23df2b0cf3e1620f5db77972b7fb735f267eff ]
Reservations in gfs can span multiple gfs2_bitmaps (but they won't span multiple resource groups). When removing a reservation, we want to clear the GBF_FULL flags of all involved gfs2_bitmaps, not just that of the first bitmap.
--- fs/gfs2/rgrp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/gfs2/rgrp.c +11 -2
@@ -623,7 +623,10 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)RB_CLEAR_NODE (&rs->rs_node);if (rs->rs_free) { -struct gfs2_bitmap *bi =rbm_bi (&rs->rs_rbm); +u64 last_block =gfs2_rbm_to_block (&rs->rs_rbm) + + rs->rs_free -1 ; +struct gfs2_rbm last_rbm = { .rgd = rs->rs_rbm.rgd, }; +struct gfs2_bitmap *start, *last;/* return reserved blocks to the rgrp */ BUG_ON (rs->rs_rbm.rgd->rd_reserved < rs->rs_free);
@@ -634,7 +637,13 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)it will force the number to be recalculated later. */ rgd->rd_extfail_pt += rs->rs_free; rs->rs_free =0 ; -clear_bit (GBF_FULL , &bi->bi_flags); +if (gfs2_rbm_from_block (&last_rbm, last_block)) +return ; + start =rbm_bi (&rs->rs_rbm); + last =rbm_bi (&last_rbm); +do +clear_bit (GBF_FULL , &start->bi_flags); +while (start++ != last); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/211 pty: fix compat ioctls
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 50f45326afab723df529eca54095e2feac24da2d ]
pointer-taking ones need compat_ptr(); int-taking one doesn't.
--- drivers/tty/pty.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/tty/pty.c +12 -2
@@ -28,6 +28,7 @@#include <linux/mount.h> #include <linux/file.h> #include <linux/ioctl.h> +#include <linux/compat.h> #undef TTY_DEBUG_HANGUP#ifdef TTY_DEBUG_HANGUP
@@ -488,6 +489,7 @@ static int pty_bsd_ioctl(struct tty_struct *tty,return -ENOIOCTLCMD ; } +#ifdef CONFIG_COMPAT static long pty_bsd_compat_ioctl (struct tty_struct *tty,unsigned int cmd,unsigned long arg) {
@@ -495,8 +497,11 @@ static long pty_bsd_compat_ioctl(struct tty_struct *tty,* PTY ioctls don't require any special translation between 32-bit and * 64-bit userspace, they are already compatible. */ -return pty_bsd_ioctl (tty, cmd, arg); + return pty_bsd_ioctl(tty, cmd, (unsigned long)compat_ptr(arg)); } +#else +#define pty_bsd_compat_ioctl NULL +#endif static int legacy_count =CONFIG_LEGACY_PTY_COUNT ;/*
@@ -676,6 +681,7 @@ static int pty_unix98_ioctl(struct tty_struct *tty,return -ENOIOCTLCMD ; } +#ifdef CONFIG_COMPAT static long pty_unix98_compat_ioctl (struct tty_struct *tty,unsigned int cmd,unsigned long arg) {
@@ -683,8 +689,12 @@ static long pty_unix98_compat_ioctl(struct tty_struct *tty,* PTY ioctls don't require any special translation between 32-bit and * 64-bit userspace, they are already compatible. */ -return pty_unix98_ioctl (tty, cmd, arg); +return pty_unix98_ioctl (tty, cmd, + cmd == TIOCSIG ? arg : (unsigned long)compat_ptr(arg)); } +#else +#define pty_unix98_compat_ioctl NULL +#endif /** * ptm_unix98_lookup - find a pty master
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/211 net/mlx5e: Fix set vf link state error flow
In reply to Greg Kroah-HartmanFrom: Roi Dayan <[email protected]>
[ Upstream commit 751021218f7e66ee9bbaa2be23056e447cd75ec4 ]
Before this commit the ndo always returned success. Fix that.
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +1 -1
@@ -1783,7 +1783,7 @@ int mlx5_eswitch_set_vport_state(struct unlock:mutex_unlock (&esw->state_lock); -return 0 ; +return err; } int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
Greg Kroah-Hartman
maintainerPATCH 22/211 synclink_gt(): fix compat_ioctl()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 27230e51349fde075598c1b59d15e1ff802f3f6e ]
compat_ptr() for pointer-taking ones...
--- drivers/tty/synclink_gt.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/tty/synclink_gt.c +4 -12
@@ -1187,14 +1187,13 @@ static long slgt_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) {struct slgt_info *info = tty->driver_data; -int rc = -ENOIOCTLCMD ; +int rc;if (sanity_check (info, tty->name,"compat_ioctl" ))return -ENODEV ;DBGINFO (("%s compat_ioctl() cmd=%08X\n" , info->device_name, cmd));switch (cmd) { -case MGSL_IOCSPARAMS32 : rc =set_params32 (info,compat_ptr (arg));break ;
@@ -1214,18 +1213,11 @@ static long slgt_compat_ioctl(struct tty_struct *tty,case MGSL_IOCWAITGPIO :case MGSL_IOCGXSYNC :case MGSL_IOCGXCTRL : -case MGSL_IOCSTXIDLE : -case MGSL_IOCTXENABLE : -case MGSL_IOCRXENABLE : -case MGSL_IOCTXABORT : -case TIOCMIWAIT : -case MGSL_IOCSIF : -case MGSL_IOCSXSYNC : -case MGSL_IOCSXCTRL : - rc =ioctl (tty, cmd, arg); + rc =ioctl (tty, cmd, (unsigned long )compat_ptr (arg));break ; +default : + rc =ioctl (tty, cmd, arg); } -DBGINFO (("%s compat_ioctl() cmd=%08X rc=%d\n" , info->device_name, cmd, rc));return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/211 powerpc/boot: Disable vector instructions
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit e8e132e6885962582784b6fa16a80d07ea739c0f ]
This will avoid auto-vectorisation when building with higher optimisation levels.
We don't know if the machine can support VSX and even if it's present it's probably not going to be enabled at this point in boot.
These flag were both added prior to GCC 4.6 which is the minimum compiler version supported by upstream, thanks to Segher for the details.
--- arch/powerpc/boot/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/Makefile +2 -2
@@ -24,8 +24,8 @@ compress-$(CONFIG_KERNEL_GZIP) := CONFIG_KERNEL_GZIP compress-$(CONFIG_KERNEL_XZ) := CONFIG_KERNEL_XZ BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -Os -msoft-float -pipe \ - -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ + -fno-strict-aliasing -Os -msoft-float -mno-altivec -mno-vsx \ + -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ -D$(compress-y) BOOTCC := $(CC)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/211 powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field
In reply to Greg Kroah-HartmanFrom: Sam Bobroff <[email protected]>
[ Upstream commit 473af09b56dc4be68e4af33220ceca6be67aa60d ]
eeh_add_to_parent_pe() sometimes removes the EEH_PE_KEEP flag, but it incorrectly removes it from pe->type, instead of pe->state.
However, rather than clearing it from the correct field, remove it. Inspection of the code shows that it can't ever have had any effect (even if it had been cleared from the correct field), because the field is never tested after it is cleared by the statement in question.
The clear statement was added by commit 807a827d4e74 ("powerpc/eeh:
Keep PE during hotplug"), but it didn't explain why it was necessary.
--- arch/powerpc/kernel/eeh_pe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/eeh_pe.c +1 -1
@@ -381,7 +381,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)while (parent) {if (!(parent->type &EEH_PE_INVALID ))break ; - parent->type &= ~(EEH_PE_INVALID |EEH_PE_KEEP ); + parent->type &= ~EEH_PE_INVALID ; parent = parent->parent; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/211 brcmsmac: AP mode: update beacon when TIM changes
In reply to Greg Kroah-HartmanFrom: Ali MJ Al-Nasrawy <[email protected]>
[ Upstream commit 2258ee58baa554609a3cc3996276e4276f537b6d ]
Beacons are not updated to reflect TIM changes. This is not compliant with power-saving client stations as the beacons do not have valid TIM and can cause the network to stall at random occasions and to have highly variable latencies.
Fix it by updating beacon templates on mac80211 set_tim callback.
Addresses an issue described in:
https://marc.info/?i=20180911163534.21312d08%20()%20manjaro
--- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 26 +++++++++++++++++++ .../broadcom/brcm80211/brcmsmac/main.h | 1 + 2 files changed, 27 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +26 -0
@@ -502,6 +502,7 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) }spin_lock_bh (&wl->lock); + wl->wlc->vif = vif; wl->mute_tx = false;brcms_c_mute (wl->wlc, false);if (vif->type ==NL80211_IFTYPE_STATION )
@@ -519,6 +520,11 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)static void brcms_ops_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { +struct brcms_info *wl = hw->priv; + +spin_lock_bh (&wl->lock); + wl->wlc->vif =NULL ; +spin_unlock_bh (&wl->lock); }static int brcms_ops_config (struct ieee80211_hw *hw,u32 changed)
@@ -937,6 +943,25 @@ static void brcms_ops_set_tsf(struct ieee80211_hw *hw,spin_unlock_bh (&wl->lock); } +static int brcms_ops_beacon_set_tim (struct ieee80211_hw *hw, +struct ieee80211_sta *sta,bool set) +{ +struct brcms_info *wl = hw->priv; +struct sk_buff *beacon =NULL ; +u16 tim_offset =0 ; + +spin_lock_bh (&wl->lock); +if (wl->wlc->vif) + beacon =ieee80211_beacon_get_tim (hw, wl->wlc->vif, + &tim_offset,NULL ); +if (beacon) +brcms_c_set_new_beacon (wl->wlc, beacon, tim_offset, + wl->wlc->vif->bss_conf.dtim_period); +spin_unlock_bh (&wl->lock); + +return 0 ; +} +static const struct ieee80211_ops brcms_ops = { .tx = brcms_ops_tx, .start = brcms_ops_start,
@@ -955,6 +980,7 @@ static const struct ieee80211_ops brcms_ops = { .flush = brcms_ops_flush, .get_tsf = brcms_ops_get_tsf, .set_tsf = brcms_ops_set_tsf, + .set_tim = brcms_ops_beacon_set_tim, };void brcms_dpc (unsigned long data)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h +1 -0
@@ -563,6 +563,7 @@ struct brcms_c_info {struct wiphy *wiphy;struct scb pri_scb; +struct ieee80211_vif *vif;struct sk_buff *beacon;u16 beacon_tim_offset;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/211 EDAC, thunderx: Fix memory leak in thunderx_l2c_threaded_isr()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d8c27ba86a2fd806d3957e5a9b30e66dfca2a61d ]
Fix memory leak in L2c threaded interrupt handler.
[ bp: Rewrite commit message. ]
--- drivers/edac/thunderx_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/thunderx_edac.c +2 -2
@@ -1905,7 +1905,7 @@ static irqreturn_t thunderx_l2c_threaded_isr(int irq, void *irq_id)default :dev_err (&l2c->pdev->dev,"Unsupported device: %04x\n" , l2c->pdev->device); -return IRQ_NONE ; + goto err_free; } while (CIRC_CNT(l2c->ring_head, l2c->ring_tail,
@@ -1927,7 +1927,7 @@ static irqreturn_t thunderx_l2c_threaded_isr(int irq, void *irq_id) l2c->ring_tail++; } -return IRQ_HANDLED ; + ret =IRQ_HANDLED ; err_free:kfree (other);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/211 ath10k: allocate small size dma memory in ath10k_pci_diag_write_mem
In reply to Greg Kroah-HartmanFrom: Carl Huang <[email protected]>
[ Upstream commit 0738b4998c6d1caf9ca2447b946709a7278c70f1 ]
ath10k_pci_diag_write_mem may allocate big size of the dma memory based on the parameter nbytes. Take firmware diag download as example, the biggest size is about 500K. In some systems, the allocation is likely to fail because it can't acquire such a large contiguous dma memory.
The fix is to allocate a small size dma memory. In the loop, driver copies the data to the allocated dma memory and writes to the destination until all the data is written.
Tested with QCA6174 PCI with firmware-6.bin_WLAN.RM.4.4.1-00119-QCARMSWP-1, this also affects QCA9377 PCI.
--- drivers/net/wireless/ath/ath10k/pci.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +11 -12
@@ -1039,10 +1039,9 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,struct ath10k_ce *ce =ath10k_ce_priv (ar);int ret =0 ;u32 *buf; -unsigned int completed_nbytes, orig_nbytes, remaining_bytes; +unsigned int completed_nbytes, alloc_nbytes, remaining_bytes;struct ath10k_ce_pipe *ce_diag;void *data_buf =NULL ; -u32 ce_data;/* Host buffer address in CE space */ dma_addr_t ce_data_base =0 ;int i;
@@ -1056,9 +1055,10 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,* 1) 4-byte alignment * 2) Buffer in DMA-able space */ - orig_nbytes = nbytes; + alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT); + data_buf = (unsigned char *)dma_alloc_coherent (ar->dev, - orig_nbytes, + alloc_nbytes, &ce_data_base,GFP_ATOMIC );if (!data_buf) {
@@ -1066,9 +1066,6 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, goto done; } -/* Copy caller's data to allocated DMA buf */ -memcpy (data_buf, data, orig_nbytes); -/* * The address supplied by the caller is in the * Target CPU virtual address space.
@@ -1081,12 +1078,14 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,*/ address =ath10k_pci_targ_cpu_to_ce_addr (ar, address); - remaining_bytes = orig_nbytes; - ce_data = ce_data_base; + remaining_bytes = nbytes;while (remaining_bytes) {/* FIXME: check cast */ nbytes =min_t (int, remaining_bytes,DIAG_TRANSFER_LIMIT ); +/* Copy caller's data to allocated DMA buf */ +memcpy (data_buf, data, nbytes); +/* Set up to receive directly into Target(!) address */ ret =__ath10k_ce_rx_post_buf (ce_diag, &address, address);if (ret !=0 )
@@ -1096,7 +1095,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,* Request CE to send caller-supplied data that * was copied to bounce buffer to Target(!) address. */ - ret =ath10k_ce_send_nolock (ce_diag,NULL , (u32 )ce_data, + ret =ath10k_ce_send_nolock (ce_diag,NULL , ce_data_base, nbytes,0 ,0 );if (ret !=0 ) goto done;
@@ -1137,12 +1136,12 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, remaining_bytes -= nbytes; address += nbytes; - ce_data += nbytes; + data += nbytes; } done:if (data_buf) { -dma_free_coherent (ar->dev, orig_nbytes, data_buf, +dma_free_coherent (ar->dev, alloc_nbytes, data_buf, ce_data_base); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/211 skd: fixup usage of legacy IO API
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 6d1f9dfde7343c4ebfb8f84dcb333af571bb3b22 ]
We need to be using the mq variant of request requeue here.
--- drivers/block/skd_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/skd_main.c +2 -2
@@ -1417,7 +1417,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,case SKD_CHECK_STATUS_BUSY_IMMINENT :skd_log_skreq (skdev, skreq,"retry(busy)" ); -blk_requeue_request (skdev->queue, req); +blk_mq_requeue_request (req, true);dev_info (&skdev->pdev->dev,"drive BUSY imminent\n" ); skdev->state =SKD_DRVR_STATE_BUSY_IMMINENT ; skdev->timer_countdown =SKD_TIMER_MINUTES (20 );
@@ -1427,7 +1427,7 @@ static void skd_resolve_req_exception(struct skd_device *skdev,case SKD_CHECK_STATUS_REQUEUE_REQUEST :if ((unsigned long ) ++req->special <SKD_MAX_RETRIES ) {skd_log_skreq (skdev, skreq,"retry" ); -blk_requeue_request (skdev->queue, req); +blk_mq_requeue_request (req, true);break ; }/* fall through */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/211 cdrom: dont attempt to fiddle with cdo->capability
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 8f94004e2a51a3ea195cf3447eb5d5906f36d8b3 ]
We can't modify cdo->capability as it is defined as a const. Change the modification hack to just WARN_ON_ONCE() if we hit any of the invalid combinations.
This fixes a regression for pcd, which doesn't work after the constify patch.
--- drivers/cdrom/cdrom.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/cdrom/cdrom.c +13 -14
@@ -410,10 +410,10 @@ static int cdrom_get_disc_info(struct cdrom_device_info *cdi,* hack to have the capability flags defined const, while we can still * change it here without gcc complaining at every line. */ -#define ENSURE (call, bits) \ -do { \ - if (cdo->call == NULL) \ - *change_capability &= ~(bits); \ +#define ENSURE (cdo, call, bits) \ +do { \ + if (cdo->call == NULL) \ + WARN_ON_ONCE((cdo)->capability & (bits)); \ } while (0)/*
@@ -589,7 +589,6 @@ int register_cdrom(struct cdrom_device_info *cdi) {static char banner_printed;const struct cdrom_device_ops *cdo = cdi->ops; -int *change_capability = (int *)&cdo->capability;/* hack */ cd_dbg (CD_OPEN ,"entering register_cdrom\n" );
@@ -601,16 +600,16 @@ int register_cdrom(struct cdrom_device_info *cdi)cdrom_sysctl_register (); } -ENSURE (drive_status,CDC_DRIVE_STATUS ); +ENSURE (cdo, drive_status,CDC_DRIVE_STATUS );if (cdo->check_events ==NULL && cdo->media_changed ==NULL ) - *change_capability = ~(CDC_MEDIA_CHANGED |CDC_SELECT_DISC ); -ENSURE (tray_move,CDC_CLOSE_TRAY |CDC_OPEN_TRAY ); -ENSURE (lock_door,CDC_LOCK ); -ENSURE (select_speed,CDC_SELECT_SPEED ); -ENSURE (get_last_session,CDC_MULTI_SESSION ); -ENSURE (get_mcn,CDC_MCN ); -ENSURE (reset,CDC_RESET ); -ENSURE (generic_packet,CDC_GENERIC_PACKET ); +WARN_ON_ONCE (cdo->capability & (CDC_MEDIA_CHANGED |CDC_SELECT_DISC )); +ENSURE (cdo, tray_move,CDC_CLOSE_TRAY |CDC_OPEN_TRAY ); +ENSURE (cdo, lock_door,CDC_LOCK ); +ENSURE (cdo, select_speed,CDC_SELECT_SPEED ); +ENSURE (cdo, get_last_session,CDC_MULTI_SESSION ); +ENSURE (cdo, get_mcn,CDC_MCN ); +ENSURE (cdo, reset,CDC_RESET ); +ENSURE (cdo, generic_packet,CDC_GENERIC_PACKET ); cdi->mc_flags =0 ; cdi->options =CDO_USE_FFLAGS ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/211 net/mlxfw: Verify FSM error code translation doesnt exceed array size
In reply to Greg Kroah-HartmanFrom: Eran Ben Elisha <[email protected]>
[ Upstream commit 30e9e0550bf693c94bc15827781fe42dd60be634 ]
Array mlxfw_fsm_state_err_str contains value to string translation, when values are provided by mlxfw_dev. If value is larger than MLXFW_FSM_STATE_ERR_MAX, return "unknown error" as expected instead of reading an address than exceed array size.
--- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +2 -0
@@ -86,6 +86,8 @@ retry:return err;if (fsm_state_err !=MLXFW_FSM_STATE_ERR_OK ) { + fsm_state_err = min_t(enum mlxfw_fsm_state_err, + fsm_state_err,MLXFW_FSM_STATE_ERR_MAX );pr_err ("Firmware flash failed: %s\n" , mlxfw_fsm_state_err_str[fsm_state_err]);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 32/211 mmc: mediatek: fix cannot receive new request when msdc_cmd_is_ready fail
In reply to Greg Kroah-HartmanFrom: Chaotian Jing <[email protected]>
[ Upstream commit f38a9774ddde9d79b3487dd888edd8b8623552af ]
when msdc_cmd_is_ready return fail, the req_timeout work has not been inited and cancel_delayed_work() will return false, then, the request return directly and never call mmc_request_done().
so need call mod_delayed_work() before msdc_cmd_is_ready()
--- drivers/mmc/host/mtk-sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mtk-sd.c +1 -1
@@ -885,6 +885,7 @@ static void msdc_start_command(struct msdc_host *host,WARN_ON (host->cmd); host->cmd = cmd; +mod_delayed_work (system_wq, &host->req_timeout,DAT_TIMEOUT );if (!msdc_cmd_is_ready (host, mrq, cmd))return ;
@@ -896,7 +897,6 @@ static void msdc_start_command(struct msdc_host *host, cmd->error =0 ; rawcmd =msdc_cmd_prepare_raw_cmd (host, mrq, cmd); -mod_delayed_work (system_wq, &host->req_timeout,DAT_TIMEOUT );sdr_set_bits (host->base +MSDC_INTEN , cmd_ints_mask);writel (cmd->arg, host->base +SDC_ARG );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/211 btrfs: handle error of get_old_root
In reply to Greg Kroah-HartmanFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 315bed43fea532650933e7bba316a7601d439edf ]
In btrfs_search_old_slot get_old_root is always used with the assumption it cannot fail. However, this is not true in rare circumstance it can fail and return null. This will lead to null point dereference when the header is read. Fix this by checking the return value and properly handling NULL by setting ret to -EIO and returning gracefully.
Coverity-id: 1087503
--- fs/btrfs/ctree.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/btrfs/ctree.c +4 -0
@@ -2988,6 +2988,10 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key, again: b =get_old_root (root, time_seq); +if (!b) { + ret = -EIO ; + goto done; + } level =btrfs_header_level (b); p->locks[level] =BTRFS_READ_LOCK ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/211 w1: IAD Register is yet readable trough iad sys file. Fix snprintf (%u for unsigned, count for max size).
In reply to Greg Kroah-HartmanFrom: Julien Folly <[email protected]>
[ Upstream commit 6eaafbb6998e999467cf78a76e155ee00e372b14 ]
IAD Register is yet readable trough the "iad" sys file.
A write to the "iad" sys file enables or disables the current measurement, but it was not possible to get the measured value by reading it.
Fix: %u in snprintf for unsigned values (vdd and vad)
Fix: Avoid possibles overflows (Usage of the 'count' variables)
--- drivers/w1/slaves/w1_ds2438.c | 66 +++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 14 deletions(-)
drivers/w1/slaves/w1_ds2438.c +52 -14
@@ -186,8 +186,8 @@ static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value)return -1 ; } -static uint16_t w1_ds2438_get_voltage (struct w1_slave *sl, -int adc_input,uint16_t *voltage) +static int w1_ds2438_get_voltage (struct w1_slave *sl, +int adc_input,uint16_t *voltage) {unsigned int retries =W1_DS2438_RETRIES ;u8 w1_buf[DS2438_PAGE_SIZE +1 /*for CRC*/ ];
@@ -235,6 +235,25 @@ static uint16_t w1_ds2438_get_voltage(struct w1_slave *sl,return ret; } +static int w1_ds2438_get_current (struct w1_slave *sl,int16_t *voltage) +{ +u8 w1_buf[DS2438_PAGE_SIZE +1 /*for CRC*/ ]; +int ret; + +mutex_lock (&sl->master->bus_mutex); + +if (w1_ds2438_get_page (sl,0 , w1_buf) ==0 ) { +/* The voltage measured across current sense resistor RSENS. */ + *voltage = (((int16_t ) w1_buf[DS2438_CURRENT_MSB ]) <<8 ) | ((int16_t ) w1_buf[DS2438_CURRENT_LSB ]); + ret =0 ; + }else + ret =-1 ; + +mutex_unlock (&sl->master->bus_mutex); + +return ret; +} +static ssize_t iad_write (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count)
@@ -257,6 +276,27 @@ static ssize_t iad_write(struct file *filp, struct kobject *kobj,return ret; } +static ssize_t iad_read (struct file *filp,struct kobject *kobj, +struct bin_attribute *bin_attr,char *buf, +loff_t off,size_t count) +{ +struct w1_slave *sl =kobj_to_w1_slave (kobj); +int ret; +int16_t voltage; + +if (off !=0 ) +return 0 ; +if (!buf) +return -EINVAL ; + +if (w1_ds2438_get_current (sl, &voltage) ==0 ) { + ret =snprintf (buf, count,"%i\n" , voltage); + }else + ret = -EIO ; + +return ret; +} +static ssize_t page0_read (struct file *filp,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t count)
@@ -272,9 +312,13 @@ static ssize_t page0_read(struct file *filp, struct kobject *kobj,mutex_lock (&sl->master->bus_mutex); +/* Read no more than page0 size */ +if (count >DS2438_PAGE_SIZE ) + count =DS2438_PAGE_SIZE ; +if (w1_ds2438_get_page (sl,0 , w1_buf) ==0 ) { -memcpy (buf, &w1_buf,DS2438_PAGE_SIZE ); - ret =DS2438_PAGE_SIZE ; +memcpy (buf, &w1_buf, count); + ret = count; }else ret = -EIO ;
@@ -289,7 +333,6 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;int16_t temp;if (off !=0 )
@@ -298,8 +341,7 @@ static ssize_t temperature_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_temperature (sl, &temp) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , temp); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%i\n" , temp); }else ret = -EIO ;
@@ -312,7 +354,6 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;uint16_t voltage;if (off !=0 )
@@ -321,8 +362,7 @@ static ssize_t vad_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_voltage (sl,DS2438_ADC_INPUT_VAD , &voltage) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , voltage); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%u\n" , voltage); }else ret = -EIO ;
@@ -335,7 +375,6 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj, {struct w1_slave *sl =kobj_to_w1_slave (kobj);int ret; -ssize_t c =PAGE_SIZE ;uint16_t voltage;if (off !=0 )
@@ -344,15 +383,14 @@ static ssize_t vdd_read(struct file *filp, struct kobject *kobj,return -EINVAL ;if (w1_ds2438_get_voltage (sl,DS2438_ADC_INPUT_VDD , &voltage) ==0 ) { - c -=snprintf (buf +PAGE_SIZE - c, c,"%d\n" , voltage); - ret =PAGE_SIZE - c; + ret =snprintf (buf, count,"%u\n" , voltage); }else ret = -EIO ;return ret; } -static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, NULL, iad_write, 1); +static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, iad_read, iad_write, 0); static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); static BIN_ATTR_RO(temperature, 0/* real length varies */); static BIN_ATTR_RO(vad, 0/* real length varies */);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/211 RDMA/bnxt_re: Fix qp async event reporting
In reply to Greg Kroah-HartmanFrom: Devesh Sharma <[email protected]>
[ Upstream commit 4c01f2e3a906a0d2d798be5751c331cf501bc129 ]
Reports affiliated async event on the qp-async event channel instead of global event channel.
--- drivers/infiniband/hw/bnxt_re/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +9 -4
@@ -782,12 +782,17 @@ static void bnxt_re_dispatch_event(struct ib_device *ibdev, struct ib_qp *qp,struct ib_event ib_event; ib_event.device = ibdev; -if (qp) +if (qp) { ib_event.element.qp = qp; -else + ib_event.event = event; +if (qp->event_handler) + qp->event_handler (&ib_event, qp->qp_context); + + }else { ib_event.element.port_num = port_num; - ib_event.event = event; -ib_dispatch_event (&ib_event); + ib_event.event = event; +ib_dispatch_event (&ib_event); + } }#define HWRM_QUEUE_PRI2COS_QCFG_INPUT_FLAGS_IVLAN 0x02
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/211 pinctrl: sunxi: Fix a memory leak in sunxi_pinctrl_build_state()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a93a676b079144009f55fff2ab0e34c3b7258c8a ]
If 'krealloc()' fails, 'pctl->functions' is set to NULL. We should instead use a temp variable in order to be able to free the previously allocated memeory, in case of OOM.
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +7 -4
@@ -1039,6 +1039,7 @@ static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl,static int sunxi_pinctrl_build_state (struct platform_device *pdev) {struct sunxi_pinctrl *pctl =platform_get_drvdata (pdev); +void *ptr;int i;/*
@@ -1105,13 +1106,15 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) }/* And now allocated and fill the array for real */ - pctl->functions =krealloc (pctl->functions, - pctl->nfunctions *sizeof (*pctl->functions), -GFP_KERNEL ); -if (!pctl->functions) { + ptr =krealloc (pctl->functions, + pctl->nfunctions *sizeof (*pctl->functions), +GFP_KERNEL ); +if (!ptr) {kfree (pctl->functions); + pctl->functions =NULL ;return -ENOMEM ; } + pctl->functions = ptr;for (i =0 ; i < pctl->desc->npins; i++) {const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/211 pwm: lpss: Only set update bit if we are actually changing the settings
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2153bbc12f77fb2203276befc0f0dddbfb023bb1 ]
According to the datasheet the update bit must be set if the on-time-div or the base-unit changes.
Now that we properly order device resume on Cherry Trail so that the GFX0 _PS0 method no longer exits with an error, we end up with a sequence of events where we are writing the same values twice in a row.
First the _PS0 method restores the duty cycle of 0% the GPU driver set on suspend and then the GPU driver first updates just the enabled bit in the pwm_state from 0 to 1, causing us to write the same values again, before restoring the pre-suspend duty-cycle in a separate pwm_apply call.
When writing the update bit the second time, without changing any of the values the update bit clears immediately / instantly, instead of staying 1 for a while as usual. After this the next setting of the update bit seems to be ignored, causing the restoring of the pre-suspend duty-cycle to not get applied. This makes the backlight come up with a 0% dutycycle after suspend/resume.
Any further brightness changes after this do work.
This commit moves the setting of the update bit into pwm_lpss_prepare() and only sets the bit if we have actually changed any of the values.
This avoids the setting of the update bit the second time we configure the PWM to 0% dutycycle, this fixes the backlight coming up with 0% duty-cycle after a suspend/resume.
--- drivers/pwm/pwm-lpss.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/pwm/pwm-lpss.c +7 -5
@@ -97,7 +97,7 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm,unsigned long long on_time_div;unsigned long c = lpwm->info->clk_rate, base_unit_range;unsigned long long base_unit, freq =NSEC_PER_SEC ; -u32 ctrl; +u32 orig_ctrl, ctrl;do_div (freq, period_ns);
@@ -114,13 +114,17 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm,do_div (on_time_div, period_ns); on_time_div =255ULL - on_time_div; - ctrl =pwm_lpss_read (pwm); + orig_ctrl = ctrl =pwm_lpss_read (pwm); ctrl &= ~PWM_ON_TIME_DIV_MASK ; ctrl &= ~(base_unit_range <<PWM_BASE_UNIT_SHIFT ); base_unit &= base_unit_range; ctrl |= (u32 ) base_unit <<PWM_BASE_UNIT_SHIFT ; ctrl |= on_time_div; -pwm_lpss_write (pwm, ctrl); + +if (orig_ctrl != ctrl) { +pwm_lpss_write (pwm, ctrl); +pwm_lpss_write (pwm, ctrl |PWM_SW_UPDATE ); + } }static inline void pwm_lpss_cond_enable (struct pwm_device *pwm,bool cond)
@@ -144,7 +148,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm,return ret; }pwm_lpss_prepare (lpwm, pwm, state->duty_cycle, state->period); -pwm_lpss_write (pwm,pwm_lpss_read (pwm) |PWM_SW_UPDATE );pwm_lpss_cond_enable (pwm, lpwm->info->bypass == false); ret =pwm_lpss_wait_for_update (pwm);if (ret) {
@@ -157,7 +160,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm,if (ret)return ret;pwm_lpss_prepare (lpwm, pwm, state->duty_cycle, state->period); -pwm_lpss_write (pwm,pwm_lpss_read (pwm) |PWM_SW_UPDATE );return pwm_lpss_wait_for_update (pwm); } }else if (pwm_is_enabled (pwm)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/211 net/sched: act_pedit: fix WARN() in the traffic path
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit f67169fef8dbcc1ac6a6a109ecaad0d3b259002c ]
when configuring act_pedit rules, the number of keys is validated only on addition of a new entry. This is not sufficient to avoid hitting a WARN() in the traffic path: for example, it is possible to replace a valid entry with a new one having 0 extended keys, thus causing splats in dmesg like:
pedit BUG: index 42
WARNING: CPU: 2 PID: 4054 at net/sched/act_pedit.c:410 tcf_pedit_act+0xc84/0x1200 [act_pedit] [...] RIP: 0010:tcf_pedit_act+0xc84/0x1200 [act_pedit] Code: 89 fa 48 c1 ea 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e ac 00 00 00 48 8b 44 24 10 48 c7 c7 a0 c4 e4 c0 8b 70 18 e8 1c 30 95 ea <0f> 0b e9 a0 fa ff ff e8 00 03 f5 ea e9 14 f4 ff ff 48 89 58 40 e9 RSP: 0018:ffff888077c9f320 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffffac2983a2 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff888053927bec RBP: dffffc0000000000 R08: ffffed100a726209 R09: ffffed100a726209 R10: 0000000000000001 R11: ffffed100a726208 R12: ffff88804beea780 R13: ffff888079a77400 R14: ffff88804beea780 R15: ffff888027ab2000 FS: 00007fdeec9bd740(0000) GS:ffff888053900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffdb3dfd000 CR3: 000000004adb4006 CR4: 00000000001606e0 Call Trace: tcf_action_exec+0x105/0x3f0 tcf_classify+0xf2/0x410 __dev_queue_xmit+0xcbf/0x2ae0 ip_finish_output2+0x711/0x1fb0 ip_output+0x1bf/0x4b0 ip_send_skb+0x37/0xa0 raw_sendmsg+0x180c/0x2430 sock_sendmsg+0xdb/0x110 __sys_sendto+0x257/0x2b0 __x64_sys_sendto+0xdd/0x1b0 do_syscall_64+0xa5/0x4e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fdeeb72e993 Code: 48 8b 0d e0 74 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 0d d6 2c 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 4b cc 00 00 48 89 04 24 RSP: 002b:00007ffdb3de8a18 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 000055c81972b700 RCX: 00007fdeeb72e993 RDX: 0000000000000040 RSI: 000055c81972b700 RDI: 0000000000000003 RBP: 00007ffdb3dea130 R08: 000055c819728510 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000040 R13: 000055c81972b6c0 R14: 000055c81972969c R15: 0000000000000080
Fix this moving the check on 'nkeys' earlier in tcf_pedit_init(), so that attempts to install rules having 0 keys are always rejected with -EINVAL.
--- net/sched/act_pedit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/sched/act_pedit.c +4 -3
@@ -46,7 +46,7 @@ static struct tcf_pedit_key_ex *tcf_pediint err = -EINVAL ;int rem; -if (!nla || !n) +if (!nla)return NULL ; keys_ex =kcalloc (n,sizeof (*k),GFP_KERNEL );
@@ -163,6 +163,9 @@ static int tcf_pedit_init(struct net *nereturn -EINVAL ; parm =nla_data (pattr); +if (!parm->nkeys) +return -EINVAL ; + ksize = parm->nkeys *sizeof (struct tc_pedit_key );if (nla_len (pattr) <sizeof (*parm) + ksize)return -EINVAL ;
@@ -172,8 +175,6 @@ static int tcf_pedit_init(struct net *nereturn PTR_ERR (keys_ex);if (!tcf_idr_check (tn, parm->index, a, bind)) { -if (!parm->nkeys) -return -EINVAL ; ret =tcf_idr_create (tn, parm->index, est, a, &act_pedit_ops, bind, false);if (ret)
Greg Kroah-Hartman
maintainerPATCH 41/211 amiflop: clean up on errors during setup
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 53d0f8dbde89cf6c862c7a62e00c6123e02cba41 ]
The error handling in fd_probe_drives() doesn't clean up at all. Fix it up in preparation for converting to blk-mq. While we're here, get rid of the commented out amiga_floppy_remove().
--- drivers/block/amiflop.c | 84 ++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 44 deletions(-)
drivers/block/amiflop.c +40 -44
@@ -1699,11 +1699,41 @@ static const struct block_device_operations floppy_fops = { .check_events = amiga_check_events, }; +static struct gendisk *fd_alloc_disk (int drive) +{ +struct gendisk *disk; + + disk =alloc_disk (1 ); +if (!disk) + goto out; + + disk->queue =blk_init_queue (do_fd_request, &amiflop_lock); +if (IS_ERR (disk->queue)) { + disk->queue =NULL ; + goto out_put_disk; + } + + unit[drive].trackbuf =kmalloc (FLOPPY_MAX_SECTORS *512 ,GFP_KERNEL ); +if (!unit[drive].trackbuf) + goto out_cleanup_queue; + +return disk; + +out_cleanup_queue: +blk_cleanup_queue (disk->queue); + disk->queue =NULL ; +out_put_disk: +put_disk (disk); +out: + unit[drive].type->code =FD_NODRIVE ; +return NULL ; +} +static int __init fd_probe_drives (void ) {int drive,drives,nomem; -printk (KERN_INFO "FD: probing units\nfound " ); +pr_info ("FD: probing units\nfound" ); drives=0 ; nomem=0 ;for (drive=0 ;drive<FD_MAX_UNITS ;drive++) {
@@ -1711,27 +1741,17 @@ static int __init fd_probe_drives(void)fd_probe (drive);if (unit[drive].type->code ==FD_NODRIVE )continue ; - disk =alloc_disk (1 ); + + disk =fd_alloc_disk (drive);if (!disk) { - unit[drive].type->code =FD_NODRIVE ; +pr_cont (" no mem for fd%d" , drive); + nomem =1 ;continue ; } unit[drive].gendisk = disk; - - disk->queue =blk_init_queue (do_fd_request, &amiflop_lock); -if (!disk->queue) { - unit[drive].type->code =FD_NODRIVE ; -continue ; - } - drives++; -if ((unit[drive].trackbuf =kmalloc (FLOPPY_MAX_SECTORS *512 ,GFP_KERNEL )) ==NULL ) { -printk ("no mem for " ); - unit[drive].type = &drive_types[num_dr_types -1 ];/* FD_NODRIVE */ - drives--; - nomem =1 ; - } -printk ("fd%d " ,drive); + +pr_cont (" fd%d" ,drive); disk->major =FLOPPY_MAJOR ; disk->first_minor = drive; disk->fops = &floppy_fops;
@@ -1742,11 +1762,11 @@ static int __init fd_probe_drives(void) }if ((drives >0 ) || (nomem ==0 )) {if (drives ==0 ) -printk ("no drives" ); -printk ("\n" ); +pr_cont (" no drives" ); +pr_cont ("\n" );return drives; } -printk ("\n" ); +pr_cont ("\n" );return -ENOMEM ; }
@@ -1837,30 +1857,6 @@ static int __init amiga_floppy_probe(struct platform_device *pdev)return ret; } -#if 0 /* not safe to unload */ -static int __exit amiga_floppy_remove(struct platform_device *pdev) -{ -int i; - -for ( i =0 ; i <FD_MAX_UNITS ; i++) { -if (unit[i].type->code !=FD_NODRIVE ) { -struct request_queue *q = unit[i].gendisk->queue; -del_gendisk (unit[i].gendisk); -put_disk (unit[i].gendisk); -kfree (unit[i].trackbuf); -if (q) -blk_cleanup_queue (q); - } - } -blk_unregister_region (MKDEV (FLOPPY_MAJOR ,0 ),256 ); -free_irq (IRQ_AMIGA_CIAA_TB ,NULL ); -free_irq (IRQ_AMIGA_DSKBLK ,NULL ); - custom.dmacon =DMAF_DISK ;/* disable DMA */ -amiga_chip_free (raw_buf); -unregister_blkdev (FLOPPY_MAJOR ,"fd" ); -} -#endif -static struct platform_driver amiga_floppy_driver = { .driver = { .name ="amiga-floppy" ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/211 qed: Align local and global PTT to propagate through the APIs.
In reply to Greg Kroah-HartmanFrom: Rahul Verma <[email protected]>
[ Upstream commit 706d08913d1f68610c32b4a001026aa989878dd9 ]
Align the use of local PTT to propagate through the qed_mcp* API's. Global ptt should not be used.
Register access should be done through layers. Register address is mapped into a PTT, PF translation table. Several interface functions require a PTT to direct read/write into register. There is a pool of PTT maintained, and several PTT are used simultaneously to access device registers in different flows. Same PTT should not be used in flows that can run concurrently.
To avoid running out of PTT resources, too many PTT should not be acquired without releasing them. Every PF has a global PTT, which is used throughout the life of PF, in most important flows for register access. Generic functions acquire the PTT locally and release after the use. This patch aligns the use of Global PTT and Local PTT accordingly.
--- drivers/net/ethernet/qlogic/qed/qed.h | 2 +- drivers/net/ethernet/qlogic/qed/qed_main.c | 22 ++++++++++++++---- drivers/net/ethernet/qlogic/qed/qed_mcp.c | 27 ++++++++++------------ drivers/net/ethernet/qlogic/qed/qed_mcp.h | 5 ++-- drivers/net/ethernet/qlogic/qed/qed_vf.c | 2 +- 5 files changed, 35 insertions(+), 23 deletions(-)
drivers/net/ethernet/qlogic/qed/qed.h +1 -1
@@ -829,7 +829,7 @@ u16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf);/* Prototypes */ int qed_fill_dev_info (struct qed_dev *cdev,struct qed_dev_info *dev_info); -void qed_link_update (struct qed_hwfn *hwfn); +void qed_link_update (struct qed_hwfn *hwfn,struct qed_ptt *ptt);u32 qed_unzip_data (struct qed_hwfn *p_hwfn,u32 input_len,u8 *input_buf,u32 max_size,u8 *unzip_buf);
drivers/net/ethernet/qlogic/qed/qed_main.c +18 -4
@@ -1389,6 +1389,7 @@ static int qed_get_link_data(struct qed_hwfn *hwfn, }static void qed_fill_link (struct qed_hwfn *hwfn, +struct qed_ptt *ptt,struct qed_link_output *if_link) {struct qed_mcp_link_params params;
@@ -1469,7 +1470,7 @@ static void qed_fill_link(struct qed_hwfn *hwfn,/* TODO - fill duplex properly */ if_link->duplex =DUPLEX_FULL ; -qed_mcp_get_media_type (hwfn->cdev, &media_type); +qed_mcp_get_media_type (hwfn, ptt, &media_type); if_link->port =qed_get_port_type (media_type); if_link->autoneg = params.speed.autoneg;
@@ -1525,21 +1526,34 @@ static void qed_fill_link(struct qed_hwfn *hwfn,static void qed_get_current_link (struct qed_dev *cdev,struct qed_link_output *if_link) { +struct qed_hwfn *hwfn; +struct qed_ptt *ptt;int i; -qed_fill_link (&cdev->hwfns[0 ], if_link); + hwfn = &cdev->hwfns[0 ]; +if (IS_PF (cdev)) { + ptt =qed_ptt_acquire (hwfn); +if (ptt) { +qed_fill_link (hwfn, ptt, if_link); +qed_ptt_release (hwfn, ptt); + }else { +DP_NOTICE (hwfn,"Failed to fill link; No PTT\n" ); + } + }else { +qed_fill_link (hwfn,NULL , if_link); + }for_each_hwfn (cdev, i)qed_inform_vf_link_state (&cdev->hwfns[i]); } -void qed_link_update (struct qed_hwfn *hwfn) +void qed_link_update (struct qed_hwfn *hwfn,struct qed_ptt *ptt) {void *cookie = hwfn->cdev->ops_cookie;struct qed_common_cb_ops *op = hwfn->cdev->protocol_ops.common;struct qed_link_output if_link; -qed_fill_link (hwfn, &if_link); +qed_fill_link (hwfn, ptt, &if_link);qed_inform_vf_link_state (hwfn);if (IS_LEAD_HWFN (hwfn) && cookie)
drivers/net/ethernet/qlogic/qed/qed_mcp.c +12 -15
@@ -1352,7 +1352,7 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,if (p_hwfn->mcp_info->capabilities &FW_MB_PARAM_FEATURE_SUPPORT_EEE )qed_mcp_read_eee_config (p_hwfn, p_ptt, p_link); -qed_link_update (p_hwfn); +qed_link_update (p_hwfn, p_ptt); out:spin_unlock_bh (&p_hwfn->mcp_info->link_lock); }
@@ -1722,12 +1722,10 @@ int qed_mcp_get_mbi_ver(struct qed_hwfn *p_hwfn,return 0 ; } -int qed_mcp_get_media_type (struct qed_dev *cdev,u32 *p_media_type) +int qed_mcp_get_media_type (struct qed_hwfn *p_hwfn, +struct qed_ptt *p_ptt,u32 *p_media_type) { -struct qed_hwfn *p_hwfn = &cdev->hwfns[0 ]; -struct qed_ptt *p_ptt; - -if (IS_VF (cdev)) +if (IS_VF (p_hwfn->cdev))return -EINVAL ;if (!qed_mcp_is_init (p_hwfn)) {
@@ -1735,16 +1733,15 @@ int qed_mcp_get_media_type(struct qed_dev *cdev, u32 *p_media_type)return -EBUSY ; } - *p_media_type =MEDIA_UNSPECIFIED ; - - p_ptt =qed_ptt_acquire (p_hwfn); -if (!p_ptt) -return -EBUSY ; - - *p_media_type =qed_rd (p_hwfn, p_ptt, p_hwfn->mcp_info->port_addr + - offsetof(struct public_port , media_type)); +if (!p_ptt) { + *p_media_type =MEDIA_UNSPECIFIED ; +return -EINVAL ; + } -qed_ptt_release (p_hwfn, p_ptt); + *p_media_type =qed_rd (p_hwfn, p_ptt, + p_hwfn->mcp_info->port_addr + + offsetof(struct public_port , + media_type));return 0 ; }
drivers/net/ethernet/qlogic/qed/qed_mcp.h +3 -2
@@ -284,14 +284,15 @@ int qed_mcp_get_mbi_ver(struct qed_hwfn *p_hwfn,* @brief Get media type value of the port. * * @param cdev - qed dev pointer +* @param p_ptt * @param mfw_ver - media type value * * @return int - * 0 - Operation was successul. * -EBUSY - Operation failed */ -int qed_mcp_get_media_type (struct qed_dev *cdev, -u32 *media_type); +int qed_mcp_get_media_type (struct qed_hwfn *p_hwfn, +struct qed_ptt *p_ptt,u32 *media_type);/** * @brief General function for sending commands to the MCP
drivers/net/ethernet/qlogic/qed/qed_vf.c +1 -1
@@ -1669,7 +1669,7 @@ static void qed_handle_bulletin_change(struct qed_hwfn *hwfn) ops->ports_update (cookie, vxlan_port, geneve_port);/* Always update link configuration according to bulletin */ -qed_link_update (hwfn); +qed_link_update (hwfn,NULL ); }void qed_iov_vf_task (struct work_struct *work)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/211 KVM/x86: Fix invvpid and invept register operand size in 64-bit mode
In reply to Greg Kroah-HartmanFrom: Uros Bizjak <[email protected]>
[ Upstream commit 5ebb272b2ea7e02911a03a893f8d922d49f9bb4a ]
Register operand size of invvpid and invept instruction in 64-bit mode has always 64 bits. Adjust inline function argument type to reflect correct size.
--- arch/x86/kvm/vmx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +2 -2
@@ -1602,7 +1602,7 @@ static int __find_msr_index(struct vcpu_vmx *vmx, u32 msr)return -1 ; } -static inline void __invvpid (int ext,u16 vpid,gva_t gva) +static inline void __invvpid (unsigned long ext,u16 vpid,gva_t gva) {struct {u64 vpid :16 ;
@@ -1616,7 +1616,7 @@ static inline void __invvpid(int ext, u16 vpid, gva_t gva) : : "a"(&operand), "c"(ext) : "cc", "memory"); } -static inline void __invept (int ext,u64 eptp,gpa_t gpa) +static inline void __invept (unsigned long ext,u64 eptp,gpa_t gpa) {struct {u64 eptp, gpa;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/211 KVM: nVMX: reset cache/shadows when switching loaded VMCS
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit b7031fd40fcc741b0f9b0c04c8d844e445858b84 ]
Reset the vm_{entry,exit}_controls_shadow variables as well as the segment cache after loading a new VMCS in vmx_switch_vmcs(). The shadows/cache track VMCS data, i.e. they're stale every time we switch to a new VMCS regardless of reason.
This fixes a bug where stale control shadows would be consumed after a nested VMExit due to a failed consistency check.
--- arch/x86/kvm/vmx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx.c +4 -4
@@ -10000,6 +10000,10 @@ static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs)vmx_vcpu_load (vcpu, cpu); vcpu->cpu = cpu;put_cpu (); + +vm_entry_controls_reset_shadow (vmx); +vm_exit_controls_reset_shadow (vmx); +vmx_segment_cache_clear (vmx); }/*
@@ -11428,7 +11432,6 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) vmx->nested.vmcs01_debugctl =vmcs_read64 (GUEST_IA32_DEBUGCTL );vmx_switch_vmcs (vcpu, &vmx->nested.vmcs02); -vmx_segment_cache_clear (vmx);if (prepare_vmcs02 (vcpu, vmcs12, from_vmentry, &exit_qual)) {leave_guest_mode (vcpu);
@@ -12172,9 +12175,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, }vmx_switch_vmcs (vcpu, &vmx->vmcs01); -vm_entry_controls_reset_shadow (vmx); -vm_exit_controls_reset_shadow (vmx); -vmx_segment_cache_clear (vmx);/* Update any VMCS fields that might have changed while L2 ran */ vmcs_write32 (VM_EXIT_MSR_LOAD_COUNT , vmx->msr_autoload.host.nr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/211 gpio: max77620: Fixup debounce delays
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
commit b0391479ae04dfcbd208b9571c375064caad9a57 upstream.
When converting milliseconds to microseconds in commit fffa6af94894 ("gpio: max77620: Use correct unit for debounce times") some ~1 ms gaps were introduced between the various ranges supported by the controller. Fix this by changing the start of each range to the value immediately following the end of the previous range. This way a debounce time of, say 8250 us will translate into 16 ms instead of returning an -EINVAL error.
Typically the debounce delay is only ever set through device tree and specified in milliseconds, so we can never really hit this issue because debounce times are always a multiple of 1000 us.
The only notable exception for this is drivers/mmc/host/mmc-spi.c where the CD GPIO is requested, which passes a 1 us debounce time. According to a comment preceeding that code this should actually be 1 ms (i.e. 1000 us).
--- drivers/gpio/gpio-max77620.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-max77620.c +3 -3
@@ -163,13 +163,13 @@ static int max77620_gpio_set_debounce(stcase 0 : val = MAX77620_CNFG_GPIO_DBNC_None;break ; - case 1000 ... 8000: + case 1 ... 8000: val = MAX77620_CNFG_GPIO_DBNC_8ms;break ; - case 9000 ... 16000: + case 8001 ... 16000: val = MAX77620_CNFG_GPIO_DBNC_16ms;break ; - case 17000 ... 32000: + case 16001 ... 32000: val = MAX77620_CNFG_GPIO_DBNC_32ms;break ;default :
Greg Kroah-Hartman
maintainerPATCH 9/211 tools: gpio: Correctly add make dependencies for gpio_utils
In reply to Greg Kroah-HartmanFrom: Laura Abbott <[email protected]>
commit 0161a94e2d1c713bd34d72bc0239d87c31747bf7 upstream.
gpio tools fail to build correctly with make parallelization:
$ make -s -j24 ld: gpio-utils.o: file not recognized: file truncated make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:145: lsgpio-in.o] Error 1 make: *** [Makefile:43: lsgpio-in.o] Error 2 make: *** Waiting for unfinished jobs....
This is because gpio-utils.o is used across multiple targets. Fix this by making gpio-utios.o a proper dependency.
--- tools/gpio/Build | 1 + tools/gpio/Makefile | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
tools/gpio/Build +1 -0
@@ -1,3 +1,4 @@ +gpio-utils-y += gpio-utils.o lsgpio-y += lsgpio.o gpio-utils.o gpio-hammer-y += gpio-hammer.o gpio-utils.o gpio-event-mon-y += gpio-event-mon.o gpio-utils.o
tools/gpio/Makefile +7 -3
@@ -35,11 +35,15 @@ $(OUTPUT)include/linux/gpio.h: ../../inc prepare: $(OUTPUT)include/linux/gpio.h +GPIO_UTILS_IN := $(output)gpio-utils-in.o +$(GPIO_UTILS_IN): prepare FORCE + $(Q)$(MAKE) $(build)=gpio-utils + # # lsgpio # LSGPIO_IN := $(OUTPUT)lsgpio-in.o -$(LSGPIO_IN): prepare FORCE +$(LSGPIO_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=lsgpio $(OUTPUT)lsgpio: $(LSGPIO_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -48,7 +52,7 @@ $(OUTPUT)lsgpio: $(LSGPIO_IN) # gpio-hammer # GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o -$(GPIO_HAMMER_IN): prepare FORCE +$(GPIO_HAMMER_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=gpio-hammer $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
@@ -57,7 +61,7 @@ $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) # gpio-event-mon # GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o -$(GPIO_EVENT_MON_IN): prepare FORCE +$(GPIO_EVENT_MON_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o $(Q)$(MAKE) $(build)=gpio-event-mon $(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN) $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
Greg Kroah-Hartman
maintainerPATCH 10/211 nbd:fix memory leak in nbd_get_socket()
In reply to Greg Kroah-HartmanFrom: Sun Ke <[email protected]>
commit dff10bbea4be47bdb615b036c834a275b7c68133 upstream.
Before returning NULL, put the sock first.
--- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/nbd.c +1 -0
@@ -931,6 +931,7 @@ static struct socket *nbd_get_socket(strif (sock->ops->shutdown == sock_no_shutdown) {dev_err (disk_to_dev (nbd->disk),"Unsupported socket: shutdown callout must be supported.\n" ); *err = -EINVAL ; +sockfd_put (sock);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 11/211 virtio_console: allocate inbufs in add_port() only if it is needed
In reply to Greg Kroah-HartmanFrom: Laurent Vivier <[email protected]>
commit d791cfcbf98191122af70b053a21075cb450d119 upstream.
When we hot unplug a virtserialport and then try to hot plug again, it fails:
(qemu) chardev-add socket,id=serial0,path=/tmp/serial0,server,nowait (qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
chardev=serial0,id=serial0,name=serial0
(qemu) device_del serial0
(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
chardev=serial0,id=serial0,name=serial0
kernel error:
virtio-ports vport2p2: Error allocating inbufs
qemu error:
virtio-serial-bus: Guest failure in adding port 2 for device \
virtio-serial0.0
This happens because buffers for the in_vq are allocated when the port is added but are not released when the port is unplugged.
They are only released when virtconsole is removed (see a7a69ec0d8e4)
To avoid the problem and to be symmetric, we could allocate all the buffers in init_vqs() as they are released in remove_vqs(), but it sounds like a waste of memory.
Rather than that, this patch changes add_port() logic to ignore ENOSPC error in fill_queue(), which means queue has already been filled.
--- drivers/char/virtio_console.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/char/virtio_console.c +13 -15
@@ -1366,24 +1366,24 @@ static void set_console_size(struct port port->cons.ws.ws_col = cols; } -static unsigned int fill_queue (struct virtqueue *vq,spinlock_t *lock) +static int fill_queue (struct virtqueue *vq,spinlock_t *lock) {struct port_buffer *buf; -unsigned int nr_added_bufs; +int nr_added_bufs;int ret; nr_added_bufs =0 ; do { buf = alloc_buf(vq->vdev, PAGE_SIZE, 0); if (!buf) - break; + return -ENOMEM; spin_lock_irq(lock); ret = add_inbuf(vq, buf); if (ret < 0) { spin_unlock_irq(lock); free_buf(buf, true); - break; + return ret; } nr_added_bufs++; spin_unlock_irq(lock);
@@ -1403,7 +1403,6 @@ static int add_port(struct ports_devicechar debugfs_name[16 ];struct port *port;dev_t devt; -unsigned int nr_added_bufs;int err; port =kmalloc (sizeof (*port),GFP_KERNEL );
@@ -1462,11 +1461,13 @@ static int add_port(struct ports_devicespin_lock_init (&port->outvq_lock);init_waitqueue_head (&port->waitqueue); -/* Fill the in_vq with buffers so the host can send us data. */ - nr_added_bufs =fill_queue (port->in_vq, &port->inbuf_lock); -if (!nr_added_bufs) { +/* We can safely ignore ENOSPC because it means +* the queue already has buffers. Buffers are removed +* only by virtcons_remove(), not by unplug_port() +*/ + err =fill_queue (port->in_vq, &port->inbuf_lock); +if (err <0 && err != -ENOSPC ) {dev_err (port->dev,"Error allocating inbufs\n" ); - err = -ENOMEM ; goto free_device; }
@@ -2099,14 +2100,11 @@ static int virtcons_probe(struct virtio_INIT_WORK (&portdev->control_work, &control_work_handler);if (multiport) { -unsigned int nr_added_bufs; -spin_lock_init (&portdev->c_ivq_lock);spin_lock_init (&portdev->c_ovq_lock); - nr_added_bufs =fill_queue (portdev->c_ivq, - &portdev->c_ivq_lock); -if (!nr_added_bufs) { + err =fill_queue (portdev->c_ivq, &portdev->c_ivq_lock); +if (err <0 ) {dev_err (&vdev->dev,"Error allocating buffers for control queue\n" );/*
@@ -2117,7 +2115,7 @@ static int virtcons_probe(struct virtio_ VIRTIO_CONSOLE_DEVICE_READY, 0);/* Device was functional: we need full cleanup. */ virtcons_remove (vdev); -return -ENOMEM ; +return err; } }else {/*
Greg Kroah-Hartman
maintainerPATCH 2/211 net: rtnetlink: prevent underflows in do_setvfinfo()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d658c8f56ec7b3de8051a24afb25da9ba3c388c5 ]
The "ivm->vf" variable is a u32, but the problem is that a number of drivers cast it to an int and then forget to check for negatives. An example of this is in the cxgb4 driver.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
2890 static int cxgb4_mgmt_get_vf_config(struct net_device *dev,
2891 int vf, struct ifla_vf_info *ivi)
^^^^^^
2892 {
2893 struct port_info *pi = netdev_priv(dev);
2894 struct adapter *adap = pi->adapter;
2895 struct vf_info *vfinfo;
2896
2897 if (vf >= adap->num_vfs)
^^^^^^^^^^^^^^^^^^^
2898 return -EINVAL;
2899 vfinfo = &adap->vfinfo[vf];
^^^^^^^^^^^^^^^^^^^^^^^^^^There are 48 functions affected.
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:8435 hclge_set_vf_vlan_filter() warn: can 'vfid' underflow 's32min-2147483646' drivers/net/ethernet/freescale/enetc/enetc_pf.c:377 enetc_pf_set_vf_mac() warn: can 'vf' underflow 's32min-2147483646' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:2899 cxgb4_mgmt_get_vf_config() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:2960 cxgb4_mgmt_set_vf_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3019 cxgb4_mgmt_set_vf_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3038 cxgb4_mgmt_set_vf_vlan() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:3086 cxgb4_mgmt_set_vf_link_state() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/chelsio/cxgb/cxgb2.c:791 get_eeprom() warn: can 'i' underflow 's32min-(-4),0,4-s32max' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:82 bnxt_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:164 bnxt_set_vf_trust() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:186 bnxt_get_vf_config() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:228 bnxt_set_vf_mac() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:264 bnxt_set_vf_vlan() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:293 bnxt_set_vf_bw() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:333 bnxt_set_vf_link_state() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:2595 bnx2x_vf_op_prep() warn: can 'vfidx' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:2595 bnx2x_vf_op_prep() warn: can 'vfidx' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2281 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2285 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2286 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2292 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c:2297 bnx2x_post_vf_bulletin() warn: can 'vf' underflow 's32min-63' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1832 qlcnic_sriov_set_vf_mac() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1864 qlcnic_sriov_set_vf_tx_rate() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:1937 qlcnic_sriov_set_vf_vlan() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:2005 qlcnic_sriov_get_vf_config() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c:2036 qlcnic_sriov_set_vf_spoofchk() warn: can 'vf' underflow 's32min-254' drivers/net/ethernet/emulex/benet/be_main.c:1914 be_get_vf_config() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1915 be_get_vf_config() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1922 be_set_vf_tvt() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:1951 be_clear_vf_tvt() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:2063 be_set_vf_tx_rate() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/emulex/benet/be_main.c:2091 be_set_vf_link_state() warn: can 'vf' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:2609 ice_set_vf_port_vlan() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3050 ice_get_vf_cfg() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3103 ice_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3181 ice_set_vf_mac() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3237 ice_set_vf_trust() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c:3286 ice_set_vf_link_state() warn: can 'vf_id' underflow 's32min-65534' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:3919 i40e_validate_vf() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:3957 i40e_ndo_set_vf_mac() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4104 i40e_ndo_set_vf_port_vlan() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4263 i40e_ndo_set_vf_bw() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4309 i40e_ndo_get_vf_config() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4371 i40e_ndo_set_vf_link_state() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4441 i40e_ndo_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4441 i40e_ndo_set_vf_spoofchk() warn: can 'vf_id' underflow 's32min-2147483646' drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:4504 i40e_ndo_set_vf_trust() warn: can 'vf_id' underflow 's32min-2147483646'
--- net/core/rtnetlink.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +22 -1
@@ -1767,6 +1767,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_MAC ]) {struct ifla_vf_mac *ivm =nla_data (tb[IFLA_VF_MAC ]); +if (ivm->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_mac) err = ops->ndo_set_vf_mac(dev, ivm->vf,
@@ -1778,6 +1780,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_VLAN ]) {struct ifla_vf_vlan *ivv =nla_data (tb[IFLA_VF_VLAN ]); +if (ivv->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_vlan) err = ops->ndo_set_vf_vlan(dev, ivv->vf, ivv->vlan,
@@ -1810,6 +1814,8 @@ static int do_setvfinfo(struct net_devicif (len ==0 )return -EINVAL ; +if (ivvl[0 ]->vf >=INT_MAX ) +return -EINVAL ; err = ops->ndo_set_vf_vlan (dev, ivvl[0 ]->vf, ivvl[0 ]->vlan, ivvl[0 ]->qos, ivvl[0 ]->vlan_proto);if (err <0 )
@@ -1820,6 +1826,8 @@ static int do_setvfinfo(struct net_devicstruct ifla_vf_tx_rate *ivt =nla_data (tb[IFLA_VF_TX_RATE ]);struct ifla_vf_info ivf; +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_get_vf_config) err = ops->ndo_get_vf_config (dev, ivt->vf, &ivf);
@@ -1838,6 +1846,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_RATE ]) {struct ifla_vf_rate *ivt =nla_data (tb[IFLA_VF_RATE ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_rate) err = ops->ndo_set_vf_rate(dev, ivt->vf,
@@ -1850,6 +1860,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_SPOOFCHK ]) {struct ifla_vf_spoofchk *ivs =nla_data (tb[IFLA_VF_SPOOFCHK ]); +if (ivs->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_spoofchk) err = ops->ndo_set_vf_spoofchk(dev, ivs->vf,
@@ -1861,6 +1873,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_LINK_STATE ]) {struct ifla_vf_link_state *ivl =nla_data (tb[IFLA_VF_LINK_STATE ]); +if (ivl->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_link_state) err = ops->ndo_set_vf_link_state(dev, ivl->vf,
@@ -1874,6 +1888,8 @@ static int do_setvfinfo(struct net_devic err = -EOPNOTSUPP ; ivrssq_en =nla_data (tb[IFLA_VF_RSS_QUERY_EN ]); +if (ivrssq_en->vf >=INT_MAX ) +return -EINVAL ;if (ops->ndo_set_vf_rss_query_en) err = ops->ndo_set_vf_rss_query_en (dev, ivrssq_en->vf, ivrssq_en->setting);
@@ -1884,6 +1900,8 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_TRUST ]) {struct ifla_vf_trust *ivt =nla_data (tb[IFLA_VF_TRUST ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ; err = -EOPNOTSUPP ;if (ops->ndo_set_vf_trust) err = ops->ndo_set_vf_trust (dev, ivt->vf, ivt->setting);
@@ -1894,15 +1912,18 @@ static int do_setvfinfo(struct net_devicif (tb[IFLA_VF_IB_NODE_GUID ]) {struct ifla_vf_guid *ivt =nla_data (tb[IFLA_VF_IB_NODE_GUID ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ;if (!ops->ndo_set_vf_guid)return -EOPNOTSUPP ; -return handle_vf_guid (dev, ivt,IFLA_VF_IB_NODE_GUID ); }if (tb[IFLA_VF_IB_PORT_GUID ]) {struct ifla_vf_guid *ivt =nla_data (tb[IFLA_VF_IB_PORT_GUID ]); +if (ivt->vf >=INT_MAX ) +return -EINVAL ;if (!ops->ndo_set_vf_guid)return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 47/211 scsi: isci: Change sci_controller_start_tasks return type to sci_status
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 362b5da3dfceada6e74ecdd7af3991bbe42c0c0f ]
Clang warns when an enumerated type is implicitly converted to another.
drivers/scsi/isci/request.c:3476:13: warning: implicit conversion from enumeration type 'enum sci_task_status' to different enumeration type 'enum sci_status' [-Wenum-conversion]
status = sci_controller_start_task(ihost,
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/scsi/isci/host.c:2744:10: warning: implicit conversion from enumeration type 'enum sci_status' to different enumeration type 'enum sci_task_status' [-Wenum-conversion]
return SCI_SUCCESS;
~~~~~~ ^~~~~~~~~~~
drivers/scsi/isci/host.c:2753:9: warning: implicit conversion from
enumeration type 'enum sci_status' to different enumeration type 'enum
sci_task_status' [-Wenum-conversion]
return status;
~~~~~~ ^~~~~~Avoid all of these implicit conversion by just making sci_controller_start_task use sci_status. This silences Clang and has no functional change since sci_task_status has all of its values mapped to something in sci_status.
--- drivers/scsi/isci/host.c | 8 ++++---- drivers/scsi/isci/host.h | 2 +- drivers/scsi/isci/task.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/isci/host.c +4 -4
@@ -2717,9 +2717,9 @@ enum sci_status sci_controller_continue_io(struct isci_request *ireq)* the task management request. * @task_request: the handle to the task request object to start. */ -enum sci_task_status sci_controller_start_task (struct isci_host *ihost, -struct isci_remote_device *idev, -struct isci_request *ireq) +enum sci_status sci_controller_start_task (struct isci_host *ihost, +struct isci_remote_device *idev, +struct isci_request *ireq) {enum sci_status status;
@@ -2728,7 +2728,7 @@ enum sci_task_status sci_controller_start_task(struct isci_host *ihost,"%s: SCIC Controller starting task from invalid " "state\n" , __func__); -return SCI_TASK_FAILURE_INVALID_STATE ; +return SCI_FAILURE_INVALID_STATE ; } status =sci_remote_device_start_task (ihost, idev, ireq);
drivers/scsi/isci/host.h +1 -1
@@ -489,7 +489,7 @@ enum sci_status sci_controller_start_io(struct isci_remote_device *idev, struct isci_request *ireq); -enum sci_task_status sci_controller_start_task ( +enum sci_status sci_controller_start_task (struct isci_host *ihost,struct isci_remote_device *idev,struct isci_request *ireq);
drivers/scsi/isci/task.c +2 -2
@@ -258,7 +258,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost, struct isci_tmf *tmf, unsigned long timeout_ms) {DECLARE_COMPLETION_ONSTACK (completion ); -enum sci_task_status status =SCI_TASK_FAILURE ; +enum sci_status status =SCI_FAILURE ;struct isci_request *ireq;int ret =TMF_RESP_FUNC_FAILED ;unsigned long flags;
@@ -301,7 +301,7 @@ static int isci_task_execute_tmf(struct isci_host *ihost,/* start the TMF io. */ status =sci_controller_start_task (ihost, idev, ireq); -if (status !=SCI_TASK_SUCCESS ) { +if (status !=SCI_SUCCESS ) { dev_dbg(&ihost->pdev->dev, "%s: start_io failed - status = 0x%x, request = %p\n", __func__,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/211 net: fix warning in af_unix
In reply to Greg Kroah-HartmanFrom: Kyeongdon Kim <[email protected]>
[ Upstream commit 33c4368ee2589c165aebd8d388cbd91e9adb9688 ]
This fixes the "'hash' may be used uninitialized in this function"
net/unix/af_unix.c:1041:20: warning: 'hash' may be used uninitialized in this function [-Wmaybe-uninitialized]
addr->hash = hash ^ sk->sk_type;
--- net/unix/af_unix.c | 2 ++ 1 file changed, 2 insertions(+)
net/unix/af_unix.c +2 -0
@@ -225,6 +225,8 @@ static inline void unix_release_addr(struct unix_address *addr)static int unix_mkname (struct sockaddr_un *sunaddr,int len,unsigned int *hashp) { + *hashp =0 ; +if (len <=sizeof (short ) || len >sizeof (*sunaddr))return -EINVAL ;if (!sunaddr || sunaddr->sun_family !=AF_UNIX )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/211 net: dsa: mv88e6xxx: Fix 88E6141/6341 2500mbps SERDES speed
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 26422340da467538cd65eaa9c65538039ee99c8c ]
This is a fix for the port_set_speed method for the Topaz family. Currently the same method is used as for the Peridot family, but this is wrong for the SERDES port.
On Topaz, the SERDES port is port 5, not 9 and 10 as in Peridot. Moreover setting alt_bit on Topaz only makes sense for port 0 (for (differentiating 100mbps vs 200mbps). The SERDES port does not support more than 2500mbps, so alt_bit does not make any difference.
--- drivers/net/dsa/mv88e6xxx/chip.c | 4 ++-- drivers/net/dsa/mv88e6xxx/port.c | 25 +++++++++++++++++++++++-- drivers/net/dsa/mv88e6xxx/port.h | 1 + 3 files changed, 26 insertions(+), 4 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +2 -2
@@ -2527,7 +2527,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { .port_set_link = mv88e6xxx_port_set_link, .port_set_duplex = mv88e6xxx_port_set_duplex, .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, - .port_set_speed = mv88e6390_port_set_speed, + .port_set_speed = mv88e6341_port_set_speed, .port_tag_remap = mv88e6095_port_tag_remap, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_egress_floods = mv88e6352_port_set_egress_floods,
@@ -3029,7 +3029,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { .port_set_link = mv88e6xxx_port_set_link, .port_set_duplex = mv88e6xxx_port_set_duplex, .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, - .port_set_speed = mv88e6390_port_set_speed, + .port_set_speed = mv88e6341_port_set_speed, .port_tag_remap = mv88e6095_port_tag_remap, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_egress_floods = mv88e6352_port_set_egress_floods,
drivers/net/dsa/mv88e6xxx/port.c +23 -2
@@ -203,8 +203,11 @@ static int mv88e6xxx_port_set_speed(struct mv88e6xxx_chip *chip, int port, ctrl =MV88E6XXX_PORT_MAC_CTL_SPEED_1000 ;break ;case 2500 : - ctrl =MV88E6390_PORT_MAC_CTL_SPEED_10000 | -MV88E6390_PORT_MAC_CTL_ALTSPEED ; +if (alt_bit) + ctrl =MV88E6390_PORT_MAC_CTL_SPEED_10000 | +MV88E6390_PORT_MAC_CTL_ALTSPEED ; +else + ctrl =MV88E6390_PORT_MAC_CTL_SPEED_10000 ;break ;case 10000 :/* all bits set, fall through... */
@@ -266,6 +269,24 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)return mv88e6xxx_port_set_speed (chip, port, speed, false, false); } +/* Support 10, 100, 200, 1000, 2500 Mbps (e.g. 88E6341) */ +int mv88e6341_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed) +{ +if (speed ==SPEED_MAX ) + speed = port <5 ?1000 :2500 ; + +if (speed >2500 ) +return -EOPNOTSUPP ; + +if (speed ==200 && port !=0 ) +return -EOPNOTSUPP ; + +if (speed ==2500 && port <5 ) +return -EOPNOTSUPP ; + +return mv88e6xxx_port_set_speed (chip, port, speed, !port, true); +} +/* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */ int mv88e6352_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed) {
drivers/net/dsa/mv88e6xxx/port.h +1 -0
@@ -262,6 +262,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup);int mv88e6065_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed);int mv88e6185_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed); +int mv88e6341_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed);int mv88e6352_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed);int mv88e6390_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed);int mv88e6390x_port_set_speed (struct mv88e6xxx_chip *chip,int port,int speed);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/211 xfs: fix use-after-free race in xfs_buf_rele
In reply to Greg Kroah-HartmanFrom: Dave Chinner <[email protected]>
[ Upstream commit 37fd1678245f7a5898c1b05128bc481fb403c290 ]
When looking at a 4.18 based KASAN use after free report, I noticed that racing xfs_buf_rele() may race on dropping the last reference to the buffer and taking the buffer lock. This was the symptom displayed by the KASAN report, but the actual issue that was reported had already been fixed in 4.19-rc1 by commit e339dd8d8b04 ("xfs: use sync buffer I/O for sync delwri queue submission").
Despite this, I think there is still an issue with xfs_buf_rele() in this code:
release = atomic_dec_and_lock(&bp->b_hold, &pag->pag_buf_lock);
spin_lock(&bp->b_lock);
if (!release) {.....
If two threads race on the b_lock after both dropping a reference and one getting dropping the last reference so release = true, we end up with:
CPU 0 CPU 1atomic_dec_and_lock()
atomic_dec_and_lock() spin_lock(&bp->b_lock) spin_lock(&bp->b_lock) <spins> <release = true bp->b_lru_ref = 0> <remove from lists> freebuf = true spin_unlock(&bp->b_lock) xfs_buf_free(bp)
<gets lock, reading and writing freed memory> <accesses freed memory> spin_unlock(&bp->b_lock) <reads/writes freed memory>
IOWs, we can't safely take bp->b_lock after dropping the hold reference because the buffer may go away at any time after we drop that reference. However, this can be fixed simply by taking the bp->b_lock before we drop the reference.
It is safe to nest the pag_buf_lock inside bp->b_lock as the pag_buf_lock is only used to serialise against lookup in xfs_buf_find() and no other locks are held over or under the pag_buf_lock there. Make this clear by documenting the buffer lock orders at the top of the file.
--- fs/xfs/xfs_buf.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
fs/xfs/xfs_buf.c +37 -1
@@ -58,6 +58,32 @@ static kmem_zone_t *xfs_buf_zone;#define xb_to_gfp (flags) \ ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : GFP_NOFS) | __GFP_NOWARN) +/* +* Locking orders +* +* xfs_buf_ioacct_inc: +* xfs_buf_ioacct_dec: +* b_sema (caller holds) +* b_lock +* +* xfs_buf_stale: +* b_sema (caller holds) +* b_lock +* lru_lock +* +* xfs_buf_rele: +* b_lock +* pag_buf_lock +* lru_lock +* +* xfs_buftarg_wait_rele +* lru_lock +* b_lock (trylock due to inversion) +* +* xfs_buftarg_isolate +* lru_lock +* b_lock (trylock due to inversion) +*/ static inline int xfs_buf_is_vmapped(
@@ -983,8 +1009,18 @@ xfs_buf_rele(ASSERT (atomic_read (&bp->b_hold) >0 ); - release =atomic_dec_and_lock (&bp->b_hold, &pag->pag_buf_lock); +/* +* We grab the b_lock here first to serialise racing xfs_buf_rele() +* calls. The pag_buf_lock being taken on the last reference only +* serialises against racing lookups in xfs_buf_find(). IOWs, the second +* to last reference we drop here is not serialised against the last +* reference until we take bp->b_lock. Hence if we don't grab b_lock +* first, the last "release" reference can win the race to the lock and +* free the buffer before the second-to-last reference is processed, +* leading to a use-after-free scenario. +*/ spin_lock (&bp->b_lock); + release =atomic_dec_and_lock (&bp->b_hold, &pag->pag_buf_lock);if (!release) {/* * Drop the in-flight state if the buffer is already on the LRU
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/211 kprobes, x86/ptrace.h: Make regs_get_kernel_stack_nth() not fault on bad stack
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit c2712b858187f5bcd7b042fe4daa3ba3a12635c0 ]
Andy had some concerns about using regs_get_kernel_stack_nth() in a new function regs_get_kernel_argument() as if there's any error in the stack code, it could cause a bad memory access. To be on the safe side, call probe_kernel_read() on the stack address to be extra careful in accessing the memory. A helper function, regs_get_kernel_stack_nth_addr(), was added to just return the stack address (or NULL if not on the stack), that will be used to find the address (and could be used by other functions) and read the address with kernel_probe_read().
--- arch/x86/include/asm/ptrace.h | 42 +++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-)
arch/x86/include/asm/ptrace.h +35 -7
@@ -231,24 +231,52 @@ static inline int regs_within_kernel_stack(struct pt_regs *regs, (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1))); } +/** +* regs_get_kernel_stack_nth_addr() - get the address of the Nth entry on stack +* @regs: pt_regs which contains kernel stack pointer. +* @n: stack entry number. +* +* regs_get_kernel_stack_nth() returns the address of the @n th entry of the +* kernel stack which is specified by @regs. If the @n th entry is NOT in +* the kernel stack, this returns NULL. +*/ +static inline unsigned long *regs_get_kernel_stack_nth_addr (struct pt_regs *regs,unsigned int n) +{ +unsigned long *addr = (unsigned long *)kernel_stack_pointer (regs); + + addr += n; +if (regs_within_kernel_stack (regs, (unsigned long )addr)) +return addr; +else +return NULL ; +} + +/* To avoid include hell, we can't include uaccess.h */ +extern long probe_kernel_read (void *dst,const void *src,size_t size); +/** * regs_get_kernel_stack_nth() - get Nth entry of the stack * @regs: pt_regs which contains kernel stack pointer. * @n: stack entry number. * * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which -* is specified by @regs. If the @n th entry is NOT in the kernel stack, +* is specified by @regs. If the @n th entry is NOT in the kernel stack * this returns 0. */ static inline unsigned long regs_get_kernel_stack_nth (struct pt_regs *regs,unsigned int n) { -unsigned long *addr = (unsigned long *)kernel_stack_pointer (regs); - addr += n; -if (regs_within_kernel_stack (regs, (unsigned long )addr)) -return *addr; -else -return 0 ; +unsigned long *addr; +unsigned long val; +long ret; + + addr =regs_get_kernel_stack_nth_addr (regs, n); +if (addr) { + ret =probe_kernel_read (&val, addr,sizeof (val)); +if (!ret) +return val; + } +return 0 ; }#define arch_has_single_step () (1)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/211 PM / Domains: Deal with multiple states but no governor in genpd
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit 2c9b7f8772033cc8bafbd4eefe2ca605bf3eb094 ]
A caller of pm_genpd_init() that provides some states for the genpd via the ->states pointer in the struct generic_pm_domain, should also provide a governor. This because it's the job of the governor to pick a state that satisfies the constraints.
Therefore, let's print a warning to inform the user about such bogus configuration and avoid to bail out, by instead picking the shallowest state before genpd invokes the ->power_off() callback.
--- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/base/power/domain.c +6 -0
@@ -369,6 +369,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,return -EAGAIN ; } +/* Default to shallowest state. */ +if (!genpd->gov) + genpd->state_idx =0 ; +if (genpd->power_off) {int ret;
@@ -1598,6 +1602,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret =genpd_set_default_power_state (genpd);if (ret)return ret; + }else if (!gov) { +pr_warn ("%s : no governor for states\n" , genpd->name); }mutex_lock (&gpd_list_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/211 macintosh/windfarm_smu_sat: Fix debug output
In reply to Greg Kroah-HartmanFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit fc0c8b36d379a046525eacb9c3323ca635283757 ]
There's some antiquated debug output that's trying to do a hand-made hexdump and turning into horrible 1-byte-per-line output these days.
Use print_hex_dump() instead
--- drivers/macintosh/windfarm_smu_sat.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
drivers/macintosh/windfarm_smu_sat.c +7 -18
@@ -22,14 +22,6 @@#define VERSION "1.0" -#define DEBUG - -#ifdef DEBUG -#define DBG(args...) printk(args) -#else -#define DBG(args...) do { } while(0) -#endif -/* If the cache is older than 800ms we'll refetch it */ #define MAX_AGE msecs_to_jiffies(800)
@@ -106,13 +98,10 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id, buf[i+2 ] = data[3 ]; buf[i+3 ] = data[2 ]; } -#ifdef DEBUG -DBG (KERN_DEBUG "sat %d partition %x:" , sat_id, id); -for (i =0 ; i < len; ++i) -DBG (" %x" , buf[i]); -DBG ("\n" ); -#endif +printk (KERN_DEBUG "sat %d partition %x:" , sat_id, id); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET , +16 ,1 , buf, len, false);if (size) *size = len;return (struct smu_sdbp_header *) buf;
@@ -132,13 +121,13 @@ static int wf_sat_read_cache(struct wf_sat *sat)if (err <0 )return err; sat->last_read = jiffies; +#ifdef LOTSA_DEBUG {int i; -DBG (KERN_DEBUG "wf_sat_get: data is" ); -for (i =0 ; i <16 ; ++i) -DBG (" %.2x" , sat->cache[i]); -DBG ("\n" ); +printk (KERN_DEBUG "wf_sat_get: data is" ); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET , +16 ,1 , sat->cache,16 , false); }#endif return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/211 ALSA: i2c/cs8427: Fix int to char conversion
In reply to Greg Kroah-HartmanFrom: Philipp Klocke <[email protected]>
[ Upstream commit eb7ebfa3c1989aa8e59d5e68ab3cddd7df1bfb27 ]
Compiling with clang yields the following warning:
sound/i2c/cs8427.c:140:31: warning: implicit conversion from 'int' to 'char' changes value from 160 to -96 [-Wconstant-conversion]
data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF;
~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~Because CS8427_REG_AUTOINC is defined as 128, it is too big for a char field.
So change data from char to unsigned char, that it can hold the value.
This patch does not change the generated code.
--- sound/i2c/cs8427.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/i2c/cs8427.c +1 -1
@@ -118,7 +118,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device,struct cs8427 *chip = device->private_data;char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status; -char data[32 ]; +unsigned char data[32 ];int err, idx;if (!memcmp (hw_data, ndata, count))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/211 PCI: vmd: Detach resources after stopping root bus
In reply to Greg Kroah-HartmanFrom: Jon Derrick <[email protected]>
[ Upstream commit dc8af3a827df6d4bb925d3b81b7ec94a7cce9482 ]
The VMD removal path calls pci_stop_root_busi(), which tears down the pcie tree, including detaching all of the attached drivers. During driver detachment, devices may use pci_release_region() to release resources. This path relies on the resource being accessible in resource tree.
By detaching the child domain from the parent resource domain prior to stopping the bus, we are preventing the list traversal from finding the resource to be freed. If we instead detach the resource after stopping the bus, we will have properly freed the resource and detaching is simply accounting at that point.
Without this order, the resource is never freed and is orphaned on VMD removal, leading to a warning:
[ 181.940162] Trying to free nonexistent resource <e5a10000-e5a13fff>
--- drivers/pci/host/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/vmd.c +1 -1
@@ -753,12 +753,12 @@ static void vmd_remove(struct pci_dev *dev) {struct vmd_dev *vmd =pci_get_drvdata (dev); -vmd_detach_resources (vmd);sysfs_remove_link (&vmd->dev->dev.kobj,"domain" );pci_stop_root_bus (vmd->bus);pci_remove_root_bus (vmd->bus);vmd_cleanup_srcu (vmd);vmd_teardown_dma_ops (vmd); +vmd_detach_resources (vmd);irq_domain_remove (vmd->irq_domain); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/211 USB: misc: appledisplay: fix backlight update_status return code
In reply to Greg Kroah-HartmanFrom: Mattias Jacobsson <[email protected]>
[ Upstream commit 090158555ff8d194a98616034100b16697dd80d0 ]
Upon success the update_status handler returns a positive number corresponding to the number of bytes transferred by usb_control_msg. However the return code of the update_status handler should indicate if an error occurred(negative) or how many bytes of the user's input to sysfs that was consumed. Return code zero indicates all bytes were consumed.
The bug can for example result in the update_status handler being called twice, the second time with only the "unconsumed" part of the user's input to sysfs. Effectively setting an incorrect brightness.
Change the update_status handler to return zero for all successful transactions and forward usb_control_msg's error code upon failure.
--- drivers/usb/misc/appledisplay.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/misc/appledisplay.c +5 -2
@@ -160,8 +160,11 @@ static int appledisplay_bl_update_status(struct backlight_device *bd) pdata->msgdata,2 , ACD_USB_TIMEOUT);mutex_unlock (&pdata->sysfslock); - -return retval; + +if (retval <0 ) +return retval; +else +return 0 ; }static int appledisplay_bl_get_brightness (struct backlight_device *bd)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/211 dm raid: avoid bitmap with raid4/5/6 journal device
In reply to Greg Kroah-HartmanFrom: Heinz Mauelshagen <[email protected]>
[ Upstream commit d857ad75edf3c0066fcd920746f9dc75382b3324 ]
With raid4/5/6, journal device and write intent bitmap are mutually exclusive.
--- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-raid.c +1 -1
@@ -2441,7 +2441,7 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev) }/* Enable bitmap creation for RAID levels != 0 */ - mddev->bitmap_info.offset =rt_is_raid0 (rs->raid_type) ?0 :to_sector (4096 ); + mddev->bitmap_info.offset = (rt_is_raid0 (rs->raid_type) || rs->journal_dev.dev) ?0 :to_sector (4096 ); mddev->bitmap_info.default_offset = mddev->bitmap_info.offset;if (!test_and_clear_bit (FirstUse, &rdev->flags)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/211 SUNRPC: Fix a compile warning for cmpxchg64()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit e732f4485a150492b286f3efc06f9b34dd6b9995 ]
--- net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/auth_gss/gss_krb5_seal.c +1 -0
@@ -63,6 +63,7 @@#include <linux/sunrpc/gss_krb5.h> #include <linux/random.h> #include <linux/crypto.h> +#include <linux/atomic.h> #if IS_ENABLED (CONFIG_SUNRPC_DEBUG )# define RPCDBG_FACILITY RPCDBG_AUTH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/211 atm: zatm: Fix empty body Clang warnings
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 64b9d16e2d02ca6e5dc8fcd30cfd52b0ecaaa8f4 ]
Clang warns:
drivers/atm/zatm.c:513:7: error: while loop has empty body [-Werror,-Wempty-body]
zwait;
^drivers/atm/zatm.c:513:7: note: put the semicolon on a separate line to silence this warning
Get rid of this warning by using an empty do-while loop. While we're at it, add parentheses to make it clear that this is a function-like macro.
--- drivers/atm/zatm.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/atm/zatm.c +21 -21
@@ -126,7 +126,7 @@ static unsigned long dummy[2] = {0,0};#define zin_n (r) inl(zatm_dev->base+r*4)#define zin (r) inl(zatm_dev->base+uPD98401_##r*4)#define zout (v,r) outl(v,zatm_dev->base+uPD98401_##r*4) -#define zwait while (zin(CMR) & uPD98401_BUSY) +#define zwait () do {} while (zin(CMR) & uPD98401_BUSY)/* RX0, RX1, TX0, TX1 */ static const int mbx_entries[NR_MBX ] = {1024 ,1024 ,1024 ,1024 };
@@ -140,7 +140,7 @@ static const int mbx_esize[NR_MBX] = { 16,16,4,4 }; /* entry size in bytes */static void zpokel (struct zatm_dev *zatm_dev,u32 value,u32 addr) { - zwait; +zwait ();zout (value,CER );zout (uPD98401_IND_ACC | uPD98401_IA_BALL | (uPD98401_IA_TGT_CM << uPD98401_IA_TGT_SHIFT) | addr,CMR );
@@ -149,10 +149,10 @@ static void zpokel(struct zatm_dev *zatm_dev,u32 value,u32 addr)static u32 zpeekl (struct zatm_dev *zatm_dev,u32 addr) { - zwait; +zwait ();zout (uPD98401_IND_ACC | uPD98401_IA_BALL | uPD98401_IA_RW | (uPD98401_IA_TGT_CM << uPD98401_IA_TGT_SHIFT) | addr,CMR ); - zwait; +zwait ();return zin (CER ); }
@@ -241,7 +241,7 @@ static void refill_pool(struct atm_dev *dev,int pool) }if (first) {spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (virt_to_bus (first),CER );zout (uPD98401_ADD_BAT | (pool << uPD98401_POOL_SHIFT) | count,CMR );
@@ -508,9 +508,9 @@ static int open_rx_first(struct atm_vcc *vcc) }if (zatm_vcc->pool <0 )return -EMSGSIZE ;spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_OPEN_CHAN,CMR ); - zwait; +zwait ();DPRINTK ("0x%x 0x%x\n" ,zin (CMR ),zin (CER )); chan = (zin (CMR ) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -571,21 +571,21 @@ static void close_rx(struct atm_vcc *vcc) pos = vcc->vci >>1 ; shift = (1 -(vcc->vci &1 )) <<4 ;zpokel (zatm_dev,zpeekl (zatm_dev,pos) & ~(0xffff << shift),pos); - zwait; +zwait ();zout (uPD98401_NOP,CMR ); - zwait; +zwait ();zout (uPD98401_NOP,CMR );spin_unlock_irqrestore (&zatm_dev->lock, flags); }spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_DEACT_CHAN | uPD98401_CHAN_RT | (zatm_vcc->rx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();udelay (10 );/* why oh why ... ? */ zout (uPD98401_CLOSE_CHAN | uPD98401_CHAN_RT | (zatm_vcc->rx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();if (!(zin (CMR ) & uPD98401_CHAN_ADDR)) printk(KERN_CRIT DEV_LABEL "(itf %d): can't close RX channel ""%d\n" ,vcc->dev->number,zatm_vcc->rx_chan);
@@ -699,7 +699,7 @@ printk("NONONONOO!!!!\n");skb_queue_tail (&zatm_vcc->tx_queue,skb);DPRINTK ("QRP=0x%08lx\n" ,zpeekl (zatm_dev,zatm_vcc->tx_chan*VC_SIZE /4 + uPD98401_TXVC_QRP)); - zwait; +zwait ();zout (uPD98401_TX_READY | (zatm_vcc->tx_chan << uPD98401_CHAN_ADDR_SHIFT),CMR );spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -891,12 +891,12 @@ static void close_tx(struct atm_vcc *vcc) }spin_lock_irqsave (&zatm_dev->lock, flags);#if 0 - zwait; +zwait ();zout (uPD98401_DEACT_CHAN | (chan << uPD98401_CHAN_ADDR_SHIFT),CMR );#endif - zwait; +zwait ();zout (uPD98401_CLOSE_CHAN | (chan << uPD98401_CHAN_ADDR_SHIFT),CMR ); - zwait; +zwait ();if (!(zin (CMR ) & uPD98401_CHAN_ADDR)) printk(KERN_CRIT DEV_LABEL "(itf %d): can't close TX channel ""%d\n" ,vcc->dev->number,chan);
@@ -926,9 +926,9 @@ static int open_tx_first(struct atm_vcc *vcc) zatm_vcc->tx_chan =0 ;if (vcc->qos.txtp.traffic_class ==ATM_NONE )return 0 ;spin_lock_irqsave (&zatm_dev->lock, flags); - zwait; +zwait ();zout (uPD98401_OPEN_CHAN,CMR ); - zwait; +zwait ();DPRINTK ("0x%x 0x%x\n" ,zin (CMR ),zin (CER )); chan = (zin (CMR ) & uPD98401_CHAN_ADDR) >> uPD98401_CHAN_ADDR_SHIFT;spin_unlock_irqrestore (&zatm_dev->lock, flags);
@@ -1559,7 +1559,7 @@ static void zatm_phy_put(struct atm_dev *dev,unsigned char value,struct zatm_dev *zatm_dev; zatm_dev =ZATM_DEV (dev); - zwait; +zwait ();zout (value,CER );zout (uPD98401_IND_ACC | uPD98401_IA_B0 | (uPD98401_IA_TGT_PHY << uPD98401_IA_TGT_SHIFT) | addr,CMR );
@@ -1571,10 +1571,10 @@ static unsigned char zatm_phy_get(struct atm_dev *dev,unsigned long addr)struct zatm_dev *zatm_dev; zatm_dev =ZATM_DEV (dev); - zwait; +zwait ();zout (uPD98401_IND_ACC | uPD98401_IA_B0 | uPD98401_IA_RW | (uPD98401_IA_TGT_PHY << uPD98401_IA_TGT_SHIFT) | addr,CMR ); - zwait; +zwait ();return zin (CER ) &0xff ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/211 s390/perf: Return error when debug_register fails
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit ec0c0bb489727de0d4dca6a00be6970ab8a3b30a ]
Return an error when the function debug_register() fails allocating the debug handle.
Also remove the registered debug handle when the initialization fails later on.
--- arch/s390/kernel/perf_cpum_sf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kernel/perf_cpum_sf.c +5 -1
@@ -1610,14 +1610,17 @@ static int __init init_cpum_sampling_pmu(void) } sfdbg =debug_register (KMSG_COMPONENT ,2 ,1 ,80 ); -if (!sfdbg) +if (!sfdbg) {pr_err ("Registering for s390dbf failed\n" ); +return -ENOMEM ; + }debug_register_view (sfdbg, &debug_sprintf_view); err =register_external_irq (EXT_IRQ_MEASURE_ALERT , cpumf_measurement_alert);if (err) {pr_cpumsf_err (RS_INIT_FAILURE_ALRT ); +debug_unregister (sfdbg); goto out; }
@@ -1626,6 +1629,7 @@ static int __init init_cpum_sampling_pmu(void)pr_cpumsf_err (RS_INIT_FAILURE_PERF );unregister_external_irq (EXT_IRQ_MEASURE_ALERT , cpumf_measurement_alert); +debug_unregister (sfdbg); goto out; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 72/211 spi: omap2-mcspi: Set FIFO DMA trigger level to word length
In reply to Greg Kroah-HartmanFrom: Vignesh R <[email protected]>
[ Upstream commit b682cffa3ac6d9d9e16e9b413c45caee3b391fab ]
McSPI has 32 byte FIFO in Transmit-Receive mode. Current code tries to configuration FIFO watermark level for DMA trigger to be GCD of transfer length and max FIFO size which would mean trigger level may be set to 32 for transmit-receive mode if length is aligned. This does not work in case of SPI slave mode where FIFO always needs to have data ready whenever master starts the clock. With DMA trigger size of 32 there will be a small window during slave TX where DMA is still putting data into FIFO but master would have started clock for next byte, resulting in shifting out of stale data. Similarly, on Slave RX side there may be RX FIFO overflow
Fix this by setting FIFO watermark for DMA trigger to word length. This means DMA is triggered as soon as FIFO has space for word length bytes and DMA would make sure FIFO is almost always full therefore improving FIFO occupancy in both master and slave mode.
--- drivers/spi/spi-omap2-mcspi.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-)
drivers/spi/spi-omap2-mcspi.c +7 -19
@@ -298,7 +298,7 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi,struct omap2_mcspi_cs *cs = spi->controller_state;struct omap2_mcspi *mcspi;unsigned int wcnt; -int max_fifo_depth, fifo_depth, bytes_per_word; +int max_fifo_depth, bytes_per_word;u32 chconf, xferlevel; mcspi =spi_master_get_devdata (master);
@@ -314,10 +314,6 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi,else max_fifo_depth =OMAP2_MCSPI_MAX_FIFODEPTH ; - fifo_depth =gcd (t->len, max_fifo_depth); -if (fifo_depth <2 || fifo_depth % bytes_per_word !=0 ) - goto disable_fifo; - wcnt = t->len / bytes_per_word;if (wcnt >OMAP2_MCSPI_MAX_FIFOWCNT ) goto disable_fifo;
@@ -325,16 +321,17 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, xferlevel = wcnt <<16 ;if (t->rx_buf !=NULL ) { chconf |=OMAP2_MCSPI_CHCONF_FFER ; - xferlevel |= (fifo_depth -1 ) <<8 ; + xferlevel |= (bytes_per_word -1 ) <<8 ; } +if (t->tx_buf !=NULL ) { chconf |=OMAP2_MCSPI_CHCONF_FFET ; - xferlevel |= fifo_depth -1 ; + xferlevel |= bytes_per_word -1 ; }mcspi_write_reg (master,OMAP2_MCSPI_XFERLEVEL , xferlevel);mcspi_write_chconf0 (spi, chconf); - mcspi->fifo_depth = fifo_depth; + mcspi->fifo_depth = max_fifo_depth;return ; }
@@ -601,7 +598,6 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)struct dma_slave_config cfg;enum dma_slave_buswidth width;unsigned es; -u32 burst;void __iomem *chstat_reg;void __iomem *irqstat_reg;int wait_res;
@@ -623,22 +619,14 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) } count = xfer->len; - burst =1 ; - -if (mcspi->fifo_depth >0 ) { -if (count > mcspi->fifo_depth) - burst = mcspi->fifo_depth / es; -else - burst = count / es; - }memset (&cfg,0 ,sizeof (cfg)); cfg.src_addr = cs->phys +OMAP2_MCSPI_RX0 ; cfg.dst_addr = cs->phys +OMAP2_MCSPI_TX0 ; cfg.src_addr_width = width; cfg.dst_addr_width = width; - cfg.src_maxburst = burst; - cfg.dst_maxburst = burst; + cfg.src_maxburst = es; + cfg.dst_maxburst = es; rx = xfer->rx_buf; tx = xfer->tx_buf;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/211 sparc: Fix parport build warnings.
In reply to Greg Kroah-HartmanFrom: David S. Miller <[email protected]>
[ Upstream commit 46b8306480fb424abd525acc1763da1c63a27d8a ]
If PARPORT_PC_FIFO is not enabled, do not provide the dma lock macros and lock definition. Otherwise:
./arch/sparc/include/asm/parport.h:24:24: warning: ‘dma_spin_lock’ defined but not used [-Wunused-variable]
static DEFINE_SPINLOCK(dma_spin_lock);
^~~~~~~~~~~~~./include/linux/spinlock_types.h:81:39: note: in definition of macro ‘DEFINE_SPINLOCK’
#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
--- arch/sparc/include/asm/parport.h | 2 ++ 1 file changed, 2 insertions(+)
arch/sparc/include/asm/parport.h +2 -0
@@ -21,6 +21,7 @@*/ #define HAS_DMA +#ifdef CONFIG_PARPORT_PC_FIFO static DEFINE_SPINLOCK (dma_spin_lock);#define claim_dma_lock () \
@@ -31,6 +32,7 @@ static DEFINE_SPINLOCK(dma_spin_lock);#define release_dma_lock (__flags) \ spin_unlock_irqrestore(&dma_spin_lock, __flags); +#endif static struct sparc_ebus_info { struct ebus_dma_info info;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/211 powerpc/pseries: Export raw per-CPU VPA data via debugfs
In reply to Greg Kroah-HartmanFrom: Aravinda Prasad <[email protected]>
[ Upstream commit c6c26fb55e8e4b3fc376be5611685990a17de27a ]
This patch exports the raw per-CPU VPA data via debugfs. A per-CPU file is created which exports the VPA data of that CPU to help debug some of the VPA related issues or to analyze the per-CPU VPA related statistics.
v3: Removed offline CPU check.
v2: Included offline CPU check and other review comments.
--- arch/powerpc/platforms/pseries/lpar.c | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
arch/powerpc/platforms/pseries/lpar.c +54 -0
@@ -48,6 +48,7 @@#include <asm/kexec.h> #include <asm/fadump.h> #include <asm/asm-prototypes.h> +#include <asm/debugfs.h> #include "pseries.h"
@@ -1036,3 +1037,56 @@ static int __init reserve_vrma_context_id(void)return 0 ; }machine_device_initcall (pseries, reserve_vrma_context_id); + +#ifdef CONFIG_DEBUG_FS +/* debugfs file interface for vpa data */ +static ssize_t vpa_file_read (struct file *filp,char __user *buf,size_t len, +loff_t *pos) +{ +int cpu = (long )filp->private_data; +struct lppaca *lppaca = &lppaca_of (cpu); + +return simple_read_from_buffer (buf, len, pos, lppaca, +sizeof (struct lppaca )); +} + +static const struct file_operations vpa_fops = { + .open = simple_open, + .read = vpa_file_read, + .llseek = default_llseek, +}; + +static int __init vpa_debugfs_init (void ) +{ +char name[16 ]; +long i; +static struct dentry *vpa_dir; + +if (!firmware_has_feature (FW_FEATURE_SPLPAR )) +return 0 ; + + vpa_dir =debugfs_create_dir ("vpa" , powerpc_debugfs_root); +if (!vpa_dir) { +pr_warn ("%s: can't create vpa root dir\n" , __func__); +return -ENOMEM ; + } + +/* set up the per-cpu vpa file*/ +for_each_possible_cpu (i) { +struct dentry *d; + +sprintf (name,"cpu-%ld" , i); + + d =debugfs_create_file (name,0400 , vpa_dir, (void *)i, + &vpa_fops); +if (!d) { +pr_warn ("%s: can't create per-cpu vpa file\n" , + __func__); +return -ENOMEM ; + } + } + +return 0 ; +} +machine_arch_initcall (pseries, vpa_debugfs_init); +#endif /* CONFIG_DEBUG_FS */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/211 crypto: ccree - avoid implicit enum conversion
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 18e732b8035d175181aae2ded127994cb01694f7 ]
Clang warns when one enumerated type is implicitly converted to another and this happens in several locations in this driver, ultimately related to the set_cipher_{mode,config0} functions. set_cipher_mode expects a mode of type drv_cipher_mode and set_cipher_config0 expects a mode of type drv_crypto_direction.
drivers/crypto/ccree/cc_ivgen.c:58:35: warning: implicit conversion from enumeration type 'enum cc_desc_direction' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion]
set_cipher_config0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT);
drivers/crypto/ccree/cc_hash.c:99:28: warning: implicit conversion from enumeration type 'enum cc_hash_conf_pad' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion]
set_cipher_config0(desc, HASH_DIGEST_RESULT_LITTLE_ENDIAN);
drivers/crypto/ccree/cc_aead.c:1643:30: warning: implicit conversion from enumeration type 'enum drv_hash_hw_mode' to different enumeration type 'enum drv_cipher_mode' [-Wenum-conversion]
set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH);
Since this fundamentally isn't a problem because these values just represent simple integers for a shift operation, make it clear to Clang that this is okay by making the mode parameter in both functions an int.
--- drivers/staging/ccree/cc_hw_queue_defs.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/ccree/cc_hw_queue_defs.h +2 -4
@@ -467,8 +467,7 @@ static inline void set_flow_mode(struct cc_hw_desc *pdesc,* @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_mode (struct cc_hw_desc *pdesc, -enum drv_cipher_mode mode) +static inline void set_cipher_mode (struct cc_hw_desc *pdesc,int mode) { pdesc->word[4 ] |=FIELD_PREP (WORD4_CIPHER_MODE , mode); }
@@ -479,8 +478,7 @@ static inline void set_cipher_mode(struct cc_hw_desc *pdesc,* @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_config0 (struct cc_hw_desc *pdesc, -enum drv_crypto_direction mode) +static inline void set_cipher_config0 (struct cc_hw_desc *pdesc,int mode) { pdesc->word[4 ] |=FIELD_PREP (WORD4_CIPHER_CONF0 , mode); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 76/211 rtc: s35390a: Change bufs type to u8 in s35390a_init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit ef0f02fd69a02b50e468a4ddbe33e3d81671e248 ]
Clang warns:
drivers/rtc/rtc-s35390a.c:124:27: warning: implicit conversion from 'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion]
buf = S35390A_FLAG_RESET | S35390A_FLAG_24H;
~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~1 warning generated.
Update buf to be an unsigned 8-bit integer, which matches the buf member in struct i2c_msg.
https://github.com/ClangBuiltLinux/linux/issues/145
--- drivers/rtc/rtc-s35390a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-s35390a.c +1 -1
@@ -108,7 +108,7 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len)static int s35390a_init (struct s35390a *s35390a) { -char buf; +u8 buf;int ret;unsigned initcount =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/211 qlcnic: fix a return in qlcnic_dcb_get_capability()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c94f026fb742b2d3199422751dbc4f6fc0e753d8 ]
These functions are supposed to return one on failure and zero on success. Returning a zero here could cause uninitialized variable bugs in several of the callers. For example:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
error: uninitialized symbol 'caps'.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +1 -1
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(struct net_device *netdev, int capid,struct qlcnic_adapter *adapter =netdev_priv (netdev);if (!test_bit (QLCNIC_DCB_STATE , &adapter->dcb->state)) -return 0 ; +return 1 ;switch (capid) {case DCB_CAP_ATTR_PG :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 78/211 mISDN: Fix type of switch control variable in ctrl_teimanager
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit aeb5e02aca91522733eb1db595ac607d30c87767 ]
Clang warns (trimmed for brevity):
drivers/isdn/mISDN/tei.c:1193:7: warning: overflow converting case value to switch condition type (2147764552 to 18446744071562348872) [-Wswitch]
case IMHOLD_L1:
^
drivers/isdn/mISDN/tei.c:1187:7: warning: overflow converting case value
to switch condition type (2147764550 to 18446744071562348870) [-Wswitch]
case IMCLEAR_L2:
^2 warnings generated.
The root cause is that the _IOC macro can generate really large numbers, which don't find into type int. My research into how GCC and Clang are handling this at a low level didn't prove fruitful and surveying the kernel tree shows that aside from here and a few places in the scsi subsystem, everything that uses _IOC is at least of type 'unsigned int'. Make that change here because as nothing in this function cares about the signedness of the variable and it removes ambiguity, which is never good when dealing with compilers.
While we're here, remove the unnecessary local variable ret (just return -EINVAL and 0 directly).
--- drivers/isdn/mISDN/tei.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/isdn/mISDN/tei.c +3 -4
@@ -1180,8 +1180,7 @@ static int ctrl_teimanager(struct manager *mgr, void *arg) {/* currently we only have one option */ - int *val = (int *)arg; -int ret =0 ; +unsigned int *val = (unsigned int *)arg;switch (val[0 ]) {case IMCLEAR_L2 :
@@ -1197,9 +1196,9 @@ ctrl_teimanager(struct manager *mgr, void *arg)test_and_clear_bit (OPTION_L1_HOLD , &mgr->options);break ;default : - ret = -EINVAL ; +return -EINVAL ; } -return ret; +return 0 ; }/* This function does create a L2 for fixed TEI in NT Mode */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 81/211 mfd: arizona: Correct calling of runtime_put_sync
In reply to Greg Kroah-HartmanFrom: Sapthagiri Baratam <[email protected]>
[ Upstream commit 6b269a41a4520f7eb639e61a45ebbb9c9267d5e0 ]
Don't call runtime_put_sync when clk32k_ref is ARIZONA_32KZ_MCLK2 as there is no corresponding runtime_get_sync call.
MCLK1 is not in the AoD power domain so if it is used as 32kHz clock source we need to hold a runtime PM reference to keep the device from going into low power mode.
--- drivers/mfd/arizona-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/arizona-core.c +4 -4
@@ -52,8 +52,10 @@ int arizona_clk32k_enable(struct arizona *arizona)if (ret !=0 ) goto err_ref; ret =clk_prepare_enable (arizona->mclk[ARIZONA_MCLK1 ]); -if (ret !=0 ) - goto err_pm; +if (ret !=0 ) { +pm_runtime_put_sync (arizona->dev); + goto err_ref; + }break ;case ARIZONA_32KZ_MCLK2 : ret =clk_prepare_enable (arizona->mclk[ARIZONA_MCLK2 ]);
@@ -67,8 +69,6 @@ int arizona_clk32k_enable(struct arizona *arizona) ARIZONA_CLK_32K_ENA); } -err_pm: -pm_runtime_put_sync (arizona->dev); err_ref:if (ret !=0 ) arizona->clk32k_ref--;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/211 mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 55143439b7b501882bea9d95a54adfe00ffc79a3 ]
When trying to read any MC13892 ADC channel on a imx51-babbage board:
The MC13892 PMIC shutdowns completely.
After debugging this issue and comparing the MC13892 and MC13783 initializations done in the vendor kernel, it was noticed that the CHRGRAWDIV bit of the ADC0 register was not being set.
This bit is set by default after power on, but the driver was clearing it.
After setting this bit it is possible to read the ADC values correctly.
--- drivers/mfd/mc13xxx-core.c | 3 ++- include/linux/mfd/mc13xxx.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +2 -1
@@ -278,7 +278,8 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,if (ret) goto out; - adc0 =MC13XXX_ADC0_ADINC1 |MC13XXX_ADC0_ADINC2 ; + adc0 =MC13XXX_ADC0_ADINC1 |MC13XXX_ADC0_ADINC2 | +MC13XXX_ADC0_CHRGRAWDIV ; adc1 =MC13XXX_ADC1_ADEN |MC13XXX_ADC1_ADTRIGIGN |MC13XXX_ADC1_ASC ;if (channel >7 )
include/linux/mfd/mc13xxx.h +1 -0
@@ -247,6 +247,7 @@ struct mc13xxx_platform_data {#define MC13XXX_ADC0_TSMOD0 (1 << 12)#define MC13XXX_ADC0_TSMOD1 (1 << 13)#define MC13XXX_ADC0_TSMOD2 (1 << 14) +#define MC13XXX_ADC0_CHRGRAWDIV (1 << 15)#define MC13XXX_ADC0_ADINC1 (1 << 16)#define MC13XXX_ADC0_ADINC2 (1 << 17)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 83/211 mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 9f8ddee1dab836ca758ca8fc555ab5a3aaa5d3fd ]
Power button IRQ actually has a second level of interrupts to distinguish between UI and POWER buttons. Moreover, current implementation looks awkward in approach to handle second level IRQs by first level related IRQ chip.
To address above issues, split power button IRQ to be chained as well.
--- drivers/mfd/intel_soc_pmic_bxtwc.c | 41 ++++++++++++++++++++++-------- include/linux/mfd/intel_soc_pmic.h | 1 + 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/mfd/intel_soc_pmic_bxtwc.c +31 -10
@@ -31,8 +31,8 @@/* Interrupt Status Registers */ #define BXTWC_IRQLVL1 0x4E02 -#define BXTWC_PWRBTNIRQ 0x4E03 +#define BXTWC_PWRBTNIRQ 0x4E03#define BXTWC_THRM0IRQ 0x4E04#define BXTWC_THRM1IRQ 0x4E05#define BXTWC_THRM2IRQ 0x4E06
@@ -47,10 +47,9 @@/* Interrupt MASK Registers */ #define BXTWC_MIRQLVL1 0x4E0E -#define BXTWC_MPWRTNIRQ 0x4E0F -#define BXTWC_MIRQLVL1_MCHGR BIT(5) +#define BXTWC_MPWRBTNIRQ 0x4E0F#define BXTWC_MTHRM0IRQ 0x4E12#define BXTWC_MTHRM1IRQ 0x4E13#define BXTWC_MTHRM2IRQ 0x4E14
@@ -66,9 +65,7 @@/* Whiskey Cove PMIC share same ACPI ID between different platforms */ #define BROXTON_PMIC_WC_HRV 4 -/* Manage in two IRQ chips since mask registers are not consecutive */ enum bxtwc_irqs { -/* Level 1 */ BXTWC_PWRBTN_LVL1_IRQ =0 ,BXTWC_TMU_LVL1_IRQ ,BXTWC_THRM_LVL1_IRQ ,
@@ -77,9 +74,11 @@ enum bxtwc_irqs {BXTWC_CHGR_LVL1_IRQ ,BXTWC_GPIO_LVL1_IRQ , BXTWC_CRIT_LVL1_IRQ, +}; -/* Level 2 */ - BXTWC_PWRBTN_IRQ, +enum bxtwc_irqs_pwrbtn { +BXTWC_PWRBTN_IRQ =0 , +BXTWC_UIBTN_IRQ , }; enum bxtwc_irqs_bcu {
@@ -113,7 +112,10 @@ static const struct regmap_irq bxtwc_regmap_irqs[] = {REGMAP_IRQ_REG (BXTWC_CHGR_LVL1_IRQ ,0 ,BIT (5 )),REGMAP_IRQ_REG (BXTWC_GPIO_LVL1_IRQ ,0 ,BIT (6 )), REGMAP_IRQ_REG(BXTWC_CRIT_LVL1_IRQ, 0, BIT(7)), - REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), +}; + +static const struct regmap_irq bxtwc_regmap_irqs_pwrbtn[] = { +REGMAP_IRQ_REG (BXTWC_PWRBTN_IRQ ,0 ,0x01 ), }; static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = {
@@ -125,7 +127,7 @@ static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { };static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { -REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,BIT (5 )), +REGMAP_IRQ_REG (BXTWC_USBC_IRQ ,0 ,0x20 ),REGMAP_IRQ_REG (BXTWC_CHGR0_IRQ ,0 ,0x1f ),REGMAP_IRQ_REG (BXTWC_CHGR1_IRQ ,1 ,0x1f ), };
@@ -144,7 +146,16 @@ static struct regmap_irq_chip bxtwc_regmap_irq_chip = { .mask_base = BXTWC_MIRQLVL1, .irqs = bxtwc_regmap_irqs, .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs), - .num_regs = 2, + .num_regs = 1, +}; + +static struct regmap_irq_chip bxtwc_regmap_irq_chip_pwrbtn = { + .name ="bxtwc_irq_chip_pwrbtn" , + .status_base =BXTWC_PWRBTNIRQ , + .mask_base =BXTWC_MPWRBTNIRQ , + .irqs = bxtwc_regmap_irqs_pwrbtn, + .num_irqs =ARRAY_SIZE (bxtwc_regmap_irqs_pwrbtn), + .num_regs =1 , };static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = {
@@ -472,6 +483,16 @@ static int bxtwc_probe(struct platform_device *pdev)return ret; } + ret =bxtwc_add_chained_irq_chip (pmic, pmic->irq_chip_data, +BXTWC_PWRBTN_LVL1_IRQ , +IRQF_ONESHOT , + &bxtwc_regmap_irq_chip_pwrbtn, + &pmic->irq_chip_data_pwrbtn); +if (ret) { +dev_err (&pdev->dev,"Failed to add PWRBTN IRQ chip\n" ); +return ret; + } + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ, IRQF_ONESHOT,
include/linux/mfd/intel_soc_pmic.h +1 -0
@@ -25,6 +25,7 @@ struct intel_soc_pmic {int irq;struct regmap *regmap;struct regmap_irq_chip_data *irq_chip_data; +struct regmap_irq_chip_data *irq_chip_data_pwrbtn;struct regmap_irq_chip_data *irq_chip_data_tmu;struct regmap_irq_chip_data *irq_chip_data_bcu;struct regmap_irq_chip_data *irq_chip_data_adc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 85/211 selftests/ftrace: Fix to test kprobe $comm arg only if available
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 2452c96e617a0ff6fb2692e55217a3fa57a7322c ]
Test $comm in kprobe-event argument syntax testcase only if it is supported on the kernel because $comm has been introduced 4.8 kernel.
So on older stable kernel, it should be skipped.
--- .../selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc +3 -0
@@ -71,8 +71,11 @@ test_badarg "\$stackp" "\$stack0+10" "\$stack1-10" echo "r ${PROBEFUNC} \$retval" > kprobe_events ! echo "p ${PROBEFUNC} \$retval" > kprobe_events +# $comm was introduced in 4.8, older kernels reject it. +if grep -A1 "fetcharg:" README | grep -q '\$comm' ; then : "Comm access" test_goodarg "\$comm" +fi : "Indirect memory access" test_goodarg "+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 86/211 selftests: watchdog: fix message when /dev/watchdog open fails
In reply to Greg Kroah-HartmanFrom: Shuah Khan (Samsung OSG) <[email protected]>
[ Upstream commit 9a244229a4b850b11952a0df79607c69b18fd8df ]
When /dev/watchdog open fails, watchdog exits with "watchdog not enabled" message. This is incorrect when open fails due to insufficient privilege.
Fix message to clearly state the reason when open fails with EACCESS when a non-root user runs it.
--- tools/testing/selftests/watchdog/watchdog-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/selftests/watchdog/watchdog-test.c +7 -1
@@ -89,7 +89,13 @@ int main(int argc, char *argv[]) fd =open ("/dev/watchdog" ,O_WRONLY );if (fd ==-1 ) { -printf ("Watchdog device not enabled.\n" ); +if (errno ==ENOENT ) +printf ("Watchdog device not enabled.\n" ); +else if (errno ==EACCES ) +printf ("Run watchdog as root.\n" ); +else +printf ("Watchdog device open failed %s\n" , +strerror (errno));exit (-1 ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 88/211 thermal: rcar_thermal: Prevent hardware access during system suspend
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3a31386217628ffe2491695be2db933c25dde785 ]
On r8a7791/koelsch, sometimes the following message is printed during system suspend:
rcar_thermal e61f0000.thermal: thermal sensor was broken
This happens if the workqueue runs while the device is already suspended. Fix this by using the freezable system workqueue instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from happening during system suspend").
--- drivers/thermal/rcar_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/rcar_thermal.c +2 -2
@@ -401,8 +401,8 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data)rcar_thermal_for_each_priv (priv, common) {if (rcar_thermal_had_changed (priv, status)) {rcar_thermal_irq_disable (priv); -schedule_delayed_work (&priv->work, -msecs_to_jiffies (300 )); +queue_delayed_work (system_freezable_wq, &priv->work, +msecs_to_jiffies (300 )); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 90/211 powerpc/process: Fix flush_all_to_thread for SPE
In reply to Greg Kroah-HartmanFrom: Felipe Rechia <[email protected]>
[ Upstream commit e901378578c62202594cba0f6c076f3df365ec91 ]
Fix a bug introduced by the creation of flush_all_to_thread() for processors that have SPE (Signal Processing Engine) and use it to compute floating-point operations.
Quoted 1 line
From userspace perspective, the problem was seen in attempts of
computing floating-point operations which should generate exceptions. For example:
fork(); float x = 0.0 / 0.0; isnan(x); // forked process returns False (should be True)
The operation above also should always cause the SPEFSCR FINV bit to be set. However, the SPE floating-point exceptions were turned off after a fork().
Kernel versions prior to the bug used flush_spe_to_thread(), which first saves SPEFSCR register values in tsk->thread and then calls giveup_spe(tsk).
After commit 579e633e764e, the save_all() function was called first to giveup_spe(), and then the SPEFSCR register values were saved in tsk->thread. This would save the SPEFSCR register values after disabling SPE for that thread, causing the bug described above.
Fixes 579e633e764e ("powerpc: create flush_all_to_thread()")
--- arch/powerpc/kernel/process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/process.c +1 -2
@@ -567,12 +567,11 @@ void flush_all_to_thread(struct task_struct *tsk)if (tsk->thread.regs) {preempt_disable ();BUG_ON (tsk != current); -save_all (tsk); -#ifdef CONFIG_SPE if (tsk->thread.regs->msr &MSR_SPE ) tsk->thread.spefscr =mfspr (SPRN_SPEFSCR );#endif +save_all (tsk);preempt_enable (); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 91/211 sparc64: Rework xchg() definition to avoid warnings.
In reply to Greg Kroah-HartmanFrom: David S. Miller <[email protected]>
[ Upstream commit 6c2fc9cddc1ffdef8ada1dc8404e5affae849953 ]
Such as:
fs/ocfs2/file.c: In function ‘ocfs2_file_write_iter’:./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
and
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function ‘ixgbevf_xdp_setup’:./arch/sparc/include/asm/cmpxchg_64.h:55:22: warning: value computed is not used [-Wunused-value]
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
--- arch/sparc/include/asm/cmpxchg_64.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/sparc/include/asm/cmpxchg_64.h +6 -1
@@ -52,7 +52,12 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned longreturn val; } -#define xchg (ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg (ptr,x) \ +({ __typeof__(*(ptr)) __ret; \ + __ret = (__typeof__(*(ptr))) \ + __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))); \ + __ret; \ +})void __xchg_called_with_bad_pointer (void );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/211 clk: mmp2: fix the clock id for sdh2_clk and sdh3_clk
In reply to Greg Kroah-HartmanFrom: Lubomir Rintel <[email protected]>
[ Upstream commit 4917fb90eec7c26dac1497ada3bd4a325f670fcc ]
A typo that makes it impossible to get the correct clocks for MMP2_CLK_SDH2 and MMP2_CLK_SDH3.
--- drivers/clk/mmp/clk-of-mmp2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/mmp/clk-of-mmp2.c +2 -2
@@ -227,8 +227,8 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {/* The gate clocks has mux parent. */ {MMP2_CLK_SDH0, "sdh0_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, {MMP2_CLK_SDH1, "sdh1_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, - {MMP2_CLK_SDH1, "sdh2_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, - {MMP2_CLK_SDH1, "sdh3_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, + {MMP2_CLK_SDH2, "sdh2_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, + {MMP2_CLK_SDH3, "sdh3_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh_lock}, {MMP2_CLK_DISP0, "disp0_clk", "disp0_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock}, {MMP2_CLK_DISP0_SPHY, "disp0_sphy_clk", "disp0_sphy_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1024, 0x1024, 0x0, 0, &disp0_lock}, {MMP2_CLK_DISP1, "disp1_clk", "disp1_div", CLK_SET_RATE_PARENT, APMU_DISP1, 0x1b, 0x1b, 0x0, 0, &disp1_lock},
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/211 ASoC: tegra_sgtl5000: fix device_node refcounting
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit a85227da2dcc291b762c8482a505bc7d0d2d4b07 ]
Similar to the following:
commit 4321723648b0 ("ASoC: tegra_alc5632: fix device_node refcounting")
commit 7c5dfd549617 ("ASoC: tegra: fix device_node refcounting")
--- sound/soc/tegra/tegra_sgtl5000.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
sound/soc/tegra/tegra_sgtl5000.c +15 -2
@@ -149,14 +149,14 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)dev_err (&pdev->dev,"Property 'nvidia,i2s-controller' missing/invalid\n" ); ret = -EINVAL ; - goto err; + goto err_put_codec_of_node; } tegra_sgtl5000_dai.platform_of_node = tegra_sgtl5000_dai.cpu_of_node; ret =tegra_asoc_utils_init (&machine->util_data, &pdev->dev);if (ret) - goto err; + goto err_put_cpu_of_node; ret =snd_soc_register_card (card);if (ret) {
@@ -169,6 +169,13 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) err_fini_utils:tegra_asoc_utils_fini (&machine->util_data); +err_put_cpu_of_node: +of_node_put (tegra_sgtl5000_dai.cpu_of_node); + tegra_sgtl5000_dai.cpu_of_node =NULL ; + tegra_sgtl5000_dai.platform_of_node =NULL ; +err_put_codec_of_node: +of_node_put (tegra_sgtl5000_dai.codec_of_node); + tegra_sgtl5000_dai.codec_of_node =NULL ; err:return ret; }
@@ -183,6 +190,12 @@ static int tegra_sgtl5000_driver_remove(struct platform_device *pdev)tegra_asoc_utils_fini (&machine->util_data); +of_node_put (tegra_sgtl5000_dai.cpu_of_node); + tegra_sgtl5000_dai.cpu_of_node =NULL ; + tegra_sgtl5000_dai.platform_of_node =NULL ; +of_node_put (tegra_sgtl5000_dai.codec_of_node); + tegra_sgtl5000_dai.codec_of_node =NULL ; +return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/211 scsi: dc395x: fix dma API usage in srb_done
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 3a5bd7021184dec2946f2a4d7a8943f8a5713e52 ]
We can't just transfer ownership to the CPU and then unmap, as this will break with swiotlb.
Instead unmap the command and sense buffer a little earlier in the I/O completion handler and get rid of the pci_dma_sync_sg_for_cpu call entirely.
--- drivers/scsi/dc395x.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/dc395x.c +2 -5
@@ -3450,14 +3450,12 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, } } -if (dir !=PCI_DMA_NONE &&scsi_sg_count (cmd)) -pci_dma_sync_sg_for_cpu (acb->dev,scsi_sglist (cmd), -scsi_sg_count (cmd), dir); - ckc_only =0 ;/* Check Error Conditions */ ckc_e: +pci_unmap_srb (acb, srb); +if (cmd->cmnd[0 ] ==INQUIRY ) {unsigned char *base =NULL ;struct ScsiInqData *ptr;
@@ -3511,7 +3509,6 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, cmd, cmd->result);srb_free_insert (acb, srb); } -pci_unmap_srb (acb, srb); cmd->scsi_done (cmd);waiting_process_next (acb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/211 scsi: dc395x: fix DMA API usage in sg_update_list
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 6c404a68bf83b4135a8a9aa1c388ebdf98e8ba7f ]
We need to transfer device ownership to the CPU before we can manipulate the mapped data.
--- drivers/scsi/dc395x.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/scsi/dc395x.c +5 -0
@@ -1972,6 +1972,11 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) xferred -= psge->length; }else {/* Partial SG entry done */ +pci_dma_sync_single_for_cpu (srb->dcb-> + acb->dev, + srb->sg_bus_addr, +SEGMENTX_LEN , +PCI_DMA_TODEVICE ); psge->length -= xferred; psge->address += xferred; srb->sg_index = idx;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/211 scsi: isci: Use proper enumerated type in atapi_d2h_reg_frame_handler
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit e9e9a103528c7e199ead6e5374c9c52cf16b5802 ]
Clang warns when one enumerated type is implicitly converted to another.
drivers/scsi/isci/request.c:1629:13: warning: implicit conversion from enumeration type 'enum sci_io_status' to different enumeration type 'enum sci_status' [-Wenum-conversion]
status = SCI_IO_FAILURE_RESPONSE_VALID;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/isci/request.c:1631:12: warning: implicit conversion from
enumeration type 'enum sci_io_status' to different enumeration type
'enum sci_status' [-Wenum-conversion]
status = SCI_IO_FAILURE_RESPONSE_VALID;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~status is of type sci_status but SCI_IO_FAILURE_RESPONSE_VALID is of type sci_io_status. Use SCI_FAILURE_IO_RESPONSE_VALID, which is from sci_status and has SCI_IO_FAILURE_RESPONSE_VALID's exact value since that is what SCI_IO_FAILURE_RESPONSE_VALID is mapped to in the isci.h file.
--- drivers/scsi/isci/request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/isci/request.c +2 -2
@@ -1626,9 +1626,9 @@ static enum sci_status atapi_d2h_reg_frame_handler(struct isci_request *ireq,if (status ==SCI_SUCCESS ) {if (ireq->stp.rsp.status &ATA_ERR ) - status =SCI_IO_FAILURE_RESPONSE_VALID ; + status =SCI_FAILURE_IO_RESPONSE_VALID ; }else { - status =SCI_IO_FAILURE_RESPONSE_VALID ; + status =SCI_FAILURE_IO_RESPONSE_VALID ; }if (status !=SCI_SUCCESS ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 93/211 fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 999865764f5f128896402572b439269acb471022 ]
The kernel module may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16 are:
[FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 255: __dlm_put_mle in dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 254: spin_lock in dlm_put_ml
[FUNC] get_zeroed_page(GFP_NOFS) fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle fs/ocfs2/dlm/dlmmaster.c, 222: __dlm_put_mle in dlm_put_mle_inuse fs/ocfs2/dlm/dlmmaster.c, 219: spin_lock in dlm_put_mle_inuse
To fix this bug, GFP_NOFS is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool DSAC.
--- fs/ocfs2/dlm/dlmdebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlm/dlmdebug.c +1 -1
@@ -329,7 +329,7 @@ void dlm_print_one_mle(struct dlm_master_list_entry *mle) {char *buf; - buf = (char *)get_zeroed_page (GFP_NOFS ); + buf = (char *)get_zeroed_page (GFP_ATOMIC );if (buf) {dump_mle (mle, buf,PAGE_SIZE -1 );free_page ((unsigned long )buf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 103/211 powerpc/xmon: Relax frame size for clang
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 9c87156cce5a63735d1218f0096a65c50a7a32aa ]
When building with clang (8 trunk, 7.0 release) the frame size limit is hit:
arch/powerpc/xmon/xmon.c:452:12: warning: stack frame size of 2576 bytes in function 'xmon_core' [-Wframe-larger-than=]
Some investigation by Naveen indicates this is due to clang saving the addresses to printf format strings on the stack.
While this issue is investigated, bump up the frame size limit for xmon when building with clang.
--- arch/powerpc/xmon/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/xmon/Makefile +6 -0
@@ -13,6 +13,12 @@ UBSAN_SANITIZE := n ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -mno-sched-epilog,,$(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))) +ifdef CONFIG_CC_IS_CLANG +# clang stores addresses on the stack causing the frame size to blow +# out. See https://github.com/ClangBuiltLinux/linux/issues/252 +KBUILD_CFLAGS += -Wframe-larger-than=4096 +endif + ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) obj-y += xmon.o nonstdio.o spr_access.o
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 102/211 vfs: avoid problematic remapping requests into partial EOF block
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 07d19dc9fbe9128378b9e226abe886fd8fd473df ]
A deduplication data corruption is exposed in XFS and btrfs. It is caused by extending the block match range to include the partial EOF block, but then allowing unknown data beyond EOF to be considered a "match" to data in the destination file because the comparison is only made to the end of the source file. This corrupts the destination file when the source extent is shared with it.
The VFS remapping prep functions only support whole block dedupe, but we still need to appear to support whole file dedupe correctly. Hence if the dedupe request includes the last block of the souce file, don't include it in the actual dedupe operation. If the rest of the range dedupes successfully, then reject the entire request. A subsequent patch will enable us to shorten dedupe requests correctly.
When reflinking sub-file ranges, a data corruption can occur when the source file range includes a partial EOF block. This shares the unknown data beyond EOF into the second file at a position inside EOF, exposing stale data in the second file.
If the reflink request includes the last block of the souce file, only proceed with the reflink operation if it lands at or past the destination file's current EOF. If it lands within the destination file EOF, reject the entire request with -EINVAL and make the caller go the hard way. A subsequent patch will enable us to shorten reflink requests correctly.
--- fs/read_write.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
fs/read_write.c +33 -0
@@ -1709,6 +1709,34 @@ static int clone_verify_area(struct file *file, loff_t pos, u64 len, bool write)return security_file_permission (file, write ?MAY_WRITE :MAY_READ ); } +/* +* Ensure that we don't remap a partial EOF block in the middle of something +* else. Assume that the offsets have already been checked for block +* alignment. +* +* For deduplication we always scale down to the previous block because we +* can't meaningfully compare post-EOF contents. +* +* For clone we only link a partial EOF block above the destination file's EOF. +*/ +static int generic_remap_check_len (struct inode *inode_in, +struct inode *inode_out, +loff_t pos_out, +u64 *len, +bool is_dedupe) +{ +u64 blkmask =i_blocksize (inode_in) -1 ; + +if ((*len & blkmask) ==0 ) +return 0 ; + +if (is_dedupe) + *len &= ~blkmask; +else if (pos_out + *len <i_size_read (inode_out)) +return -EINVAL ; + +return 0 ; +}/* * Check that the two inodes are eligible for cloning, the ranges make
@@ -1815,6 +1843,11 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,return -EBADE ; } + ret =generic_remap_check_len (inode_in, inode_out, pos_out, len, + is_dedupe); +if (ret) +return ret; +return 1 ; }EXPORT_SYMBOL (vfs_clone_file_prep_inodes);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 104/211 selftests/powerpc/signal: Fix out-of-tree build
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 27825349d7b238533a47e3d98b8bb0efd886b752 ]
We should use TEST_GEN_PROGS, not TEST_PROGS. That tells the selftests makefile (lib.mk) that those tests are generated (built), and so it adds the $(OUTPUT) prefix for us, making the out-of-tree build work correctly.
It also means we don't need our own clean rule, lib.mk does it.
We also have to update the signal_tm rule to use $(OUTPUT).
--- tools/testing/selftests/powerpc/signal/Makefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
tools/testing/selftests/powerpc/signal/Makefile +3 -8
@@ -1,14 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_PROGS := signal signal_tm - -all: $(TEST_PROGS) - -$(TEST_PROGS): ../harness.c ../utils.c signal.S +TEST_GEN_PROGS := signal signal_tm CFLAGS += -maltivec -signal_tm: CFLAGS += -mhtm +$(OUTPUT)/signal_tm: CFLAGS += -mhtm include ../../lib.mk -clean: - rm -f $(TEST_PROGS) *.o +$(TEST_GEN_PROGS): ../harness.c ../utils.c signal.S
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 106/211 selftests/powerpc/cache_shape: Fix out-of-tree build
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 69f8117f17b332a68cd8f4bf8c2d0d3d5b84efc5 ]
Use TEST_GEN_PROGS and don't redefine all, this makes the out-of-tree build work. We need to move the extra dependencies below the include of lib.mk, because it adds the $(OUTPUT) prefix if it's defined.
We can also drop the clean rule, lib.mk does it for us.
--- tools/testing/selftests/powerpc/cache_shape/Makefile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
tools/testing/selftests/powerpc/cache_shape/Makefile +2 -7
@@ -1,11 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_PROGS := cache_shape - -all: $(TEST_PROGS) - -$(TEST_PROGS): ../harness.c ../utils.c +TEST_GEN_PROGS := cache_shape include ../../lib.mk -clean: - rm -f $(TEST_PROGS) *.o +$(TEST_GEN_PROGS): ../harness.c ../utils.c
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 107/211 linux/bitmap.h: handle constant zero-size bitmaps correctly
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
[ Upstream commit 7275b097851a5e2e0dd4da039c7e96b59ac5314e ]
The static inlines in bitmap.h do not handle a compile-time constant nbits==0 correctly (they dereference the passed src or dst pointers, despite only 0 words being valid to access). I had the 0-day buildbot chew on a patch [1] that would cause build failures for such cases without complaining, suggesting that we don't have any such users currently, at least for the 70 .config/arch combinations that was built. Should any turn up, make sure they use the out-of-line versions, which do handle nbits==0 correctly.
This is of course not the most efficient, but it's much less churn than teaching all the static inlines an "if (zero_const_nbits())", and since we don't have any current instances, this doesn't affect existing code at all.
[1] lkml.kernel.org/r/[email protected]
--- include/linux/bitmap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/bitmap.h +6 -1
@@ -185,8 +185,13 @@ extern int bitmap_print_to_pagebuf(bool list, char *buf,#define BITMAP_FIRST_WORD_MASK (start) (~0UL << ((start) & (BITS_PER_LONG - 1)))#define BITMAP_LAST_WORD_MASK (nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) +/* +* The static inlines below do not handle constant nbits==0 correctly, +* so make such users (should any ever turn up) call the out-of-line +* versions. +*/ #define small_const_nbits (nbits) \ - (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0)static inline void bitmap_zero (unsigned long *dst,unsigned int nbits) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 108/211 linux/bitmap.h: fix type of nbits in bitmap_shift_right()
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
[ Upstream commit d9873969fa8725dc6a5a21ab788c057fd8719751 ]
Most other bitmap API, including the OOL version __bitmap_shift_right, take unsigned nbits. This was accidentally left out from 2fbad29917c98.
--- include/linux/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bitmap.h +1 -1
@@ -355,7 +355,7 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start, }static inline void bitmap_shift_right (unsigned long *dst,const unsigned long *src, -unsigned int shift,int nbits) +unsigned int shift,unsigned int nbits) {if (small_const_nbits (nbits)) *dst = (*src &BITMAP_LAST_WORD_MASK (nbits)) >> shift;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 110/211 hfs: fix BUG on bnode parent update
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit ef75bcc5763d130451a99825f247d301088b790b ]
hfs_brec_update_parent() may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. It is not possible for this to happen on a valid hfs filesystem because the index nodes have fixed length keys.
For reasons I ignore, the hfs module does have support for a number of hfsplus features. A corrupt btree header may report variable length keys and trigger this BUG, so it's better to fix it.
--- fs/hfs/brec.c | 1 + 1 file changed, 1 insertion(+)
fs/hfs/brec.c +1 -0
@@ -445,6 +445,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)/* restore search_key */ hfs_bnode_read_key (node, fd->search_key,14 ); } + new_node =NULL ; }if (!rec && node->parent)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 109/211 hfsplus: fix BUG on bnode parent update
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 19a9d0f1acf75e8be8cfba19c1a34e941846fa2b ]
Creating, renaming or deleting a file may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. This bug is triggered by xfstests generic/027, somewhat rarely; here is a more reliable reproducer:
truncate -s 50M fs.iso
mkfs.hfsplus fs.iso
mount fs.iso /mnt
i=1000
while [ $i -le 2400 ]; do
touch /mnt/$i &>/dev/null
((++i))
done
i=2400
while [ $i -ge 1000 ]; do
mv /mnt/$i /mnt/$(perl -e "print $i x61") &>/dev/null
((--i))
doneThe issue is that a newly created bnode is being put twice. Reset new_node to NULL in hfs_brec_update_parent() before reaching goto again.
--- fs/hfsplus/brec.c | 1 + 1 file changed, 1 insertion(+)
fs/hfsplus/brec.c +1 -0
@@ -448,6 +448,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)/* restore search_key */ hfs_bnode_read_key (node, fd->search_key,14 ); } + new_node =NULL ; }if (!rec && node->parent)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 111/211 hfsplus: prevent btree data loss on ENOSPC
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit d92915c35bfaf763d78bf1d5ac7f183420e3bd99 ]
Inserting or deleting a record in a btree may require splitting several of its nodes. If we hit ENOSPC halfway through, the new nodes will be left orphaned and their records will be lost. This could mean lost inodes, extents or xattrs.
Henceforth, check the available disk space before making any changes. This still leaves the potential problem of corruption on ENOMEM.
The patch can be tested with xfstests generic/027.
--- fs/hfsplus/attributes.c | 10 ++++++++++ fs/hfsplus/btree.c | 44 ++++++++++++++++++++++++++--------------- fs/hfsplus/catalog.c | 24 ++++++++++++++++++++++ fs/hfsplus/extents.c | 4 ++++ fs/hfsplus/hfsplus_fs.h | 2 ++ 5 files changed, 68 insertions(+), 16 deletions(-)
fs/hfsplus/attributes.c +10 -0
@@ -217,6 +217,11 @@ int hfsplus_create_attr(struct inode *inode,if (err) goto failed_init_create_attr; +/* Fail early and avoid ENOSPC during the btree operation */ + err =hfs_bmap_reserve (fd.tree, fd.tree->depth +1 ); +if (err) + goto failed_create_attr; +if (name) { err =hfsplus_attr_build_key (sb, fd.search_key, inode->i_ino, name);
@@ -313,6 +318,11 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)if (err)return err; +/* Fail early and avoid ENOSPC during the btree operation */ + err =hfs_bmap_reserve (fd.tree, fd.tree->depth); +if (err) + goto out; +if (name) { err =hfsplus_attr_build_key (sb, fd.search_key, inode->i_ino, name);
fs/hfsplus/btree.c +28 -16
63 lines not on this page · raw message
fs/hfsplus/catalog.c +24 -0
@@ -265,6 +265,14 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,if (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * fd.tree->depth); +if (err) + goto err2; +hfsplus_cat_build_key_with_cnid (sb, fd.search_key, cnid); entry_size = hfsplus_fill_cat_thread(sb, &entry, S_ISDIR(inode->i_mode) ?
@@ -333,6 +341,14 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)if (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * (int )fd.tree->depth -2 ); +if (err) + goto out; +if (!str) {int len;
@@ -433,6 +449,14 @@ int hfsplus_rename_cat(u32 cnid,return err; dst_fd = src_fd; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most twice. +*/ + err =hfs_bmap_reserve (src_fd.tree,4 * (int )src_fd.tree->depth -1 ); +if (err) + goto out; +/* find the old dir entry and read the data */ err =hfsplus_cat_build_key (sb, src_fd.search_key, src_dir->i_ino, src_name);
fs/hfsplus/extents.c +4 -0
@@ -100,6 +100,10 @@ static int __hfsplus_ext_write_extent(struct inode *inode,if (hip->extent_state &HFSPLUS_EXT_NEW ) {if (res != -ENOENT )return res; +/* Fail early and avoid ENOSPC during the btree operation */ + res =hfs_bmap_reserve (fd->tree, fd->tree->depth +1 ); +if (res) +return res;hfs_brec_insert (fd, hip->cached_extents,sizeof (hfsplus_extent_rec)); hip->extent_state &= ~(HFSPLUS_EXT_DIRTY |HFSPLUS_EXT_NEW );
fs/hfsplus/hfsplus_fs.h +2 -0
@@ -312,6 +312,7 @@ static inline unsigned short hfsplus_min_io_size(struct super_block *sb)#define hfs_btree_open hfsplus_btree_open#define hfs_btree_close hfsplus_btree_close#define hfs_btree_write hfsplus_btree_write +#define hfs_bmap_reserve hfsplus_bmap_reserve#define hfs_bmap_alloc hfsplus_bmap_alloc#define hfs_bmap_free hfsplus_bmap_free#define hfs_bnode_read hfsplus_bnode_read
@@ -396,6 +397,7 @@ u32 hfsplus_calc_btree_clump_size(u32 block_size, u32 node_size, u64 sectors,struct hfs_btree *hfs_btree_open (struct super_block *sb,u32 id);void hfs_btree_close (struct hfs_btree *tree);int hfs_btree_write (struct hfs_btree *tree); +int hfs_bmap_reserve (struct hfs_btree *tree,int rsvd_nodes);struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree);void hfs_bmap_free (struct hfs_bnode *node);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 112/211 hfs: prevent btree data loss on ENOSPC
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 54640c7502e5ed41fbf4eedd499e85f9acc9698f ]
Inserting a new record in a btree may require splitting several of its nodes. If we hit ENOSPC halfway through, the new nodes will be left orphaned and their records will be lost. This could mean lost inodes or extents.
Henceforth, check the available disk space before making any changes. This still leaves the potential problem of corruption on ENOMEM.
There is no need to reserve space before deleting a catalog record, as we do for hfsplus. This difference is because hfs index nodes have fixed length keys.
--- fs/hfs/btree.c | 41 +++++++++++++++++++++++++---------------- fs/hfs/btree.h | 1 + fs/hfs/catalog.c | 16 ++++++++++++++++ fs/hfs/extent.c | 4 ++++ 4 files changed, 46 insertions(+), 16 deletions(-)
fs/hfs/btree.c +25 -16
@@ -220,25 +220,17 @@ static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)return node; } -struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree) +/* Make sure @tree has enough space for the @rsvd_nodes */ +int hfs_bmap_reserve (struct hfs_btree *tree,int rsvd_nodes) { -struct hfs_bnode *node, *next_node; -struct page **pagep; -u32 nidx, idx; -unsigned off; -u16 off16; -u16 len; -u8 *data, byte, m; -int i; - -while (!tree->free_nodes) { -struct inode *inode = tree->inode; -u32 count; -int res; +struct inode *inode = tree->inode; +u32 count; +int res; +while (tree->free_nodes < rsvd_nodes) { res =hfs_extend_file (inode);if (res) -return ERR_PTR (res); +return res;HFS_I (inode)->phys_size = inode->i_size = (loff_t )HFS_I (inode)->alloc_blocks *HFS_SB (tree->sb)->alloc_blksz;
@@ -246,9 +238,26 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) tree->sb->s_blocksize_bits;inode_set_bytes (inode, inode->i_size); count = inode->i_size >> tree->node_size_shift; - tree->free_nodes = count - tree->node_count; + tree->free_nodes += count - tree->node_count; tree->node_count = count; } +return 0 ; +} + +struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *tree) +{ +struct hfs_bnode *node, *next_node; +struct page **pagep; +u32 nidx, idx; +unsigned off; +u16 off16; +u16 len; +u8 *data, byte, m; +int i, res; + + res =hfs_bmap_reserve (tree,1 ); +if (res) +return ERR_PTR (res); nidx =0 ; node =hfs_bnode_find (tree, nidx);
fs/hfs/btree.h +1 -0
@@ -82,6 +82,7 @@ struct hfs_find_data {extern struct hfs_btree *hfs_btree_open (struct super_block *,u32 ,btree_keycmp );extern void hfs_btree_close (struct hfs_btree *);extern void hfs_btree_write (struct hfs_btree *); +extern int hfs_bmap_reserve (struct hfs_btree *,int );extern struct hfs_bnode *hfs_bmap_alloc (struct hfs_btree *);extern void hfs_bmap_free (struct hfs_bnode *node);
fs/hfs/catalog.c +16 -0
@@ -97,6 +97,14 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct iif (err)return err; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (fd.tree,2 * fd.tree->depth); +if (err) + goto err2; +hfs_cat_build_key (sb, fd.search_key, cnid,NULL ); entry_size = hfs_cat_build_thread(sb, &entry, S_ISDIR(inode->i_mode) ? HFS_CDR_THD : HFS_CDR_FTH,
@@ -295,6 +303,14 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,return err; dst_fd = src_fd; +/* +* Fail early and avoid ENOSPC during the btree operations. We may +* have to split the root node at most once. +*/ + err =hfs_bmap_reserve (src_fd.tree,2 * src_fd.tree->depth); +if (err) + goto out; +/* find the old dir entry and read the data */ hfs_cat_build_key (sb, src_fd.search_key, src_dir->i_ino, src_name); err =hfs_brec_find (&src_fd);
fs/hfs/extent.c +4 -0
@@ -117,6 +117,10 @@ static int __hfs_ext_write_extent(struct inode *inode, struct hfs_find_data *fd)if (HFS_I (inode)->flags &HFS_FLG_EXT_NEW ) {if (res != -ENOENT )return res; +/* Fail early and avoid ENOSPC during the btree operation */ + res =hfs_bmap_reserve (fd->tree, fd->tree->depth +1 ); +if (res) +return res;hfs_brec_insert (fd,HFS_I (inode)->cached_extents,sizeof (hfs_extent_rec));HFS_I (inode)->flags &= ~(HFS_FLG_EXT_DIRTY |HFS_FLG_EXT_NEW ); }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 113/211 hfsplus: fix return value of hfsplus_get_block()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 839c3a6a5e1fbc8542d581911b35b2cb5cd29304 ]
Direct writes to empty inodes fail with EIO. The generic direct-io code is in part to blame (a patch has been submitted as "direct-io: allow direct writes to empty inodes"), but hfsplus is worse affected than the other filesystems because the fallback to buffered I/O doesn't happen.
The problem is the return value of hfsplus_get_block() when called with !create. Change it to be more consistent with the other modules.
--- fs/hfsplus/extents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/hfsplus/extents.c +3 -1
@@ -237,7 +237,9 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock, ablock = iblock >> sbi->fs_shift;if (iblock >= hip->fs_blocks) { -if (iblock > hip->fs_blocks || !create) +if (!create) +return 0 ; +if (iblock > hip->fs_blocks)return -EIO ;if (ablock >= hip->alloc_blocks) { res =hfsplus_file_extend (inode, false);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 115/211 hfsplus: update timestamps on truncate()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit dc8844aada735890a6de109bef327f5df36a982e ]
The vfs takes care of updating ctime and mtime on ftruncate(), but on truncate() it must be done by the module.
This patch can be tested with xfstests generic/313.
--- fs/hfsplus/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/hfsplus/inode.c +1 -0
@@ -262,6 +262,7 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) }truncate_setsize (inode, attr->ia_size);hfsplus_file_truncate (inode); + inode->i_mtime = inode->i_ctime =current_time (inode); }setattr_copy (inode, attr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 114/211 hfs: fix return value of hfs_get_block()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 1267a07be5ebbff2d2739290f3d043ae137c15b4 ]
Direct writes to empty inodes fail with EIO. The generic direct-io code is in part to blame (a patch has been submitted as "direct-io: allow direct writes to empty inodes"), but hfs is worse affected than the other filesystems because the fallback to buffered I/O doesn't happen.
The problem is the return value of hfs_get_block() when called with !create. Change it to be more consistent with the other modules.
--- fs/hfs/extent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/hfs/extent.c +3 -1
@@ -345,7 +345,9 @@ int hfs_get_block(struct inode *inode, sector_t block, ablock = (u32 )block /HFS_SB (sb)->fs_div;if (block >=HFS_I (inode)->fs_blocks) { -if (block >HFS_I (inode)->fs_blocks || !create) +if (!create) +return 0 ; +if (block >HFS_I (inode)->fs_blocks)return -EIO ;if (ablock >=HFS_I (inode)->alloc_blocks) { res =hfs_extend_file (inode);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 117/211 fs/hfs/extent.c: fix array out of bounds read of array extent
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 6c9a3f843a29d6894dfc40df338b91dbd78f0ae3 ]
Currently extent and index i are both being incremented causing an array out of bounds read on extent[i]. Fix this by removing the extraneous increment of extent.
Ernesto said:
: This is only triggered when deleting a file with a resource fork. I : may be wrong because the documentation isn't clear, but I don't think : you can create those under linux. So I guess nobody was testing them. :
: > A disk space leak, perhaps?
:
: That's what it looks like in general. hfs_free_extents() won't do : anything if the block count doesn't add up, and the error will be : ignored. Now, if the block count randomly does add up, we could see : some corruption.
Detected by CoverityScan, CID#711541 ("Out of bounds read")
--- fs/hfs/extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/extent.c +1 -1
@@ -304,7 +304,7 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type)return 0 ; blocks =0 ; -for (i =0 ; i <3 ; extent++, i++) +for (i =0 ; i <3 ; i++) blocks +=be16_to_cpu (extent[i].count); res =hfs_free_extents (sb, extent, blocks, blocks);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 116/211 hfs: update timestamp on truncate()
In reply to Greg Kroah-HartmanFrom: Ernesto A. Fernández <[email protected]>
[ Upstream commit 8cd3cb5061730af085a3f9890a3352f162b4e20c ]
The vfs takes care of updating mtime on ftruncate(), but on truncate() it must be done by the module.
--- fs/hfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/hfs/inode.c +2 -0
@@ -642,6 +642,8 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)truncate_setsize (inode, attr->ia_size);hfs_file_truncate (inode); + inode->i_atime = inode->i_mtime = inode->i_ctime = +current_time (inode); }setattr_copy (inode, attr);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 119/211 igb: shorten maximum PHC timecounter update interval
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
[ Upstream commit 094bf4d0e9657f6ea1ee3d7e07ce3970796949ce ]
The timecounter needs to be updated at least once per ~550 seconds in order to avoid a 40-bit SYSTIM timestamp to be misinterpreted as an old timestamp.
Since commit 500462a9d ("timers: Switch to a non-cascading wheel"), scheduling of delayed work seems to be less accurate and a requested delay of 540 seconds may actually be longer than 550 seconds. Shorten the delay to 480 seconds to be sure the timecounter is updated in time.
This fixes an issue with HW timestamps on 82580/I350/I354 being off by ~1100 seconds for few seconds every ~9 minutes.
--- drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ptp.c +7 -1
@@ -65,9 +65,15 @@* * The 40 bit 82580 SYSTIM overflows every * 2^40 * 10^-9 / 60 = 18.3 minutes. +* +* SYSTIM is converted to real time using a timecounter. As +* timecounter_cyc2time() allows old timestamps, the timecounter +* needs to be updated at least once per half of the SYSTIM interval. +* Scheduling of delayed work is not very accurate, so we aim for 8 +* minutes to be sure the actual interval is shorter than 9.16 minutes. */ -#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9) +#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8)#define IGB_PTP_TX_TIMEOUT (HZ * 15)#define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT)#define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 120/211 net: hns3: bugfix for buffer not free problem during resetting
In reply to Greg Kroah-HartmanFrom: Huazhong Tan <[email protected]>
[ Upstream commit 73b907a083b8a8c1c62cb494bc9fbe6ae086c460 ]
When hns3_get_ring_config()/hns3_queue_to_ring()/ hns3_get_vector_ring_chain() failed during resetting, the allocated memory has not been freed before these three functions return. So this patch adds error handler in these functions to fix it.
--- .../hisilicon/hns3/hns3pf/hns3_enet.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +21 -3
@@ -2300,7 +2300,7 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, chain =devm_kzalloc (&pdev->dev,sizeof (*chain),GFP_KERNEL );if (!chain) -return -ENOMEM ; + goto err_free_chain; cur_chain->next = chain; chain->tqp_index = tx_ring->tqp->tqp_index;
@@ -2324,7 +2324,7 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector,while (rx_ring) { chain =devm_kzalloc (&pdev->dev,sizeof (*chain),GFP_KERNEL );if (!chain) -return -ENOMEM ; + goto err_free_chain; cur_chain->next = chain; chain->tqp_index = rx_ring->tqp->tqp_index;
@@ -2336,6 +2336,16 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, }return 0 ; + +err_free_chain: + cur_chain = head->next; +while (cur_chain) { + chain = cur_chain->next; +devm_kfree (&pdev->dev, chain); + cur_chain = chain; + } + +return -ENOMEM ; } static void hns3_free_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector,
@@ -2530,8 +2540,10 @@ static int hns3_queue_to_ring(struct hnae3_queue *tqp,return ret; ret =hns3_ring_get_cfg (tqp, priv,HNAE3_RING_TYPE_RX ); -if (ret) +if (ret) { +devm_kfree (priv->dev, priv->ring_data[tqp->tqp_index].ring);return ret; + }return 0 ; }
@@ -2556,6 +2568,12 @@ static int hns3_get_ring_config(struct hns3_nic_priv *priv)return 0 ; err: +while (i--) { +devm_kfree (priv->dev, priv->ring_data[i].ring); +devm_kfree (priv->dev, + priv->ring_data[i + h->kinfo.num_tqps].ring); + } +devm_kfree (&pdev->dev, priv->ring_data);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 122/211 ntb: intel: fix return value for ndev_vec_mask()
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 7756e2b5d68c36e170a111dceea22f7365f83256 ]
ndev_vec_mask() should be returning u64 mask value instead of int. Otherwise the mask value returned can be incorrect for larger vectors.
--- drivers/ntb/hw/intel/ntb_hw_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/intel/ntb_hw_intel.c +1 -1
@@ -348,7 +348,7 @@ static inline int ndev_db_clear_mask(struct intel_ntb_dev *ndev, u64 db_bits,return 0 ; } -static inline int ndev_vec_mask (struct intel_ntb_dev *ndev,int db_vector) +static inline u64 ndev_vec_mask (struct intel_ntb_dev *ndev,int db_vector) {u64 shift, mask;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 123/211 arm64: makefile fix build of .i file in external module case
In reply to Greg Kroah-HartmanFrom: Victor Kamensky <[email protected]>
[ Upstream commit 98356eb0ae499c63e78073ccedd9a5fc5c563288 ]
After 'a66649dab350 arm64: fix vdso-offsets.h dependency' if one will try to build .i file in case of external kernel module, build fails complaining that prepare0 target is missing. This issue came up with SystemTap when it tries to build variety of .i files for its own generated kernel modules trying to figure given kernel features/capabilities.
The issue is that prepare0 is defined in top level Makefile only if KBUILD_EXTMOD is not defined. .i file rule depends on prepare and in case KBUILD_EXTMOD defined top level Makefile contains empty rule for prepare. But after mentioned commit arch/arm64/Makefile would introduce dependency on prepare0 through its own prepare target.
Fix it to put proper ifdef KBUILD_EXTMOD around code introduced by mentioned commit. It matches what top level Makefile does.
--- arch/arm64/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/Makefile +2 -0
@@ -149,6 +149,7 @@ archclean: $(Q)$(MAKE) $(clean)=$(boot) $(Q)$(MAKE) $(clean)=$(boot)/dts +ifeq ($(KBUILD_EXTMOD),) # We need to generate vdso-offsets.h before compiling certain files in kernel/. # In order to do that, we should use the archprepare target, but we can't since # asm-offsets.h is included in some files used to generate vdso-offsets.h, and
@@ -158,6 +159,7 @@ archclean: prepare: vdso_prepare vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h +endif define archhelp echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 124/211 ocfs2: dont put and assigning null to bh allocated outside
In reply to Greg Kroah-HartmanFrom: Changwei Ge <[email protected]>
[ Upstream commit cf76c78595ca87548ca5e45c862ac9e0949c4687 ]
ocfs2_read_blocks() and ocfs2_read_blocks_sync() are both used to read several blocks from disk. Currently, the input argument *bhs* can be NULL or NOT. It depends on the caller's behavior. If the function fails in reading blocks from disk, the corresponding bh will be assigned to NULL and put.
Obviously, above process for non-NULL input bh is not appropriate. Because the caller doesn't even know its bhs are put and re-assigned.
If buffer head is managed by caller, ocfs2_read_blocks and ocfs2_read_blocks_sync() should not evaluate it to NULL. It will cause caller accessing illegal memory, thus crash.
--- fs/ocfs2/buffer_head_io.c | 77 ++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 18 deletions(-)
fs/ocfs2/buffer_head_io.c +59 -18
@@ -99,25 +99,34 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,return ret; } +/* Caller must provide a bhs[] with all NULL or non-NULL entries, so it +* will be easier to handle read failure. +*/ int ocfs2_read_blocks_sync (struct ocfs2_super *osb,u64 block,unsigned int nr,struct buffer_head *bhs[]) {int status =0 ;unsigned int i;struct buffer_head *bh; +int new_bh =0 ;trace_ocfs2_read_blocks_sync ((unsigned long long )block, nr);if (!nr) goto bail; +/* Don't put buffer head and re-assign it to NULL if it is allocated +* outside since the caller can't be aware of this alternation! +*/ + new_bh = (bhs[0 ] ==NULL ); +for (i =0 ; i < nr ; i++) {if (bhs[i] ==NULL ) { bhs[i] =sb_getblk (osb->sb, block++);if (bhs[i] ==NULL ) { status = -ENOMEM ;mlog_errno (status); - goto bail; +break ; } } bh = bhs[i];
@@ -157,9 +166,26 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,submit_bh (REQ_OP_READ ,0 , bh); } +read_failure:for (i = nr; i >0 ; i--) { bh = bhs[i -1 ]; +if (unlikely (status)) { +if (new_bh && bh) { +/* If middle bh fails, let previous bh +* finish its read and then put it to +* aovoid bh leak +*/ +if (!buffer_jbd (bh)) +wait_on_buffer (bh); +put_bh (bh); + bhs[i -1 ] =NULL ; + }else if (bh &&buffer_uptodate (bh)) { +clear_buffer_uptodate (bh); + } +continue ; + } +/* No need to wait on the buffer if it's managed by JBD. */ if (!buffer_jbd (bh))wait_on_buffer (bh);
@@ -169,8 +195,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,* so we can safely record this and loop back * to cleanup the other buffers. */ status = -EIO ; -put_bh (bh); - bhs[i -1 ] =NULL ; + goto read_failure; } }
@@ -178,6 +203,9 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,return status; } +/* Caller must provide a bhs[] with all NULL or non-NULL entries, so it +* will be easier to handle read failure. +*/ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, struct buffer_head *bhs[], int flags, int (*validate)(struct super_block *sb,
@@ -187,6 +215,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,int i, ignore_cache =0 ;struct buffer_head *bh;struct super_block *sb =ocfs2_metadata_cache_get_super (ci); +int new_bh =0 ;trace_ocfs2_read_blocks_begin (ci, (unsigned long long )block, nr, flags);
@@ -212,6 +241,11 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, goto bail; } +/* Don't put buffer head and re-assign it to NULL if it is allocated +* outside since the caller can't be aware of this alternation! +*/ + new_bh = (bhs[0 ] ==NULL ); +ocfs2_metadata_cache_io_lock (ci);for (i =0 ; i < nr ; i++) {if (bhs[i] ==NULL ) {
@@ -220,7 +254,8 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,ocfs2_metadata_cache_io_unlock (ci); status = -ENOMEM ;mlog_errno (status); - goto bail; +/* Don't forget to put previous bh! */ +break ; } } bh = bhs[i];
@@ -314,16 +349,27 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, } } - status =0 ; - +read_failure:for (i = (nr -1 ); i >=0 ; i--) { bh = bhs[i];if (!(flags &OCFS2_BH_READAHEAD )) { -if (status) { -/* Clear the rest of the buffers on error */ -put_bh (bh); - bhs[i] =NULL ; +if (unlikely (status)) { +/* Clear the buffers on error including those +* ever succeeded in reading +*/ +if (new_bh && bh) { +/* If middle bh fails, let previous bh +* finish its read and then put it to +* aovoid bh leak +*/ +if (!buffer_jbd (bh)) +wait_on_buffer (bh); +put_bh (bh); + bhs[i] =NULL ; + }else if (bh &&buffer_uptodate (bh)) { +clear_buffer_uptodate (bh); + }continue ; }/* We know this can't have changed as we hold the
@@ -341,9 +387,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,* uptodate. */ status = -EIO ;clear_buffer_needs_validate (bh); -put_bh (bh); - bhs[i] =NULL ; -continue ; + goto read_failure; }if (buffer_needs_validate (bh)) {
@@ -353,11 +397,8 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,BUG_ON (buffer_jbd (bh));clear_buffer_needs_validate (bh); status =validate (sb, bh); -if (status) { -put_bh (bh); - bhs[i] =NULL ; -continue ; - } +if (status) + goto read_failure; } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 125/211 ocfs2: fix clusters leak in ocfs2_defrag_extent()
In reply to Greg Kroah-HartmanFrom: Larry Chen <[email protected]>
[ Upstream commit 6194ae4242dec0c9d604bc05df83aa9260a899e4 ]
ocfs2_defrag_extent() might leak allocated clusters. When the file system has insufficient space, the number of claimed clusters might be less than the caller wants. If that happens, the original code might directly commit the transaction without returning clusters.
This patch is based on code in ocfs2_add_clusters_in_btree().
--- fs/ocfs2/move_extents.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/ocfs2/move_extents.c +17 -0
@@ -25,6 +25,7 @@#include "ocfs2_ioctl.h" #include "alloc.h" +#include "localalloc.h" #include "aops.h" #include "dlmglue.h" #include "extent_map.h"
@@ -222,6 +223,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,struct ocfs2_refcount_tree *ref_tree =NULL ;u32 new_phys_cpos, new_len;u64 phys_blkno =ocfs2_clusters_to_blocks (inode->i_sb, phys_cpos); +int need_free =0 ;if ((ext_flags &OCFS2_EXT_REFCOUNTED ) && *len) {BUG_ON (!ocfs2_is_refcount_inode (inode));
@@ -312,6 +314,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,if (!partial) { context->range->me_flags &= ~OCFS2_MOVE_EXT_FL_COMPLETE ; ret = -ENOSPC ; + need_free =1 ; goto out_commit; } }
@@ -336,6 +339,20 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,mlog_errno (ret); out_commit: +if (need_free && context->data_ac) { +struct ocfs2_alloc_context *data_ac = context->data_ac; + +if (context->data_ac->ac_which ==OCFS2_AC_USE_LOCAL ) +ocfs2_free_local_alloc_bits (osb, handle, data_ac, + new_phys_cpos, new_len); +else +ocfs2_free_clusters (handle, + data_ac->ac_inode, + data_ac->ac_bh, +ocfs2_clusters_to_blocks (osb->sb, new_phys_cpos), + new_len); + } +ocfs2_commit_trans (osb, handle); out_unlock_mutex:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 126/211 net: do not abort bulk send on BQL status
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit fe60faa5063822f2d555f4f326c7dd72a60929bf ]
Before calling dev_hard_start_xmit(), upper layers tried to cook optimal skb list based on BQL budget.
Problem is that GSO packets can end up comsuming more than the BQL budget.
Breaking the loop is not useful, since requeued packets are ahead of any packets still in the qdisc.
It is also more expensive, since next TX completion will push these packets later, while skbs are not in cpu caches.
It is also a behavior difference with TSO packets, that can break the BQL limit by a large amount.
Note that drivers should use __netdev_tx_sent_queue() in order to have optimal xmit_more support, and avoid useless atomic operations as shown in the following patch.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -3029,7 +3029,7 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *first, struct net_device *de } skb = next; -if (netif_xmit_stopped (txq) && skb) { +if (netif_tx_queue_stopped (txq) && skb) { rc =NETDEV_TX_BUSY ;break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 127/211 sched/topology: Fix off by one bug
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 993f0b0510dad98b4e6e39506834dab0d13fd539 ]
With the addition of the NUMA identity level, we increased @level by one and will run off the end of the array in the distance sort loop.
Fixed: 051f3ca02e46 ("sched/topology: Introduce NUMA identity node sched domain")
--- kernel/sched/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/topology.c +1 -1
@@ -1347,7 +1347,7 @@ void sched_init_numa(void)int level =0 ;int i, j, k; - sched_domains_numa_distance =kzalloc (sizeof (int ) * nr_node_ids,GFP_KERNEL ); + sched_domains_numa_distance =kzalloc (sizeof (int ) * (nr_node_ids +1 ),GFP_KERNEL );if (!sched_domains_numa_distance)return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 129/211 openvswitch: fix linking without CONFIG_NF_CONNTRACK_LABELS
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit a277d516de5f498c91d91189717ef7e01102ad27 ]
When CONFIG_CC_OPTIMIZE_FOR_DEBUGGING is enabled, the compiler fails to optimize out a dead code path, which leads to a link failure:
net/openvswitch/conntrack.o: In function `ovs_ct_set_labels':
conntrack.c:(.text+0x2e60): undefined reference to `nf_connlabels_replace'
In this configuration, we can take a shortcut, and completely remove the contrack label code. This may also help the regular optimization.
--- net/openvswitch/conntrack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/conntrack.c +2 -1
@@ -1083,7 +1083,8 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key, &info->labels.mask);if (err)return err; - }else if (labels_nonzero (&info->labels.mask)) { + }else if (IS_ENABLED (CONFIG_NF_CONNTRACK_LABELS ) && +labels_nonzero (&info->labels.mask)) { err =ovs_ct_set_labels (ct, key, &info->labels.value, &info->labels.mask);if (err)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 130/211 clk: sunxi-ng: enable so-said LDOs for A64 SoCs pll-mipi clock
In reply to Greg Kroah-HartmanFrom: Icenowy Zheng <[email protected]>
[ Upstream commit 859783d1390035e29ba850963bded2b4ffdf43b5 ]
In the user manual of A64 SoC, the bit 22 and 23 of pll-mipi control register is called "LDO{1,2}_EN", and according to the BSP source code from Allwinner , the LDOs are enabled during the clock's enabling process.
The clock failed to generate output if the two LDOs are not enabled.
Add the two bits to the clock's gate bits, so that the LDOs are enabled when the PLL is enabled.
--- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +6 -1
@@ -158,7 +158,12 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_gpu_clk, "pll-gpu",#define SUN50I_A64_PLL_MIPI_REG 0x040static struct ccu_nkm pll_mipi_clk = { - .enable =BIT (31 ), +/* +* The bit 23 and 22 are called "LDO{1,2}_EN" on the SoC's +* user manual, and by experiments the PLL doesn't work without +* these bits toggled. +*/ + .enable =BIT (31 ) |BIT (23 ) |BIT (22 ), .lock =BIT (28 ), .n =_SUNXI_CCU_MULT (8 ,4 ), .k =_SUNXI_CCU_MULT_MIN (4 ,2 ,2 ),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 96/211 macsec: let the administrator set UP state even if lowerdev is down
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 07bddef9839378bd6f95b393cf24c420529b4ef1 ]
Currently, the kernel doesn't let the administrator set a macsec device up unless its lower device is currently up. This is inconsistent, as a macsec device that is up won't automatically go down when its lower device goes down.
Now that linkstate propagation works, there's really no reason for this limitation, so let's remove it.
--- drivers/net/macsec.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/macsec.c +0 -3
@@ -2798,9 +2798,6 @@ static int macsec_dev_open(struct net_device *dev)struct net_device *real_dev = macsec->real_dev;int err; -if (!(real_dev->flags &IFF_UP )) -return -ENETDOWN ; - err =dev_uc_add (real_dev, dev->dev_addr);if (err <0 )return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 132/211 btrfs: avoid link error with CONFIG_NO_AUTO_INLINE
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7e17916b35797396f681a3270245fd29c1e4c250 ]
Note: this patch fixes a problem in a feature outside of btrfs ("kernel
hacking: add a config option to disable compiler auto-inlining") and is applied ahead of time due to cross-subsystem dependencies.
On 32-bit ARM with gcc-8, I see a link error with the addition of the CONFIG_NO_AUTO_INLINE option:
fs/btrfs/super.o: In function `btrfs_statfs':
super.c:(.text+0x67b8): undefined reference to __aeabi_uldivmod' super.c:(.text+0x67fc): undefined reference to __aeabi_uldivmod' super.c:(.text+0x6858): undefined reference to __aeabi_uldivmod' super.c:(.text+0x6920): undefined reference to __aeabi_uldivmod' super.c:(.text+0x693c): undefined reference to __aeabi_uldivmod' fs/btrfs/super.o:super.c:(.text+0x6958): more undefined references to __aeabi_uldivmod' follow
So far this is the only file that shows the behavior, so I'd propose to just work around it by marking the functions as 'static inline' that normally get inlined here.
The reference to __aeabi_uldivmod comes from a div_u64() which has an optimization for a constant division that uses a straight '/' operator when the result should be known to the compiler. My interpretation is that as we turn off inlining, gcc still expects the result to be constant but fails to use that constant value.
--- fs/btrfs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/super.c +3 -3
@@ -1863,7 +1863,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) }/* Used to sort the devices by max_avail(descending sort) */ -static int btrfs_cmp_device_free_bytes (const void *dev_info1, +static inline int btrfs_cmp_device_free_bytes (const void *dev_info1,const void *dev_info2) { if (((struct btrfs_device_info *)dev_info1)->max_avail >
@@ -1892,8 +1892,8 @@ static inline void btrfs_descending_sort_devices(* The helper to calc the free space on the devices that can be used to store * file data. */ -static int btrfs_calc_avail_data_space (struct btrfs_fs_info *fs_info, -u64 *free_bytes) +static inline int btrfs_calc_avail_data_space (struct btrfs_fs_info *fs_info, +u64 *free_bytes) {struct btrfs_device_info *devices_info;struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 133/211 wil6210: fix locking in wmi_call
In reply to Greg Kroah-HartmanFrom: Lior David <[email protected]>
[ Upstream commit dc57731dbd535880fe6ced31c229262c34df7d64 ]
Switch from spin_lock to spin_lock_irqsave, because wmi_ev_lock is used inside interrupt handler.
--- drivers/net/wireless/ath/wil6210/wmi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/wil6210/wmi.c +5 -4
@@ -1002,15 +1002,16 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, {int rc;unsigned long remain; +ulong flags;mutex_lock (&wil->wmi_mutex); -spin_lock (&wil->wmi_ev_lock); +spin_lock_irqsave (&wil->wmi_ev_lock, flags); wil->reply_id = reply_id; wil->reply_buf = reply; wil->reply_size = reply_size;reinit_completion (&wil->wmi_call); -spin_unlock (&wil->wmi_ev_lock); +spin_unlock_irqrestore (&wil->wmi_ev_lock, flags); rc =__wmi_send (wil, cmdid, buf, len);if (rc)
@@ -1030,11 +1031,11 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, } out: -spin_lock (&wil->wmi_ev_lock); +spin_lock_irqsave (&wil->wmi_ev_lock, flags); wil->reply_id =0 ; wil->reply_buf =NULL ; wil->reply_size =0 ; -spin_unlock (&wil->wmi_ev_lock); +spin_unlock_irqrestore (&wil->wmi_ev_lock, flags);mutex_unlock (&wil->wmi_mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 134/211 wlcore: Fix the return value in case of error in wlcore_vendor_cmd_smart_config_start()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3419348a97bcc256238101129d69b600ceb5cc70 ]
We return 0 unconditionally at the end of 'wlcore_vendor_cmd_smart_config_start()'.
However, 'ret' is set to some error codes in several error handling paths and we already return some error codes at the beginning of the function.
Return 'ret' instead to propagate the error code.
--- drivers/net/wireless/ti/wlcore/vendor_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/vendor_cmd.c +1 -1
@@ -66,7 +66,7 @@ wlcore_vendor_cmd_smart_config_start(struct wiphy *wiphy, out:mutex_unlock (&wl->mutex); -return 0 ; +return ret; } static int
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 97/211 block: fix the DISCARD request merge
In reply to Greg Kroah-HartmanFrom: Jianchao Wang <[email protected]>
[ Upstream commit 69840466086d2248898020a08dda52732686c4e6 ]
There are two cases when handle DISCARD merge.
If max_discard_segments == 1, the bios/requests need to be contiguous to merge. If max_discard_segments > 1, it takes every bio as a range and different range needn't to be contiguous.
But now, attempt_merge screws this up. It always consider contiguity for DISCARD for the case max_discard_segments > 1 and cannot merge contiguous DISCARD for the case max_discard_segments == 1, because rq_attempt_discard_merge always returns false in this case. This patch fixes both of the two cases above.
--- block/blk-merge.c | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-)
block/blk-merge.c +36 -10
@@ -659,6 +659,31 @@ static void blk_account_io_merge(struct request *req)part_stat_unlock (); } } +/* +* Two cases of handling DISCARD merge: +* If max_discard_segments > 1, the driver takes every bio +* as a range and send them to controller together. The ranges +* needn't to be contiguous. +* Otherwise, the bios/requests will be handled as same as +* others which should be contiguous. +*/ +static inline bool blk_discard_mergable (struct request *req) +{ +if (req_op (req) ==REQ_OP_DISCARD && +queue_max_discard_segments (req->q) >1 ) +return true; +return false; +} + +enum elv_merge blk_try_req_merge (struct request *req,struct request *next) +{ +if (blk_discard_mergable (req)) +return ELEVATOR_DISCARD_MERGE ; +else if (blk_rq_pos (req) +blk_rq_sectors (req) ==blk_rq_pos (next)) +return ELEVATOR_BACK_MERGE ; + +return ELEVATOR_NO_MERGE ; +}/* * For non-mq, this has to be called with the request spinlock acquired.
@@ -676,12 +701,6 @@ static struct request *attempt_merge(struct request_queue *q,if (req_op (req) !=req_op (next))return NULL ; -/* -* not contiguous -*/ -if (blk_rq_pos (req) +blk_rq_sectors (req) !=blk_rq_pos (next)) -return NULL ; -if (rq_data_dir (req) !=rq_data_dir (next) || req->rq_disk != next->rq_disk ||req_no_special_merge (next))
@@ -705,11 +724,19 @@ static struct request *attempt_merge(struct request_queue *q,* counts here. Handle DISCARDs separately, as they * have separate settings. */ -if (req_op (req) ==REQ_OP_DISCARD ) { + +switch (blk_try_req_merge (req, next)) { +case ELEVATOR_DISCARD_MERGE :if (!req_attempt_discard_merge (q, req, next))return NULL ; - }else if (!ll_merge_requests_fn (q, req, next)) +break ; +case ELEVATOR_BACK_MERGE : +if (!ll_merge_requests_fn (q, req, next)) +return NULL ; +break ; +default :return NULL ; + }/* * If failfast settings disagree or any of the two is already
@@ -834,8 +861,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)enum elv_merge blk_try_merge (struct request *rq,struct bio *bio) { -if (req_op (rq) ==REQ_OP_DISCARD && -queue_max_discard_segments (rq->q) >1 ) +if (blk_discard_mergable (rq))return ELEVATOR_DISCARD_MERGE ;else if (blk_rq_pos (rq) +blk_rq_sectors (rq) == bio->bi_iter.bi_sector)return ELEVATOR_BACK_MERGE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 98/211 i2c: uniphier-f: make driver robust against concurrency
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit f1fdcbbdf45d9609f3d4063b67e9ea941ba3a58f ]
This is unlikely to happen, but it is possible for a CPU to enter the interrupt handler just after wait_for_completion_timeout() has expired. If this happens, the hardware is accessed from multiple contexts concurrently.
Disable the IRQ after wait_for_completion_timeout(), and do nothing from the handler when the IRQ is disabled.
--- drivers/i2c/busses/i2c-uniphier-f.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-uniphier-f.c +16 -1
@@ -98,6 +98,7 @@ struct uniphier_fi2c_priv {unsigned int flags;unsigned int busy_cnt;unsigned int clk_cycle; +spinlock_t lock;/* IRQ synchronization */ }; static void uniphier_fi2c_fill_txfifo(struct uniphier_fi2c_priv *priv,
@@ -162,7 +163,10 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id)struct uniphier_fi2c_priv *priv = dev_id;u32 irq_status; +spin_lock (&priv->lock); + irq_status =readl (priv->membase +UNIPHIER_FI2C_INT ); + irq_status &= priv->enabled_irqs; dev_dbg(&priv->adap.dev, "interrupt: enabled_irqs=%04x, irq_status=%04x\n",
@@ -230,6 +234,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) goto handled; } +spin_unlock (&priv->lock); +return IRQ_NONE ; data_done:
@@ -246,6 +252,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) handled:uniphier_fi2c_clear_irqs (priv); +spin_unlock (&priv->lock); +return IRQ_HANDLED ; }
@@ -311,7 +319,7 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, {struct uniphier_fi2c_priv *priv =i2c_get_adapdata (adap);bool is_read = msg->flags &I2C_M_RD ; -unsigned long time_left; +unsigned long time_left, flags;dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, stop=%d\n" , is_read ?"receive" :"transmit" , msg->addr, msg->len, stop);
@@ -342,6 +350,12 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, priv->membase + UNIPHIER_FI2C_CR); time_left =wait_for_completion_timeout (&priv->comp, adap->timeout); + +spin_lock_irqsave (&priv->lock, flags); + priv->enabled_irqs =0 ; +uniphier_fi2c_set_irqs (priv); +spin_unlock_irqrestore (&priv->lock, flags); +if (!time_left) {dev_err (&adap->dev,"transaction timeout.\n" );uniphier_fi2c_recover (priv);
@@ -546,6 +560,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev) priv->clk_cycle = clk_rate / bus_speed;init_completion (&priv->comp); +spin_lock_init (&priv->lock); priv->adap.owner =THIS_MODULE ; priv->adap.algo = &uniphier_fi2c_algo; priv->adap.dev.parent = dev;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 99/211 i2c: uniphier-f: fix occasional timeout error
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 39226aaa85f002d695e3cafade3309e12ffdaecd ]
Currently, a timeout error could happen at a repeated START condition.
For a (non-repeated) START condition, the controller starts sending data when the UNIPHIER_FI2C_CR_STA bit is set. However, for a repeated START condition, the hardware starts running when the slave address is written to the TX FIFO - the write to the UNIPHIER_FI2C_CR register is actually unneeded.
Because the hardware is already running before the IRQ is enabled for a repeated START, the driver may miss the IRQ event. In most cases, this problem does not show up since modern CPUs are much faster than the I2C transfer. However, it is still possible that a context switch happens after the controller starts, but before the IRQ register is set up.
To fix this,
- Do not write UNIPHIER_FI2C_CR for repeated START conditions.
- Enable IRQ *before* writing the slave address to the TX FIFO.
- Disable IRQ for the current CPU while queuing up the TX FIFO; If the CPU is interrupted by some task, the interrupt handler might be invoked due to the empty TX FIFO before completing the setup.
--- drivers/i2c/busses/i2c-uniphier-f.c | 33 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-uniphier-f.c +25 -8
@@ -260,6 +260,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id)static void uniphier_fi2c_tx_init (struct uniphier_fi2c_priv *priv,u16 addr) { priv->enabled_irqs |=UNIPHIER_FI2C_INT_TE ; +uniphier_fi2c_set_irqs (priv); +/* do not use TX byte counter */ writel (0 , priv->membase +UNIPHIER_FI2C_TBC );/* set slave address */
@@ -292,6 +294,8 @@ static void uniphier_fi2c_rx_init(struct uniphier_fi2c_priv *priv, u16 addr) priv->enabled_irqs |=UNIPHIER_FI2C_INT_RF ; } +uniphier_fi2c_set_irqs (priv); +/* set slave address with RD bit */ writel (UNIPHIER_FI2C_DTTX_CMD |UNIPHIER_FI2C_DTTX_RD | addr <<1 , priv->membase +UNIPHIER_FI2C_DTTX );
@@ -315,14 +319,16 @@ static void uniphier_fi2c_recover(struct uniphier_fi2c_priv *priv) }static int uniphier_fi2c_master_xfer_one (struct i2c_adapter *adap, -struct i2c_msg *msg,bool stop) +struct i2c_msg *msg,bool repeat, +bool stop) {struct uniphier_fi2c_priv *priv =i2c_get_adapdata (adap);bool is_read = msg->flags &I2C_M_RD ;unsigned long time_left, flags; -dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, stop=%d\n" , - is_read ?"receive" :"transmit" , msg->addr, msg->len, stop); +dev_dbg (&adap->dev,"%s: addr=0x%02x, len=%d, repeat=%d, stop=%d\n" , + is_read ?"receive" :"transmit" , msg->addr, msg->len, + repeat, stop); priv->len = msg->len; priv->buf = msg->buf;
@@ -338,16 +344,24 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap,writel (UNIPHIER_FI2C_RST_TBRST |UNIPHIER_FI2C_RST_RBRST , priv->membase +UNIPHIER_FI2C_RST );/* reset TX/RX FIFO */ +spin_lock_irqsave (&priv->lock, flags); +if (is_read)uniphier_fi2c_rx_init (priv, msg->addr);else uniphier_fi2c_tx_init (priv, msg->addr); -uniphier_fi2c_set_irqs (priv); -dev_dbg (&adap->dev,"start condition\n" ); -writel (UNIPHIER_FI2C_CR_MST |UNIPHIER_FI2C_CR_STA , - priv->membase +UNIPHIER_FI2C_CR ); +/* +* For a repeated START condition, writing a slave address to the FIFO +* kicks the controller. So, the UNIPHIER_FI2C_CR register should be +* written only for a non-repeated START condition. +*/ +if (!repeat) +writel (UNIPHIER_FI2C_CR_MST |UNIPHIER_FI2C_CR_STA , + priv->membase +UNIPHIER_FI2C_CR ); + +spin_unlock_irqrestore (&priv->lock, flags); time_left =wait_for_completion_timeout (&priv->comp, adap->timeout);
@@ -408,6 +422,7 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) {struct i2c_msg *msg, *emsg = msgs + num; +bool repeat = false;int ret; ret =uniphier_fi2c_check_bus_busy (adap);
@@ -418,9 +433,11 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap,/* Emit STOP if it is the last message or I2C_M_STOP is set. */ bool stop = (msg +1 == emsg) || (msg->flags &I2C_M_STOP ); - ret =uniphier_fi2c_master_xfer_one (adap, msg, stop); + ret =uniphier_fi2c_master_xfer_one (adap, msg, repeat, stop);if (ret)return ret; + + repeat = !stop; }return num;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 100/211 i2c: uniphier-f: fix race condition when IRQ is cleared
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit eaba68785c2d24ebf1f0d46c24e11b79cc2f94c7 ]
The current IRQ handler clears all the IRQ status bits when it bails out. This is dangerous because it might clear away the status bits that have just been set while processing the current handler. If this happens, the IRQ event for the latest transfer is lost forever.
The IRQ status bits must be cleared *before* the next transfer is kicked.
--- drivers/i2c/busses/i2c-uniphier-f.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-uniphier-f.c +6 -5
@@ -143,9 +143,10 @@ static void uniphier_fi2c_set_irqs(struct uniphier_fi2c_priv *priv)writel (priv->enabled_irqs, priv->membase +UNIPHIER_FI2C_IE ); } -static void uniphier_fi2c_clear_irqs (struct uniphier_fi2c_priv *priv) +static void uniphier_fi2c_clear_irqs (struct uniphier_fi2c_priv *priv, +u32 mask) { -writel (-1 , priv->membase +UNIPHIER_FI2C_IC ); +writel (mask, priv->membase +UNIPHIER_FI2C_IC ); }static void uniphier_fi2c_stop (struct uniphier_fi2c_priv *priv)
@@ -172,6 +173,8 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id)"interrupt: enabled_irqs=%04x, irq_status=%04x\n" , priv->enabled_irqs, irq_status); +uniphier_fi2c_clear_irqs (priv, irq_status); +if (irq_status &UNIPHIER_FI2C_INT_STOP ) goto complete;
@@ -250,8 +253,6 @@ static irqreturn_t uniphier_fi2c_interrupt(int irq, void *dev_id) } handled: -uniphier_fi2c_clear_irqs (priv); -spin_unlock (&priv->lock);return IRQ_HANDLED ;
@@ -340,7 +341,7 @@ static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, priv->flags |=UNIPHIER_FI2C_STOP ;reinit_completion (&priv->comp); -uniphier_fi2c_clear_irqs (priv); +uniphier_fi2c_clear_irqs (priv,U32_MAX );writel (UNIPHIER_FI2C_RST_TBRST |UNIPHIER_FI2C_RST_RBRST , priv->membase +UNIPHIER_FI2C_RST );/* reset TX/RX FIFO */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 92/211 arm64: lib: use C string functions with KASAN enabled
In reply to Greg Kroah-HartmanFrom: Andrey Ryabinin <[email protected]>
[ Upstream commit 19a2ca0fb560fd7be7b5293c6b652c6d6078dcde ]
ARM64 has asm implementation of memchr(), memcmp(), str[r]chr(), str[n]cmp(), str[n]len(). KASAN don't see memory accesses in asm code, thus it can potentially miss many bugs.
Ifdef out __HAVE_ARCH_* defines of these functions when KASAN is enabled, so the generic implementations from lib/string.c will be used.
We can't just remove the asm functions because efistub uses them. And we can't have two non-weak functions either, so declare the asm functions as weak.
--- arch/arm64/include/asm/string.h | 14 ++++++++------ arch/arm64/kernel/arm64ksyms.c | 7 +++++-- arch/arm64/lib/memchr.S | 2 +- arch/arm64/lib/memcmp.S | 2 +- arch/arm64/lib/strchr.S | 2 +- arch/arm64/lib/strcmp.S | 2 +- arch/arm64/lib/strlen.S | 2 +- arch/arm64/lib/strncmp.S | 2 +- arch/arm64/lib/strnlen.S | 2 +- arch/arm64/lib/strrchr.S | 2 +- 10 files changed, 21 insertions(+), 16 deletions(-)
arch/arm64/include/asm/string.h +8 -6
@@ -16,6 +16,7 @@#ifndef __ASM_STRING_H#define __ASM_STRING_H +#ifndef CONFIG_KASAN #define __HAVE_ARCH_STRRCHRextern char *strrchr (const char *,int c);
@@ -34,6 +35,13 @@ extern __kernel_size_t strlen(const char *);#define __HAVE_ARCH_STRNLENextern __kernel_size_t strnlen (const char *,__kernel_size_t ); +#define __HAVE_ARCH_MEMCMP +extern int memcmp (const void *,const void *,size_t ); + +#define __HAVE_ARCH_MEMCHR +extern void *memchr (const void *,int ,__kernel_size_t ); +#endif +#define __HAVE_ARCH_MEMCPYextern void *memcpy (void *,const void *,__kernel_size_t );extern void *__memcpy (void *,const void *,__kernel_size_t );
@@ -42,16 +50,10 @@ extern void *__memcpy(void *, const void *, __kernel_size_t);extern void *memmove (void *,const void *,__kernel_size_t );extern void *__memmove (void *,const void *,__kernel_size_t ); -#define __HAVE_ARCH_MEMCHR -extern void *memchr (const void *,int ,__kernel_size_t ); -#define __HAVE_ARCH_MEMSETextern void *memset (void *,int ,__kernel_size_t );extern void *__memset (void *,int ,__kernel_size_t ); -#define __HAVE_ARCH_MEMCMP -extern int memcmp (const void *,const void *,size_t ); -#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHEvoid memcpy_flushcache (void *dst,const void *src,size_t cnt);
arch/arm64/kernel/arm64ksyms.c +5 -2
@@ -44,20 +44,23 @@ EXPORT_SYMBOL(__arch_copy_in_user);EXPORT_SYMBOL (memstart_addr);/* string / mem functions */ +#ifndef CONFIG_KASAN EXPORT_SYMBOL (strchr);EXPORT_SYMBOL (strrchr);EXPORT_SYMBOL (strcmp);EXPORT_SYMBOL (strncmp);EXPORT_SYMBOL (strlen);EXPORT_SYMBOL (strnlen); +EXPORT_SYMBOL (memcmp); +EXPORT_SYMBOL (memchr); +#endif +EXPORT_SYMBOL (memset);EXPORT_SYMBOL (memcpy);EXPORT_SYMBOL (memmove);EXPORT_SYMBOL (__memset);EXPORT_SYMBOL (__memcpy);EXPORT_SYMBOL (__memmove); -EXPORT_SYMBOL (memchr); -EXPORT_SYMBOL (memcmp);/* atomic bitops */ EXPORT_SYMBOL (set_bit);
arch/arm64/lib/memchr.S +1 -1
@@ -30,7 +30,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ -ENTRY(memchr) +WEAK(memchr) and w1, w1, #0xff 1: subs x2, x2, #1 b.mi 2f
arch/arm64/lib/memcmp.S +1 -1
@@ -58,7 +58,7 @@ pos .req x11 limit_wd .req x12 mask .req x13 -ENTRY(memcmp) +WEAK(memcmp) cbz limit, .Lret0 eor tmp1, src1, src2 tst tmp1, #7
arch/arm64/lib/strchr.S +1 -1
@@ -29,7 +29,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ -ENTRY(strchr) +WEAK(strchr) and w1, w1, #0xff 1: ldrb w2, [x0], #1 cmp w2, w1
arch/arm64/lib/strcmp.S +1 -1
@@ -60,7 +60,7 @@ tmp3 .req x9 zeroones .req x10 pos .req x11 -ENTRY(strcmp) +WEAK(strcmp) eor tmp1, src1, src2 mov zeroones, #REP8_01 tst tmp1, #7
arch/arm64/lib/strlen.S +1 -1
@@ -56,7 +56,7 @@ pos .req x12 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 -ENTRY(strlen) +WEAK(strlen) mov zeroones, #REP8_01 bic src, srcin, #15 ands tmp1, srcin, #15
arch/arm64/lib/strncmp.S +1 -1
@@ -64,7 +64,7 @@ limit_wd .req x13 mask .req x14 endloop .req x15 -ENTRY(strncmp) +WEAK(strncmp) cbz limit, .Lret0 eor tmp1, src1, src2 mov zeroones, #REP8_01
arch/arm64/lib/strnlen.S +1 -1
@@ -59,7 +59,7 @@ limit_wd .req x14 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 -ENTRY(strnlen) +WEAK(strnlen) cbz limit, .Lhit_limit mov zeroones, #REP8_01 bic src, srcin, #15
arch/arm64/lib/strrchr.S +1 -1
@@ -29,7 +29,7 @@ * Returns: * x0 - address of last occurrence of 'c' or 0 */ -ENTRY(strrchr) +WEAK(strrchr) mov x3, #0 and w1, w1, #0xff 1: ldrb w2, [x0], #1
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 101/211 um: Make line/tty semantics use true write IRQ
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit 917e2fd2c53eb3c4162f5397555cbd394390d4bc ]
This fixes a long standing bug where large amounts of output could freeze the tty (most commonly seen on stdio console). While the bug has always been there it became more pronounced after moving to the new interrupt controller.
The line semantics are now changed to have true IRQ write semantics which should further improve the tty/line subsystem stability and performance
--- arch/um/drivers/line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/line.c +1 -1
@@ -261,7 +261,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)if (err ==0 ) {spin_unlock (&line->lock);return IRQ_NONE ; - }else if (err <0 ) { + }else if ((err <0 ) && (err != -EAGAIN )) { line->head = line->buffer; line->tail = line->buffer; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 137/211 wireless: airo: potential buffer overflow in sprintf()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3d39e1bb1c88f32820c5f9271f2c8c2fb9a52bac ]
It looks like we wanted to print a maximum of BSSList_rid.ssidLen bytes of the ssid, but we accidentally use "%*s" (width) instead of "%.*s" (precision) so if the ssid doesn't have a NUL terminator this could lead to an overflow.
Static analysis. Not tested.
--- drivers/net/wireless/cisco/airo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/cisco/airo.c +1 -1
@@ -5464,7 +5464,7 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {we have to add a spin lock... */ rc =readBSSListRid (ai, doLoseSync, &BSSList_rid);while (rc ==0 && BSSList_rid.index !=cpu_to_le16 (0xffff )) { - ptr += sprintf(ptr, "%pM %*s rssi = %d", + ptr += sprintf(ptr, "%pM %.*s rssi = %d", BSSList_rid.bssid, (int)BSSList_rid.ssidLen, BSSList_rid.ssid,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 147/211 dlm: fix invalid free
In reply to Greg Kroah-HartmanFrom: Tycho Andersen <[email protected]>
[ Upstream commit d968b4e240cfe39d39d80483bac8bca8716fd93c ]
dlm_config_nodes() does not allocate nodes on failure, so we should not free() nodes when it fails.
--- fs/dlm/member.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/dlm/member.c +3 -2
@@ -680,7 +680,7 @@ int dlm_ls_start(struct dlm_ls *ls) error =dlm_config_nodes (ls->ls_name, &nodes, &count);if (error <0 ) - goto fail; + goto fail_rv;spin_lock (&ls->ls_recover_lock);
@@ -712,8 +712,9 @@ int dlm_ls_start(struct dlm_ls *ls)return 0 ; fail: -kfree (rv);kfree (nodes); + fail_rv: +kfree (rv);return error; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 146/211 scsi: lpfc: Correct loss of fc4 type on remote port address change
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit d83ca3ea833d7a66d49225e4191c4e37cab8f079 ]
An address change for a remote port cause PRLI for the wrong protocol to be sent. The node copy done in the discovery code skipped copying the fc4 protocols supported as well.
Fix the copy logic for the address change. Beefed up log messages in this area as well.
--- drivers/scsi/lpfc/lpfc_els.c | 26 +++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_nportdisc.c | 5 +++-- 2 files changed, 26 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +23 -3
@@ -1550,8 +1550,10 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,*/ new_ndlp =lpfc_findnode_wwpn (vport, &sp->portName); +/* return immediately if the WWPN matches ndlp */ if (new_ndlp == ndlp &&NLP_CHK_NODE_ACT (new_ndlp))return ndlp; +if (phba->sli_rev ==LPFC_SLI_REV4 ) { active_rrqs_xri_bitmap =mempool_alloc (phba->active_rrq_pool,GFP_KERNEL );
@@ -1560,9 +1562,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, phba->cfg_rrq_xri_bitmap_sz); } -lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS , -"3178 PLOGI confirm: ndlp %p x%x: new_ndlp %p\n" , - ndlp, ndlp->nlp_DID, new_ndlp); +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS |LOG_NODE , +"3178 PLOGI confirm: ndlp x%x x%x x%x: " +"new_ndlp x%x x%x x%x\n" , + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type, + (new_ndlp ? new_ndlp->nlp_DID :0 ), + (new_ndlp ? new_ndlp->nlp_flag :0 ), + (new_ndlp ? new_ndlp->nlp_fc4_type :0 ));if (!new_ndlp) { rc = memcmp(&ndlp->nlp_portname, name,
@@ -1611,6 +1617,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, phba->cfg_rrq_xri_bitmap_sz); } +/* At this point in this routine, we know new_ndlp will be +* returned. however, any previous GID_FTs that were done +* would have updated nlp_fc4_type in ndlp, so we must ensure +* new_ndlp has the right value. +*/ +if (vport->fc_flag &FC_FABRIC ) + new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type; +lpfc_unreg_rpi (vport, new_ndlp); new_ndlp->nlp_DID = ndlp->nlp_DID; new_ndlp->nlp_prev_state = ndlp->nlp_prev_state;
@@ -1732,6 +1746,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, active_rrqs_xri_bitmap) mempool_free(active_rrqs_xri_bitmap, phba->active_rrq_pool); + +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS |LOG_NODE , +"3173 PLOGI confirm exit: new_ndlp x%x x%x x%x\n" , + new_ndlp->nlp_DID, new_ndlp->nlp_flag, + new_ndlp->nlp_fc4_type); +return new_ndlp; }
drivers/scsi/lpfc/lpfc_nportdisc.c +3 -2
@@ -2829,8 +2829,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY ,"0211 DSM in event x%x on NPort x%x in " -"state %d Data: x%x\n" , - evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); +"state %d Data: x%x x%x\n" , + evt, ndlp->nlp_DID, cur_state, + ndlp->nlp_flag, ndlp->nlp_fc4_type); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, "DSM in: evt:%d ste:%d did:x%x",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 149/211 vrf: mark skb for multicast or link-local as enslaved to VRF
In reply to Greg Kroah-HartmanFrom: Mike Manning <[email protected]>
[ Upstream commit 6f12fa775530195a501fb090d092c637f32d0cc5 ]
The skb for packets that are multicast or to a link-local address are not marked as being enslaved to a VRF, if they are received on a socket bound to the VRF. This is needed for ND and it is preferable for the kernel not to have to deal with the additional use-cases if ll or mcast packets are handled as enslaved. However, this does not allow service instances listening on unbound and bound to VRF sockets to distinguish the VRF used, if packets are sent as multicast or to a link-local address. The fix is for the VRF driver to also mark these skb as being enslaved to the VRF.
--- drivers/net/vrf.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/net/vrf.c +9 -10
@@ -996,24 +996,23 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, struct sk_buff *skb) {int orig_iif = skb->skb_iif; -bool need_strict; +bool need_strict =rt6_need_strict (&ipv6_hdr (skb)->daddr); +bool is_ndisc =ipv6_ndisc_frame (skb); -/* loopback traffic; do not push through packet taps again. -* Reset pkt_type for upper layers to process skb +/* loopback, multicast & non-ND link-local traffic; do not push through +* packet taps again. Reset pkt_type for upper layers to process skb */ -if (skb->pkt_type ==PACKET_LOOPBACK ) { +if (skb->pkt_type ==PACKET_LOOPBACK || (need_strict && !is_ndisc)) { skb->dev = vrf_dev; skb->skb_iif = vrf_dev->ifindex;IP6CB (skb)->flags |=IP6SKB_L3SLAVE ; - skb->pkt_type =PACKET_HOST ; +if (skb->pkt_type ==PACKET_LOOPBACK ) + skb->pkt_type =PACKET_HOST ; goto out; } -/* if packet is NDISC or addressed to multicast or link-local -* then keep the ingress interface -*/ - need_strict =rt6_need_strict (&ipv6_hdr (skb)->daddr); -if (!ipv6_ndisc_frame (skb) && !need_strict) { +/* if packet is NDISC then keep the ingress interface */ +if (!is_ndisc) {vrf_rx_stats (vrf_dev, skb->len); skb->dev = vrf_dev; skb->skb_iif = vrf_dev->ifindex;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 152/211 sock: Reset dst when changing sk_mark via setsockopt
In reply to Greg Kroah-HartmanFrom: David Barmann <[email protected]>
[ Upstream commit 50254256f382c56bde87d970f3d0d02fdb76ec70 ]
When setting the SO_MARK socket option, if the mark changes, the dst needs to be reset so that a new route lookup is performed.
This fixes the case where an application wants to change routing by setting a new sk_mark. If this is done after some packets have already been sent, the dst is cached and has no effect.
--- net/core/sock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/sock.c +4 -2
@@ -985,10 +985,12 @@ int sock_setsockopt(struct socket *sock, int level, int optname,clear_bit (SOCK_PASSSEC , &sock->flags);break ;case SO_MARK : -if (!ns_capable (sock_net (sk)->user_ns,CAP_NET_ADMIN )) +if (!ns_capable (sock_net (sk)->user_ns,CAP_NET_ADMIN )) { ret = -EPERM ; -else + }else if (val != sk->sk_mark) { sk->sk_mark = val; +sk_dst_reset (sk); + }break ;case SO_RXQ_OVFL :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 153/211 of: unittest: allow base devicetree to have symbol metadata
In reply to Greg Kroah-HartmanFrom: Frank Rowand <[email protected]>
[ Upstream commit 5babefb7f7ab1f23861336d511cc666fa45ede82 ]
The overlay metadata nodes in the FDT created from testcases.dts are not handled properly.
The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be.
Only the first property in the /__symbols__ node was added to the live devicetree if the live devicetree already contained a /__symbols node. All of the node's properties must be added.
--- drivers/of/unittest.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-)
drivers/of/unittest.c +35 -8
@@ -910,20 +910,44 @@ static void __init of_unittest_platform_populate(void)* of np into dup node (present in live tree) and * updates parent of children of np to dup. * -* @np: node already present in live tree +* @np: node whose properties are being added to the live tree * @dup: node present in live tree to be updated */ static void update_node_properties (struct device_node *np,struct device_node *dup) {struct property *prop; +struct property *save_next;struct device_node *child; - -for_each_property_of_node (np, prop) -of_add_property (dup, prop); +int ret;for_each_child_of_node (np, child) child->parent = dup; + +/* +* "unittest internal error: unable to add testdata property" +* +* If this message reports a property in node '/__symbols__' then +* the respective unittest overlay contains a label that has the +* same name as a label in the live devicetree. The label will +* be in the live devicetree only if the devicetree source was +* compiled with the '-@' option. If you encounter this error, +* please consider renaming __all__ of the labels in the unittest +* overlay dts files with an odd prefix that is unlikely to be +* used in a real devicetree. +*/ + +/* +* open code for_each_property_of_node() because of_add_property() +* sets prop->next to NULL +*/ +for (prop = np->properties; prop !=NULL ; prop = save_next) { + save_next = prop->next; + ret =of_add_property (dup, prop); +if (ret) +pr_err ("unittest internal error: unable to add testdata property %pOF/%s" , + np, prop->name); + } }/**
@@ -932,18 +956,23 @@ static void update_node_properties(struct device_node *np,* * @np: Node to attach to live tree */ -static int attach_node_and_children (struct device_node *np) +static void attach_node_and_children (struct device_node *np) {struct device_node *next, *dup, *child;unsigned long flags;const char *full_name; full_name =kasprintf (GFP_KERNEL ,"%pOF" , np); + +if (!strcmp (full_name,"/__local_fixups__" ) || + !strcmp (full_name,"/__fixups__" )) +return ; + dup =of_find_node_by_path (full_name);kfree (full_name);if (dup) {update_node_properties (np, dup); -return 0 ; +return ; } child = np->child;
@@ -964,8 +993,6 @@ static int attach_node_and_children(struct device_node *np)attach_node_and_children (child); child = next; } - -return 0 ; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 154/211 cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces
In reply to Greg Kroah-HartmanFrom: Sriram R <[email protected]>
[ Upstream commit 113f3aaa81bd56aba02659786ed65cbd9cb9a6fc ]
Currently when an AP and STA interfaces are active in the same or different radios, regulatory settings are restored whenever the STA disconnects. This restores all channel information including dfs states in all radios. For example, if an AP interface is active in one radio and STA in another, when radar is detected on the AP interface, the dfs state of the channel will be changed to UNAVAILABLE. But when the STA interface disconnects, this issues a regulatory disconnect hint which restores all regulatory settings in all the radios attached and thereby losing the stored dfs state on the other radio where the channel was marked as unavailable earlier. Hence prevent such regulatory restore whenever another active beaconing interface is present in the same or other radios.
--- net/wireless/sme.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/wireless/sme.c +5 -1
@@ -642,11 +642,15 @@ static bool cfg80211_is_all_idle(void)* All devices must be idle as otherwise if you are actively * scanning some new beacon hints could be learned and would * count as new regulatory hints. +* Also if there is any other active beaconing interface we +* need not issue a disconnect hint and reset any info such +* as chan dfs state, etc. */ list_for_each_entry (rdev, &cfg80211_rdev_list, list) {list_for_each_entry (wdev, &rdev->wiphy.wdev_list, list) {wdev_lock (wdev); -if (wdev->conn || wdev->current_bss) +if (wdev->conn || wdev->current_bss || +cfg80211_beaconing_iface_active (wdev)) is_all_idle = false;wdev_unlock (wdev); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 156/211 pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit f24bfb39975c241374cadebbd037c17960cf1412 ]
Clang warns when one enumerated type is implicitly converted to another:
drivers/pinctrl/pinctrl-lpc18xx.c:643:29: warning: implicit conversion from enumeration type 'enum lpc18xx_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
{"nxp,gpio-pin-interrupt", PIN_CONFIG_GPIO_PIN_INT, 0},
~ ^~~~~~~~~~~~~~~~~~~~~~~drivers/pinctrl/pinctrl-lpc18xx.c:648:12: warning: implicit conversion from enumeration type 'enum lpc18xx_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
PCONFDUMP(PIN_CONFIG_GPIO_PIN_INT, "gpio pin int", NULL, true), ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from macro 'PCONFDUMP'
.param = a, .display = b, .format = c, .has_arg = d \
^2 warnings generated.
It is expected that pinctrl drivers can extend pin_config_param because of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion isn't an issue. Most drivers that take advantage of this define the PIN_CONFIG variables as constants, rather than enumerated values. Do the same thing here so that Clang no longer warns.
--- drivers/pinctrl/pinctrl-lpc18xx.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/pinctrl/pinctrl-lpc18xx.c +2 -8
@@ -630,14 +630,8 @@ static const struct pinctrl_pin_desc lpc18xx_pins[] = { LPC18XX_PIN(i2c0_sda, PIN_I2C0_SDA), }; -/** -* enum lpc18xx_pin_config_param - possible pin configuration parameters -* @PIN_CONFIG_GPIO_PIN_INT: route gpio to the gpio pin interrupt -* controller. -*/ -enum lpc18xx_pin_config_param { -PIN_CONFIG_GPIO_PIN_INT =PIN_CONFIG_END +1 , -}; +/* PIN_CONFIG_GPIO_PIN_INT: route gpio to the gpio pin interrupt controller */ +#define PIN_CONFIG_GPIO_PIN_INT (PIN_CONFIG_END + 1)static const struct pinconf_generic_params lpc18xx_params[] = { {"nxp,gpio-pin-interrupt" ,PIN_CONFIG_GPIO_PIN_INT ,0 },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 138/211 rtlwifi: rtl8192de: Fix misleading REG_MCUFWDL information
In reply to Greg Kroah-HartmanFrom: Shaokun Zhang <[email protected]>
[ Upstream commit 7d129adff3afbd3a449bc3593f2064ac546d58d3 ]
RT_TRACE shows REG_MCUFWDL value as a decimal value with a '0x' prefix, which is somewhat misleading.
Fix it to print hexadecimal, as was intended.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c +1 -1
@@ -173,7 +173,7 @@ static int _rtl92d_fw_init(struct ieee80211_hw *hw) rtl_read_byte(rtlpriv, FW_MAC1_READY)); }RT_TRACE (rtlpriv,COMP_FW ,DBG_DMESG , -"Polling FW ready fail!! REG_MCUFWDL:0x%08ul\n" , +"Polling FW ready fail!! REG_MCUFWDL:0x%08x\n" ,rtl_read_dword (rtlpriv,REG_MCUFWDL ));return -1 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 158/211 PCI: keystone: Use quirk to limit MRRS for K2G
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 148e340c0696369fadbbddc8f4bef801ed247d71 ]
PCI controller in K2G also has a limitation that memory read request size (MRRS) must not exceed 256 bytes. Use the quirk to limit MRRS (added for K2HK, K2L and K2E) for K2G as well.
--- drivers/pci/dwc/pci-keystone.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/dwc/pci-keystone.c +3 -0
@@ -39,6 +39,7 @@#define PCIE_RC_K2HK 0xb008#define PCIE_RC_K2E 0xb009#define PCIE_RC_K2L 0xb00a +#define PCIE_RC_K2G 0xb00b#define to_keystone_pcie (x) dev_get_drvdata((x)->dev)
@@ -53,6 +54,8 @@ static void quirk_limit_mrrs(struct pci_dev *dev) .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L), .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, + { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2G), + .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, { 0, }, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 157/211 pinctrl: zynq: Use define directive for PIN_CONFIG_IO_STANDARD
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit cd8a145a066a1a3beb0ae615c7cb2ee4217418d7 ]
Clang warns when one enumerated type is implicitly converted to another:
drivers/pinctrl/pinctrl-zynq.c:985:18: warning: implicit conversion from enumeration type 'enum zynq_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
{"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18},
~ ^~~~~~~~~~~~~~~~~~~~~drivers/pinctrl/pinctrl-zynq.c:990:16: warning: implicit conversion from enumeration type 'enum zynq_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
= { PCONFDUMP(PIN_CONFIG_IOSTANDARD, "IO-standard", NULL, true),
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from macro 'PCONFDUMP'
.param = a, .display = b, .format = c, .has_arg = d \
^2 warnings generated.
It is expected that pinctrl drivers can extend pin_config_param because of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion isn't an issue. Most drivers that take advantage of this define the PIN_CONFIG variables as constants, rather than enumerated values. Do the same thing here so that Clang no longer warns.
--- drivers/pinctrl/pinctrl-zynq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-zynq.c +3 -6
@@ -971,15 +971,12 @@ enum zynq_io_standards {zynq_iostd_max }; -/** -* enum zynq_pin_config_param - possible pin configuration parameters -* @PIN_CONFIG_IOSTANDARD: if the pin can select an IO standard, the argument to +/* +* PIN_CONFIG_IOSTANDARD: if the pin can select an IO standard, the argument to * this parameter (on a custom format) tells the driver which alternative * IO standard to use. */ -enum zynq_pin_config_param { -PIN_CONFIG_IOSTANDARD =PIN_CONFIG_END +1 , -}; +#define PIN_CONFIG_IOSTANDARD (PIN_CONFIG_END + 1)static const struct pinconf_generic_params zynq_dt_params[] = { {"io-standard" ,PIN_CONFIG_IOSTANDARD , zynq_iostd_lvcmos18},
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 159/211 spi: omap2-mcspi: Fix DMA and FIFO event trigger size mismatch
In reply to Greg Kroah-HartmanFrom: Vignesh R <[email protected]>
[ Upstream commit baf8b9f8d260c55a86405f70a384c29cda888476 ]
Commit b682cffa3ac6 ("spi: omap2-mcspi: Set FIFO DMA trigger level to word length") broke SPI transfers where bits_per_word != 8. This is because of mimsatch between McSPI FIFO level event trigger size (SPI word length) and DMA request size(word length * maxburst). This leads to data corruption, lockup and errors like:
spi1.0: EOW timed out
Fix this by setting DMA maxburst size to 1 so that McSPI FIFO level event trigger size matches DMA request size.
--- drivers/spi/spi-omap2-mcspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-omap2-mcspi.c +2 -2
@@ -625,8 +625,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) cfg.dst_addr = cs->phys +OMAP2_MCSPI_TX0 ; cfg.src_addr_width = width; cfg.dst_addr_width = width; - cfg.src_maxburst = es; - cfg.dst_maxburst = es; + cfg.src_maxburst =1 ; + cfg.dst_maxburst =1 ; rx = xfer->rx_buf; tx = xfer->tx_buf;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 161/211 mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock
In reply to Greg Kroah-HartmanFrom: zhong jiang <[email protected]>
[ Upstream commit d2ab99403ee00d8014e651728a4702ea1ae5e52c ]
When adding the memory by probing memory block in sysfs interface, there is an obvious issue that we will unlock the device_hotplug_lock when fails to takes it.
That issue was introduced in Commit 8df1d0e4a265 ("mm/memory_hotplug: make add_memory() take the device_hotplug_lock")
We should drop out in time when fails to take the device_hotplug_lock.
--- drivers/base/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/memory.c +1 -1
@@ -519,7 +519,7 @@ memory_probe_store(struct device *dev, struct device_attribute *attr, ret =lock_device_hotplug_sysfs ();if (ret) - goto out; +return ret; nid =memory_add_physaddr_to_nid (phys_addr); ret = __add_memory(nid, phys_addr,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 162/211 ipv6: Fix handling of LLA with VRF and sockets bound to VRF
In reply to Greg Kroah-HartmanFrom: David Ahern <[email protected]>
[ Upstream commit c2027d1e17582903e368abf5d4838b22a98f2b7b ]
A recent commit allows sockets bound to a VRF to receive ipv6 link local packets. However, it only works for UDP and worse TCP connection attempts to the LLA with the only listener bound to the VRF just hang where as before the client gets a reset and connection refused. Fix by adjusting ir_iif for LL addresses and packets received through a device enslaved to a VRF.
--- net/ipv6/tcp_ipv6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/tcp_ipv6.c +2 -1
@@ -718,6 +718,7 @@ static void tcp_v6_init_req(struct request_sock *req,const struct sock *sk_listener, struct sk_buff *skb) { + bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags);struct inet_request_sock *ireq =inet_rsk (req);const struct ipv6_pinfo *np =inet6_sk (sk_listener);
@@ -725,7 +726,7 @@ static void tcp_v6_init_req(struct request_sock *req, ireq->ir_v6_loc_addr =ipv6_hdr (skb)->daddr;/* So that link locals have meaning */ -if (!sk_listener->sk_bound_dev_if && +if ((!sk_listener->sk_bound_dev_if || l3_slave) &&ipv6_addr_type (&ireq->ir_v6_rmt_addr) &IPV6_ADDR_LINKLOCAL ) ireq->ir_iif =tcp_v6_iif (skb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 163/211 cfg80211: call disconnect_wk when AP stops
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e005bd7ddea06784c1eb91ac5bb6b171a94f3b05 ]
Since we now prevent regulatory restore during STA disconnect if concurrent AP interfaces are active, we need to reschedule this check when the AP state changes. This fixes never doing a restore when an AP is the last interface to stop. Or to put it another way: we need to re-check after anything we check here changes.
--- net/wireless/ap.c | 2 ++ net/wireless/core.h | 2 ++ net/wireless/sme.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-)
net/wireless/ap.c +2 -0
@@ -40,6 +40,8 @@ int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,cfg80211_sched_dfs_chan_update (rdev); } +schedule_work (&cfg80211_disconnect_work); +return err; }
net/wireless/core.h +2 -0
@@ -429,6 +429,8 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev);bool cfg80211_does_bw_fit_range (const struct ieee80211_freq_range *freq_range,u32 center_freq_khz,u32 bw_khz); +extern struct work_struct cfg80211_disconnect_work; +/** * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable * @wiphy: the wiphy to validate against
net/wireless/sme.c +1 -1
@@ -667,7 +667,7 @@ static void disconnect_work(struct work_struct *work)rtnl_unlock (); } -static DECLARE_WORK(cfg80211_disconnect_work, disconnect_work); +DECLARE_WORK (cfg80211_disconnect_work, disconnect_work);/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 165/211 KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit a78986aae9b2988f8493f9f65a587ee433e83bc3 upstream.
Explicitly exempt ZONE_DEVICE pages from kvm_is_reserved_pfn() and instead manually handle ZONE_DEVICE on a case-by-case basis. For things like page refcounts, KVM needs to treat ZONE_DEVICE pages like normal pages, e.g. put pages grabbed via gup(). But for flows such as setting A/D bits or shifting refcounts for transparent huge pages, KVM needs to to avoid processing ZONE_DEVICE pages as the flows in question lack the underlying machinery for proper handling of ZONE_DEVICE pages.
This fixes a hang reported by Adam Borowski[*] in dev_pagemap_cleanup() when running a KVM guest backed with /dev/dax memory, as KVM straight up doesn't put any references to ZONE_DEVICE pages acquired by gup().
Note, Dan Williams proposed an alternative solution of doing put_page() on ZONE_DEVICE pages immediately after gup() in order to simplify the auditing needed to ensure is_zone_device_page() is called if and only if the backing device is pinned (via gup()). But that approach would break kvm_vcpu_{un}map() as KVM requires the page to be pinned from map() 'til unmap() when accessing guest memory, unlike KVM's secondary MMU, which coordinates with mmu_notifier invalidations to avoid creating stale page references, i.e. doesn't rely on pages being pinned.
[*] http://lkml.kernel.org/r/[email protected]
--- arch/x86/kvm/mmu.c | 8 ++++---- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 26 +++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu.c +4 -4
@@ -3177,7 +3177,7 @@ static void transparent_hugepage_adjust(* here. */ if (!is_error_noslot_pfn (pfn) && !kvm_is_reserved_pfn (pfn) && - level ==PT_PAGE_TABLE_LEVEL && + !kvm_is_zone_device_pfn (pfn) && level ==PT_PAGE_TABLE_LEVEL &&PageTransCompoundMap (pfn_to_page (pfn)) && !mmu_gfn_lpage_is_disallowed (vcpu, gfn,PT_DIRECTORY_LEVEL )) {unsigned long mask;
@@ -5344,9 +5344,9 @@ restart:* the guest, and the guest page table is using 4K page size * mapping if the indirect sp has level = 1. */ -if (sp->role.direct && - !kvm_is_reserved_pfn (pfn) && -PageTransCompoundMap (pfn_to_page (pfn))) { +if (sp->role.direct && !kvm_is_reserved_pfn (pfn) && + !kvm_is_zone_device_pfn (pfn) && +PageTransCompoundMap (pfn_to_page (pfn))) {drop_spte (kvm, sptep); need_tlb_flush =1 ; goto restart;
include/linux/kvm_host.h +1 -0
@@ -890,6 +890,7 @@ int kvm_cpu_has_pending_timer(struct kvmvoid kvm_vcpu_kick (struct kvm_vcpu *vcpu);bool kvm_is_reserved_pfn (kvm_pfn_t pfn); +bool kvm_is_zone_device_pfn (kvm_pfn_t pfn);struct kvm_irq_ack_notifier {struct hlist_node link;
virt/kvm/kvm_main.c +23 -3
@@ -142,10 +142,30 @@ __weak void kvm_arch_mmu_notifier_invali { } +bool kvm_is_zone_device_pfn (kvm_pfn_t pfn) +{ +/* +* The metadata used by is_zone_device_page() to determine whether or +* not a page is ZONE_DEVICE is guaranteed to be valid if and only if +* the device has been pinned, e.g. by get_user_pages(). WARN if the +* page_count() is zero to help detect bad usage of this helper. +*/ +if (!pfn_valid (pfn) ||WARN_ON_ONCE (!page_count (pfn_to_page (pfn)))) +return false; + +return is_zone_device_page (pfn_to_page (pfn)); +} +bool kvm_is_reserved_pfn (kvm_pfn_t pfn) { +/* +* ZONE_DEVICE pages currently set PG_reserved, but from a refcounting +* perspective they are "normal" pages, albeit with slightly different +* usage rules. +*/ if (pfn_valid (pfn)) -return PageReserved (pfn_to_page (pfn)); +return PageReserved (pfn_to_page (pfn)) && + !kvm_is_zone_device_pfn (pfn);return true; }
@@ -1730,7 +1750,7 @@ static void kvm_release_pfn_dirty(kvm_pfvoid kvm_set_pfn_dirty (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn)) { +if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn)) {struct page *page =pfn_to_page (pfn);if (!PageReserved (page))
@@ -1741,7 +1761,7 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty);void kvm_set_pfn_accessed (kvm_pfn_t pfn) { -if (!kvm_is_reserved_pfn (pfn)) +if (!kvm_is_reserved_pfn (pfn) && !kvm_is_zone_device_pfn (pfn))mark_page_accessed (pfn_to_page (pfn)); }EXPORT_SYMBOL_GPL (kvm_set_pfn_accessed);
Greg Kroah-Hartman
maintainerPATCH 139/211 net: dsa: bcm_sf2: Turn on PHY to allow successful registration
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit c04a17d2a9ccf1eaba1c5a56f83e997540a70556 ]
We are binding to the PHY using the SF2 slave MDIO bus that we create, binding involves reading the PHY's MII_PHYSID1/2 which won't be possible if the PHY is turned off. Temporarily turn it on/off for the bus probing to succeeed. This fixes unbind/bind problems where the port connecting to that PHY would be in error since it could not connect to it.
--- drivers/net/dsa/bcm_sf2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/dsa/bcm_sf2.c +4 -0
@@ -1196,12 +1196,16 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)return ret; } +bcm_sf2_gphy_enable_set (priv->dev->ds, true); + ret =bcm_sf2_mdio_register (ds);if (ret) {pr_err ("failed to register MDIO bus\n" );return ret; } +bcm_sf2_gphy_enable_set (priv->dev->ds, false); + ret =bcm_sf2_cfp_rst (priv);if (ret) {pr_err ("failed to reset CFP\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 166/211 ath10k: Fix a NULL-ptr-deref bug in ath10k_usb_alloc_urb_from_pipe
In reply to Greg Kroah-HartmanFrom: Hui Peng <[email protected]>
commit bfd6e6e6c5d2ee43a3d9902b36e01fc7527ebb27 upstream.
The ar_usb field of ath10k_usb_pipe_usb_pipe objects are initialized to point to the containing ath10k_usb object according to endpoint descriptors read from the device side, as shown below in ath10k_usb_setup_pipe_resources:
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
// get the address from endpoint descriptor
pipe_num = ath10k_usb_get_logical_pipe_num(ar_usb,
endpoint->bEndpointAddress,
&urbcount);
......
// select the pipe object
pipe = &ar_usb->pipes[pipe_num];
// initialize the ar_usb field
pipe->ar_usb = ar_usb;
}The driver assumes that the addresses reported in endpoint descriptors from device side to be complete. If a device is malicious and does not report complete addresses, it may trigger NULL-ptr-deref ath10k_usb_alloc_urb_from_pipe and ath10k_usb_free_urb_to_pipe.
This patch fixes the bug by preventing potential NULL-ptr-deref.
--- drivers/net/wireless/ath/ath10k/usb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath10k/usb.c +8 -0
@@ -49,6 +49,10 @@ ath10k_usb_alloc_urb_from_pipe(struct atstruct ath10k_urb_context *urb_context =NULL ;unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return NULL ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags);if (!list_empty (&pipe->urb_list_head)) { urb_context = list_first_entry(&pipe->urb_list_head,
@@ -66,6 +70,10 @@ static void ath10k_usb_free_urb_to_pipe( {unsigned long flags; +/* bail if this pipe is not initialized */ +if (!pipe->ar_usb) +return ; +spin_lock_irqsave (&pipe->ar_usb->cs_lock, flags); pipe->urb_cnt++;
Greg Kroah-Hartman
maintainerPATCH 167/211 ath9k_hw: fix uninitialized variable data
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit 80e84f36412e0c5172447b6947068dca0d04ee82 upstream.
Currently, data variable in ar9003_hw_thermo_cal_apply() could be uninitialized if ar9300_otp_read_word() will fail to read the value. Initialize data variable with 0 to prevent an undefined behavior. This will be enough to handle error case when ar9300_otp_read_word() fails.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -4116,7 +4116,7 @@ static void ar9003_hw_thermometer_apply(static void ar9003_hw_thermo_cal_apply (struct ath_hw *ah) { -u32 data, ko, kg; +u32 data =0 , ko, kg;if (!AR_SREV_9462_20_OR_LATER (ah))return ;
Greg Kroah-Hartman
maintainerPATCH 168/211 md/raid10: prevent access of uninitialized resync_pages offset
In reply to Greg Kroah-HartmanFrom: John Pittman <[email protected]>
commit 45422b704db392a6d79d07ee3e3670b11048bd53 upstream.
Due to unneeded multiplication in the out_free_pages portion of r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is possible to access a resync_pages offset that has not been initialized. This access translates into a crash of the system within resync_free_pages() while passing a bad pointer to put_page(). Remove the multiplication, preventing access to the uninitialized area.
--- drivers/md/raid10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid10.c +1 -1
@@ -226,7 +226,7 @@ static void * r10buf_pool_alloc(gfp_t gf out_free_pages:while (--j >=0 ) -resync_free_pages (&rps[j *2 ]); +resync_free_pages (&rps[j]); j =0 ; out_free_bio:
Greg Kroah-Hartman
maintainerPATCH 171/211 net: phy: dp83867: increase SGMII autoneg timer duration
In reply to Greg Kroah-HartmanFrom: Max Uvarov <[email protected]>
commit 1a97a477e666cbdededab93bd3754e508f0c09d7 upstream.
After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 are 01). That is not enough to finalize autonegatiation on some devices. Increase this timer duration to maximum supported 16ms.
--- drivers/net/phy/dp83867.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/phy/dp83867.c +18 -0
@@ -33,6 +33,12 @@/* Extended Registers */ #define DP83867_CFG4 0x0031 +#define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6)) +#define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_2US (1 << 5) +#define DP83867_CFG4_SGMII_ANEG_TIMER_16MS (0 << 5) +#define DP83867_RGMIICTL 0x0032#define DP83867_STRAP_STS1 0x006E#define DP83867_RGMIIDCTL 0x0086
@@ -300,6 +306,18 @@ static int dp83867_config_init(struct phif (ret)return ret; + +/* After reset SGMII Autoneg timer is set to 2us (bits 6 and 5 +* are 01). That is not enough to finalize autoneg on some +* devices. Increase this timer duration to maximum 16ms. +*/ + val =phy_read_mmd (phydev,DP83867_DEVADDR ,DP83867_CFG4 ); + val &= ~DP83867_CFG4_SGMII_ANEG_MASK ; + val |=DP83867_CFG4_SGMII_ANEG_TIMER_16MS ; + ret =phy_write_mmd (phydev,DP83867_DEVADDR ,DP83867_CFG4 , val); + +if (ret) +return ret; }/* Enable Interrupt output INT_OE in CFG3 register */
Greg Kroah-Hartman
maintainerPATCH 170/211 net: phy: dp83867: fix speed 10 in sgmii mode
In reply to Greg Kroah-HartmanFrom: Max Uvarov <[email protected]>
commit 333061b924539c0de081339643f45514f5f1c1e6 upstream.
For supporting 10Mps speed in SGMII mode DP83867_10M_SGMII_RATE_ADAPT bit of DP83867_10M_SGMII_CFG register has to be cleared by software. That does not affect speeds 100 and 1000 so can be done on init.
--- drivers/net/phy/dp83867.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/phy/dp83867.c +19 -0
@@ -37,6 +37,8 @@#define DP83867_STRAP_STS1 0x006E#define DP83867_RGMIIDCTL 0x0086#define DP83867_IO_MUX_CFG 0x0170 +#define DP83867_10M_SGMII_CFG 0x016F +#define DP83867_10M_SGMII_RATE_ADAPT_MASK BIT(7)#define DP83867_SW_RESET BIT(15)#define DP83867_SW_RESTART BIT(14)
@@ -283,6 +285,23 @@ static int dp83867_config_init(struct ph } } +if (phydev->interface ==PHY_INTERFACE_MODE_SGMII ) { +/* For support SPEED_10 in SGMII mode +* DP83867_10M_SGMII_RATE_ADAPT bit +* has to be cleared by software. That +* does not affect SPEED_100 and +* SPEED_1000. +*/ + val =phy_read_mmd (phydev,DP83867_DEVADDR , +DP83867_10M_SGMII_CFG ); + val &= ~DP83867_10M_SGMII_RATE_ADAPT_MASK ; + ret =phy_write_mmd (phydev,DP83867_DEVADDR , +DP83867_10M_SGMII_CFG , val); + +if (ret) +return ret; + } +/* Enable Interrupt output INT_OE in CFG3 register */ if (phy_interrupt_is_valid (phydev)) { val =phy_read (phydev,DP83867_CFG3 );
Greg Kroah-Hartman
maintainerPATCH 173/211 cpufreq: Skip cpufreq resume if its not suspended
In reply to Greg Kroah-HartmanFrom: Bo Yan <[email protected]>
commit 703cbaa601ff3fb554d1246c336ba727cc083ea0 upstream.
cpufreq_resume can be called even without preceding cpufreq_suspend. This can happen in following scenario:
suspend_devices_and_enter
--> dpm_suspend_start
--> dpm_prepare
--> device_prepare : this function errors out
--> dpm_suspend: this is skipped due to dpm_prepare failure
this means cpufreq_suspend is skipped over
--> goto Recover_platform, due to previous error
--> goto Resume_devices
--> dpm_resume_end
--> dpm_resume
--> cpufreq_resumeIn case schedutil is used as frequency governor, cpufreq_resume will eventually call sugov_start, which does following:
memset(sg_cpu, 0, sizeof(*sg_cpu));
....This effectively erases function pointer for frequency update, causing crash later on. The function pointer would have been set correctly if subsequent cpufreq_add_update_util_hook runs successfully, but that function returns earlier because cpufreq_suspend was not called:
if (WARN_ON(per_cpu(cpufreq_update_util_data, cpu)))
return;
The fix is to check cpufreq_suspended first, if it's false, that means cpufreq_suspend was not called in the first place, so do not resume cpufreq.
--- drivers/cpufreq/cpufreq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/cpufreq/cpufreq.c +3 -0
@@ -1673,6 +1673,9 @@ void cpufreq_resume(void)if (!cpufreq_driver)return ; +if (unlikely (!cpufreq_suspended)) +return ; + cpufreq_suspended = false;if (!has_target () && !cpufreq_driver->resume)
Greg Kroah-Hartman
maintainerPATCH 174/211 ocfs2: remove ocfs2_is_o2cb_active()
In reply to Greg Kroah-HartmanFrom: Gang He <[email protected]>
commit a634644751c46238df58bbfe992e30c1668388db upstream.
Remove ocfs2_is_o2cb_active(). We have similar functions to identify which cluster stack is being used via osb->osb_cluster_stack.
Secondly, the current implementation of ocfs2_is_o2cb_active() is not totally safe. Based on the design of stackglue, we need to get ocfs2_stack_lock before using ocfs2_stack related data structures, and that active_stack pointer can be NULL in the case of mount failure.
--- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/stackglue.c | 6 ------ fs/ocfs2/stackglue.h | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-)
fs/ocfs2/dlmglue.c +1 -1
@@ -3422,7 +3422,7 @@ static int ocfs2_downconvert_lock(struct* we can recover correctly from node failure. Otherwise, we may get * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. */ -if (!ocfs2_is_o2cb_active () && +if (ocfs2_userspace_stack (osb) && lockres->l_ops->flags &LOCK_TYPE_USES_LVB ) lvb =1 ;
fs/ocfs2/stackglue.c +0 -6
@@ -48,12 +48,6 @@ static char ocfs2_hb_ctl_path[OCFS2_MAX_*/ static struct ocfs2_stack_plugin *active_stack; -inline int ocfs2_is_o2cb_active (void ) -{ -return !strcmp (active_stack->sp_name,OCFS2_STACK_PLUGIN_O2CB ); -} -EXPORT_SYMBOL_GPL (ocfs2_is_o2cb_active); -static struct ocfs2_stack_plugin *ocfs2_stack_lookup (const char *name) {struct ocfs2_stack_plugin *p;
fs/ocfs2/stackglue.h +0 -3
@@ -298,9 +298,6 @@ void ocfs2_stack_glue_set_max_proto_versint ocfs2_stack_glue_register (struct ocfs2_stack_plugin *plugin);void ocfs2_stack_glue_unregister (struct ocfs2_stack_plugin *plugin); -/* In ocfs2_downconvert_lock(), we need to know which stack we are using */ -int ocfs2_is_o2cb_active (void ); -extern struct kset *ocfs2_kset;#endif /* STACKGLUE_H */
Greg Kroah-Hartman
maintainerPATCH 175/211 ARM: 8904/1: skip nomap memblocks while finding the lowmem/highmem boundary
In reply to Greg Kroah-HartmanFrom: Chester Lin <[email protected]>
commit 1d31999cf04c21709f72ceb17e65b54a401330da upstream.
adjust_lowmem_bounds() checks every memblocks in order to find the boundary between lowmem and highmem. However some memblocks could be marked as NOMAP so they are not used by kernel, which should be skipped while calculating the boundary.
--- arch/arm/mm/mmu.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mm/mmu.c +3 -0
@@ -1195,6 +1195,9 @@ void __init adjust_lowmem_bounds(void)phys_addr_t block_start = reg->base;phys_addr_t block_end = reg->base + reg->size; +if (memblock_is_nomap (reg)) +continue ; +if (reg->base < vmalloc_limit) {if (block_end > lowmem_limit)/*
Greg Kroah-Hartman
maintainerPATCH 140/211 scsi: mpt3sas: Fix Sync cache command failure during driver unload
In reply to Greg Kroah-HartmanFrom: Suganath Prabu <[email protected]>
[ Upstream commit 9029a72500b95578a35877a43473b82cb0386c53 ]
This is to fix SYNC CACHE and START STOP command failures with DID_NO_CONNECT during driver unload.
In driver's IO submission patch (i.e. in driver's .queuecommand()) driver won't allow any SCSI commands to the IOC when ioc->remove_host flag is set and hence SYNC CACHE commands which are issued to the target drives (where write cache is enabled) during driver unload time is failed with DID_NO_CONNECT status.
Now modified the driver to allow SYNC CACHE and START STOP commands to IOC, even when remove_host flag is set.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +35 -1
@@ -3328,6 +3328,40 @@ _scsih_tm_tr_complete(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,return _scsih_check_for_pending_tm (ioc, smid); } +/** _scsih_allow_scmd_to_device - check whether scmd needs to +* issue to IOC or not. +* @ioc: per adapter object +* @scmd: pointer to scsi command object +* +* Returns true if scmd can be issued to IOC otherwise returns false. +*/ +inline bool _scsih_allow_scmd_to_device (struct MPT3SAS_ADAPTER *ioc, +struct scsi_cmnd *scmd) +{ + +if (ioc->pci_error_recovery) +return false; + +if (ioc->hba_mpi_version_belonged ==MPI2_VERSION ) { +if (ioc->remove_host) +return false; + +return true; + } + +if (ioc->remove_host) { + +switch (scmd->cmnd[0 ]) { +case SYNCHRONIZE_CACHE : +case START_STOP : +return true; +default : +return false; + } + } + +return true; +}/** * _scsih_sas_control_complete - completion routine
@@ -4100,7 +4134,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)return 0 ; } -if (ioc->pci_error_recovery || ioc->remove_host) { +if (!(_scsih_allow_scmd_to_device (ioc, scmd))) { scmd->result =DID_NO_CONNECT <<16 ; scmd->scsi_done (scmd);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 176/211 ARC: perf: Accommodate big-endian CPU
In reply to Greg Kroah-HartmanFrom: Alexey Brodkin <[email protected]>
commit 5effc09c4907901f0e71e68e5f2e14211d9a203f upstream.
8-letter strings representing ARC perf events are stores in two 32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.
And the same order of bytes in the word is used regardless CPU endianness.
Which means in case of big-endian CPU core we need to swap bytes to get the same order as if it was on little-endian CPU.
Otherwise we're seeing the following error message on boot:
------------------------->8----------------------
ARC perf : 8 counters (32 bits), 40 conditions, [overflow IRQ support]
sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3 Stack Trace: arc_unwind_core+0xd4/0xfc dump_stack+0x64/0x80 sysfs_warn_dup+0x46/0x58 sysfs_add_file_mode_ns+0xb2/0x168 create_files+0x70/0x2a0 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 perf_event_sysfs_init+0x70/0xa0 Failed to register pmu: arc_pct, reason -17 Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3 Stack Trace: arc_unwind_core+0xd4/0xfc dump_stack+0x64/0x80 __warn+0x9c/0xd4 warn_slowpath_fmt+0x22/0x2c perf_event_sysfs_init+0x70/0xa0 ---[ end trace a75fb9a9837bd1ec ]---
------------------------->8----------------------
What happens here we're trying to register more than one raw perf event with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters and encoded into two 32-bit words. In this particular case we deal with 2 events:
* "IJMP____" which counts all jump & branch instructions
* "IJMPC___" which counts only conditional jumps & branches
Those strings are split in two 32-bit words this way "IJMP" + "____" & "IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core being big-endian then we read "PMJI" + "____" & "PMJI" + "___C".
And since we interpret read array of ASCII letters as a null-terminated string on big-endian CPU we end up with 2 events of the same name "PMJI".
--- arch/arc/kernel/perf_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/kernel/perf_event.c +2 -2
@@ -488,8 +488,8 @@ static int arc_pmu_device_probe(struct p/* loop thru all available h/w condition indexes */ for (j =0 ; j < cc_bcr.c; j++) {write_aux_reg (ARC_REG_CC_INDEX , j); - cc_name.indiv.word0 =read_aux_reg (ARC_REG_CC_NAME0 ); - cc_name.indiv.word1 =read_aux_reg (ARC_REG_CC_NAME1 ); + cc_name.indiv.word0 =le32_to_cpu (read_aux_reg (ARC_REG_CC_NAME0 )); + cc_name.indiv.word1 =le32_to_cpu (read_aux_reg (ARC_REG_CC_NAME1 ));/* See if it has been mapped to a perf event_id */ for (i =0 ; i <ARRAY_SIZE (arc_pmu_ev_hw_map); i++) {
Greg Kroah-Hartman
maintainerPATCH 178/211 x86/speculation: Fix incorrect MDS/TAA mitigation status
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit 64870ed1b12e235cfca3f6c6da75b542c973ff78 upstream.
For MDS vulnerable processors with TSX support, enabling either MDS or TAA mitigations will enable the use of VERW to flush internal processor buffers at the right code path. IOW, they are either both mitigated or both not. However, if the command line options are inconsistent, the vulnerabilites sysfs files may not report the mitigation status correctly.
For example, with only the "mds=off" option:
vulnerabilities/mds:Vulnerable; SMT vulnerable vulnerabilities/tsx_async_abort:Mitigation: Clear CPU buffers; SMT vulnerable
The mds vulnerabilities file has wrong status in this case. Similarly, the taa vulnerability file will be wrong with mds mitigation on, but taa off.
Change taa_select_mitigation() to sync up the two mitigation status and have them turned off if both "mds=off" and "tsx_async_abort=off" are present.
Update documentation to emphasize the fact that both "mds=off" and "tsx_async_abort=off" have to be specified together for processors that are affected by both TAA and MDS to be effective.
[ bp: Massage and add kernel-parameters.txt change too. ]
--- Documentation/admin-guide/hw-vuln/mds.rst | 7 +++++-- Documentation/admin-guide/hw-vuln/tsx_async_abort.rst | 5 ++++- Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ arch/x86/kernel/cpu/bugs.c | 17 +++++++++++++++-- 4 files changed, 35 insertions(+), 5 deletions(-)
Documentation/admin-guide/hw-vuln/mds.rst +5 -2
@@ -265,8 +265,11 @@ time with the option "mds=". The valid a ============ ============================================================= -Not specifying this option is equivalent to "mds=full". - +Not specifying this option is equivalent to "mds=full". For processors +that are affected by both TAA (TSX Asynchronous Abort) and MDS, +specifying just "mds=off" without an accompanying "tsx_async_abort=off" +will have no effect as the same mitigation is used for both +vulnerabilities. Mitigation selection guide --------------------------
Documentation/admin-guide/hw-vuln/tsx_async_abort.rst +4 -1
@@ -174,7 +174,10 @@ the option "tsx_async_abort=". The valid CPU is not vulnerable to cross-thread TAA attacks. ============ ============================================================= -Not specifying this option is equivalent to "tsx_async_abort=full". +Not specifying this option is equivalent to "tsx_async_abort=full". For +processors that are affected by both TAA and MDS, specifying just +"tsx_async_abort=off" without an accompanying "mds=off" will have no +effect as the same mitigation is used for both vulnerabilities. The kernel command line also allows to control the TSX feature using the parameter "tsx=" on CPUs which support TSX control. MSR_IA32_TSX_CTRL is used
Documentation/admin-guide/kernel-parameters.txt +11 -0
@@ -2254,6 +2254,12 @@ SMT on vulnerable CPUs off - Unconditionally disable MDS mitigation + On TAA-affected machines, mds=off can be prevented by + an active TAA mitigation as both vulnerabilities are + mitigated with the same mechanism so in order to disable + this mitigation, you need to specify tsx_async_abort=off + too. + Not specifying this option is equivalent to mds=full.
@@ -4588,6 +4594,11 @@ vulnerable to cross-thread TAA attacks. off - Unconditionally disable TAA mitigation + On MDS-affected machines, tsx_async_abort=off can be + prevented by an active MDS mitigation as both vulnerabilities + are mitigated with the same mechanism so in order to disable + this mitigation, you need to specify mds=off too. + Not specifying this option is equivalent to tsx_async_abort=full. On CPUs which are MDS affected and deploy MDS mitigation, TAA mitigation is not
arch/x86/kernel/cpu/bugs.c +15 -2
@@ -304,8 +304,12 @@ static void __init taa_select_mitigationreturn ; } -/* TAA mitigation is turned off on the cmdline (tsx_async_abort=off) */ -if (taa_mitigation ==TAA_MITIGATION_OFF ) +/* +* TAA mitigation via VERW is turned off if both +* tsx_async_abort=off and mds=off are specified. +*/ +if (taa_mitigation ==TAA_MITIGATION_OFF && + mds_mitigation ==MDS_MITIGATION_OFF ) goto out;if (boot_cpu_has (X86_FEATURE_MD_CLEAR ))
@@ -339,6 +343,15 @@ static void __init taa_select_mitigationif (taa_nosmt ||cpu_mitigations_auto_nosmt ())cpu_smt_disable (false); +/* +* Update MDS mitigation, if necessary, as the mds_user_clear is +* now enabled for TAA mitigation. +*/ +if (mds_mitigation ==MDS_MITIGATION_OFF && +boot_cpu_has_bug (X86_BUG_MDS )) { + mds_mitigation =MDS_MITIGATION_FULL ; +mds_select_mitigation (); + } out:pr_info ("%s\n" , taa_strings[taa_mitigation]); }
Greg Kroah-Hartman
maintainerPATCH 179/211 x86/speculation: Fix redundant MDS mitigation message
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit cd5a2aa89e847bdda7b62029d94e95488d73f6b2 upstream.
Since MDS and TAA mitigations are inter-related for processors that are affected by both vulnerabilities, the followiing confusing messages can be printed in the kernel log:
MDS: Vulnerable
MDS: Mitigation: Clear CPU buffers
To avoid the first incorrect message, defer the printing of MDS mitigation after the TAA mitigation selection has been done. However, that has the side effect of printing TAA mitigation first before MDS mitigation.
[ bp: Check box is affected/mitigations are disabled first before
printing and massage. ]
--- arch/x86/kernel/cpu/bugs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/kernel/cpu/bugs.c +13 -0
@@ -39,6 +39,7 @@ static void __init spectre_v2_select_mitstatic void __init ssb_select_mitigation (void );static void __init l1tf_select_mitigation (void );static void __init mds_select_mitigation (void ); +static void __init mds_print_mitigation (void );static void __init taa_select_mitigation (void );/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
@@ -108,6 +109,12 @@ void __init check_bugs(void)mds_select_mitigation ();taa_select_mitigation (); +/* +* As MDS and TAA mitigations are inter-related, print MDS +* mitigation until after TAA mitigation selection is done. +*/ +mds_print_mitigation (); +arch_smt_update ();#ifdef CONFIG_X86_32
@@ -245,6 +252,12 @@ static void __init mds_select_mitigation (mds_nosmt || cpu_mitigations_auto_nosmt()))cpu_smt_disable (false); } +} + +static void __init mds_print_mitigation (void ) +{ +if (!boot_cpu_has_bug (X86_BUG_MDS ) ||cpu_mitigations_off ()) +return ;pr_info ("%s\n" , mds_strings[mds_mitigation]); }
Greg Kroah-Hartman
maintainerPATCH 141/211 scsi: mpt3sas: Dont modify EEDPTagMode field setting on SAS3.5 HBA devices
In reply to Greg Kroah-HartmanFrom: Suganath Prabu <[email protected]>
[ Upstream commit 6cd1bc7b9b5075d395ba0120923903873fc7ea0e ]
If EEDPTagMode field in manufacturing page11 is set then unset it. This is needed to fix a hardware bug only in SAS3/SAS2 cards. So, skipping EEDPTagMode changes in Manufacturing page11 for SAS 3.5 controllers.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +1 -1
@@ -3140,7 +3140,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)* flag unset in NVDATA. */ mpt3sas_config_get_manufacturing_pg11 (ioc, &mpi_reply, &ioc->manu_pg11); -if (ioc->manu_pg11.EEDPTagMode ==0 ) { +if (!ioc->is_gen35_ioc && ioc->manu_pg11.EEDPTagMode ==0 ) {pr_err ("%s: overriding NVDATA EEDPTagMode setting\n" , ioc->name); ioc->manu_pg11.EEDPTagMode &= ~0x3 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 142/211 scsi: mpt3sas: Fix driver modifying persistent data in Manufacturing page11
In reply to Greg Kroah-HartmanFrom: Suganath Prabu <[email protected]>
[ Upstream commit 97f35194093362a63b33caba2485521ddabe2c95 ]
Currently driver is modifying both current & NVRAM/persistent data in Manufacturing page11. Driver should change only current copy of Manufacturing page11. It should not modify the persistent data.
So removed the section of code where driver is modifying the persistent data of Manufacturing page11.
--- drivers/scsi/mpt3sas/mpt3sas_config.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_config.c +0 -4
@@ -674,10 +674,6 @@ mpt3sas_config_set_manufacturing_pg11(struct MPT3SAS_ADAPTER *ioc, r =_config_request (ioc, &mpi_request, mpi_reply,MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT , config_page,sizeof (*config_page)); - mpi_request.Action =MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM ; - r =_config_request (ioc, &mpi_request, mpi_reply, -MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT , config_page, -sizeof (*config_page)); out:return r; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/211 scsi: megaraid_sas: Fix msleep granularity
In reply to Greg Kroah-HartmanFrom: Shivasharan S <[email protected]>
[ Upstream commit 9155cf30a3c4ef97e225d6daddf9bd4b173267e8 ]
In megasas_transition_to_ready() driver waits 180seconds for controller to change FW state. Here we are calling msleep(1) in a loop for this. As explained in timers-howto.txt, msleep(1) will actually sleep longer than 1ms. If a faulty controller is connected, we will end up waiting for much more than 180 seconds causing unnecessary delays during load.
Change the granularity of msleep() call from 1ms to 1000ms.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +2 -2
@@ -3823,12 +3823,12 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)/* * The cur_state should not last for more than max_wait secs */ -for (i =0 ; i < (max_wait *1000 ); i++) { +for (i =0 ; i < max_wait; i++) { curr_abs_state = instance->instancet->read_fw_status_reg (instance->reg_set);if (abs_state == curr_abs_state) { -msleep (1 ); +msleep (1000 ); }else break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 144/211 scsi: megaraid_sas: Fix goto labels in error handling
In reply to Greg Kroah-HartmanFrom: Shivasharan S <[email protected]>
[ Upstream commit 8a25fa17b6ed6e6c8101e9c68a10ae68a9025f2c ]
During init, if pci_alloc_irq_vectors() fails, the driver has not yet setup the IRQs. Fix the goto labels and error handling for this case.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +2 -3
@@ -5324,7 +5324,7 @@ static int megasas_init_fw(struct megasas_instance *instance)if (!instance->msix_vectors) { i =pci_alloc_irq_vectors (instance->pdev,1 ,1 ,PCI_IRQ_LEGACY );if (i <0 ) - goto fail_setup_irqs; + goto fail_init_adapter; }megasas_setup_reply_map (instance);
@@ -5541,9 +5541,8 @@ static int megasas_init_fw(struct megasas_instance *instance) fail_get_ld_pd_list: instance->instancet->disable_intr (instance); -fail_init_adapter:megasas_destroy_irqs (instance); -fail_setup_irqs: +fail_init_adapter:if (instance->msix_vectors)pci_free_irq_vectors (instance->pdev); instance->msix_vectors =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 136/211 brcmsmac: never log "tid x is not aggable" by default
In reply to Greg Kroah-HartmanFrom: Ali MJ Al-Nasrawy <[email protected]>
[ Upstream commit 96fca788e5788b7ea3b0050eb35a343637e0a465 ]
This message greatly spams the log under heavy Tx of frames with BK access class which is especially true when operating as AP. It is also not informative as the "agg'ablity" of TIDs are set once and never change.
Fix this by logging only in debug mode.
--- .../net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +2 -2
@@ -846,8 +846,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, status =brcms_c_aggregatable (wl->wlc, tid);spin_unlock_bh (&wl->lock);if (!status) { -brcms_err (wl->wlc->hw->d11core, -"START: tid %d is not agg\'able\n" , tid); +brcms_dbg_ht (wl->wlc->hw->d11core, +"START: tid %d is not agg\'able\n" , tid);return -EINVAL ; }ieee80211_start_tx_ba_cb_irqsafe (vif, sta->addr, tid);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 145/211 scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 036cad1f1ac9ce03e2db94b8460f98eaf1e1ee4c ]
On FCoE adapters, when running link bounce test in a loop, initiator failed to login with switch switch and required driver reload to recover. Switch reached a point where all subsequent FLOGIs would be LS_RJT'd. Further testing showed the condition to be related to not performing FCF discovery between FLOGI's.
Fix by monitoring FLOGI failures and once a repeated error is seen repeat FCF discovery.
--- drivers/scsi/lpfc/lpfc_els.c | 2 ++ drivers/scsi/lpfc/lpfc_hbadisc.c | 20 ++++++++++++++++++++ drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 11 ++--------- drivers/scsi/lpfc/lpfc_sli4.h | 1 + 5 files changed, 26 insertions(+), 10 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +2 -0
@@ -1152,6 +1152,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, phba->fcf.fcf_flag &= ~FCF_DISCOVERY ; phba->hba_flag &= ~(FCF_RR_INPROG |HBA_DEVLOSS_TMO );spin_unlock_irq (&phba->hbalock); + phba->fcf.fcf_redisc_attempted =0 ;/* reset */ goto out; }if (!rc) {
@@ -1166,6 +1167,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, phba->fcf.fcf_flag &= ~FCF_DISCOVERY ; phba->hba_flag &= ~(FCF_RR_INPROG |HBA_DEVLOSS_TMO );spin_unlock_irq (&phba->hbalock); + phba->fcf.fcf_redisc_attempted =0 ;/* reset */ goto out; } }
drivers/scsi/lpfc/lpfc_hbadisc.c +20 -0
@@ -1999,6 +1999,26 @@ int lpfc_sli4_fcf_rr_next_proc(struct lpfc_vport *vport, uint16_t fcf_index)"failover and change port state:x%x/x%x\n" , phba->pport->port_state, LPFC_VPORT_UNKNOWN); phba->pport->port_state =LPFC_VPORT_UNKNOWN ; + +if (!phba->fcf.fcf_redisc_attempted) { +lpfc_unregister_fcf (phba); + + rc =lpfc_sli4_redisc_fcf_table (phba); +if (!rc) { +lpfc_printf_log (phba,KERN_INFO ,LOG_FIP , +"3195 Rediscover FCF table\n" ); + phba->fcf.fcf_redisc_attempted =1 ; +lpfc_sli4_clear_fcf_rr_bmask (phba); + }else { +lpfc_printf_log (phba,KERN_WARNING ,LOG_FIP , +"3196 Rediscover FCF table " +"failed. Status:x%x\n" , rc); + } + }else { +lpfc_printf_log (phba,KERN_WARNING ,LOG_FIP , +"3197 Already rediscover FCF table " +"attempted. No more retry\n" ); + } goto stop_flogi_current_fcf; }else { lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_ELS,
drivers/scsi/lpfc/lpfc_init.c +1 -1
@@ -4997,7 +4997,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,break ; }/* If fast FCF failover rescan event is pending, do nothing */ -if (phba->fcf.fcf_flag &FCF_REDISC_EVT ) { +if (phba->fcf.fcf_flag & (FCF_REDISC_EVT |FCF_REDISC_PEND )) {spin_unlock_irq (&phba->hbalock);break ; }
drivers/scsi/lpfc/lpfc_sli.c +2 -9
@@ -18056,15 +18056,8 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba) goto initial_priority;lpfc_printf_log (phba,KERN_WARNING ,LOG_FIP ,"2844 No roundrobin failover FCF available\n" ); -if (next_fcf_index >=LPFC_SLI4_FCF_TBL_INDX_MAX ) -return LPFC_FCOE_FCF_NEXT_NONE ; -else { -lpfc_printf_log (phba,KERN_WARNING ,LOG_FIP , -"3063 Only FCF available idx %d, flag %x\n" , - next_fcf_index, - phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag); -return next_fcf_index; - } + +return LPFC_FCOE_FCF_NEXT_NONE ; } if (next_fcf_index < LPFC_SLI4_FCF_TBL_INDX_MAX &&
drivers/scsi/lpfc/lpfc_sli4.h +1 -0
@@ -265,6 +265,7 @@ struct lpfc_fcf {#define FCF_REDISC_EVT 0x100/* FCF rediscovery event to worker thread */ #define FCF_REDISC_FOV 0x200/* Post FCF rediscovery fast failover */ #define FCF_REDISC_PROG (FCF_REDISC_PEND | FCF_REDISC_EVT) +uint16_t fcf_redisc_attempted;uint32_t addr_mode;uint32_t eligible_fcf_cnt;struct lpfc_fcf_rec current_rec;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 190/211 media: usbvision: Fix races among open, close, and disconnect
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 9e08117c9d4efc1e1bc6fce83dab856d9fd284b6 upstream.
Visual inspection of the usbvision driver shows that it suffers from three races between its open, close, and disconnect handlers. In particular, the driver is careful to update its usbvision->user and usbvision->remove_pending flags while holding the private mutex, but:
usbvision_v4l2_close() and usbvision_radio_close() don't hold the mutex while they check the value of usbvision->remove_pending;
usbvision_disconnect() doesn't hold the mutex while checking the value of usbvision->user; and
also, usbvision_v4l2_open() and usbvision_radio_open() don't check whether the device has been unplugged before allowing the user to open the device files.
Each of these can potentially lead to usbvision_release() being called twice and use-after-free errors.
This patch fixes the races by reading the flags while the mutex is still held and checking for pending removes before allowing an open to succeed.
--- drivers/media/usb/usbvision/usbvision-video.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/media/usb/usbvision/usbvision-video.c +18 -3
@@ -328,6 +328,10 @@ static int usbvision_v4l2_open(struct fiif (mutex_lock_interruptible (&usbvision->v4l2_lock))return -ERESTARTSYS ; +if (usbvision->remove_pending) { + err_code = -ENODEV ; + goto unlock; + }if (usbvision->user) { err_code = -EBUSY ; }else {
@@ -391,6 +395,7 @@ unlock:static int usbvision_v4l2_close (struct file *file) {struct usb_usbvision *usbvision =video_drvdata (file); +int r;PDEBUG (DBG_IO ,"close" );
@@ -405,9 +410,10 @@ static int usbvision_v4l2_close(struct fusbvision_scratch_free (usbvision); usbvision->user--; + r = usbvision->remove_pending;mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->remove_pending) { +if (r) {printk (KERN_INFO "%s: Final disconnect\n" , __func__);usbvision_release (usbvision);return 0 ;
@@ -1091,6 +1097,11 @@ static int usbvision_radio_open(struct fif (mutex_lock_interruptible (&usbvision->v4l2_lock))return -ERESTARTSYS ; + +if (usbvision->remove_pending) { + err_code = -ENODEV ; + goto out; + } err_code =v4l2_fh_open (file);if (err_code) goto out;
@@ -1123,6 +1134,7 @@ out:static int usbvision_radio_close (struct file *file) {struct usb_usbvision *usbvision =video_drvdata (file); +int r;PDEBUG (DBG_IO ,"" );
@@ -1135,9 +1147,10 @@ static int usbvision_radio_close(structusbvision_audio_off (usbvision); usbvision->radio =0 ; usbvision->user--; + r = usbvision->remove_pending;mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->remove_pending) { +if (r) {printk (KERN_INFO "%s: Final disconnect\n" , __func__);v4l2_fh_release (file);usbvision_release (usbvision);
@@ -1562,6 +1575,7 @@ err_usb:static void usbvision_disconnect (struct usb_interface *intf) {struct usb_usbvision *usbvision =to_usbvision (usb_get_intfdata (intf)); +int u;PDEBUG (DBG_PROBE ,"" );
@@ -1578,13 +1592,14 @@ static void usbvision_disconnect(structv4l2_device_disconnect (&usbvision->v4l2_dev);usbvision_i2c_unregister (usbvision); usbvision->remove_pending =1 ;/* Now all ISO data will be ignored */ + u = usbvision->user;usb_put_dev (usbvision->dev); usbvision->dev =NULL ;/* USB device is no more */ mutex_unlock (&usbvision->v4l2_lock); -if (usbvision->user) { +if (u) {printk (KERN_INFO "%s: In use, disconnect pending\n" , __func__);wake_up_interruptible (&usbvision->wait_frame);
Greg Kroah-Hartman
maintainerPATCH 181/211 x86/doublefault/32: Fix stack canaries in the double fault handler
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 3580d0b29cab08483f84a16ce6a1151a1013695f upstream.
The double fault TSS was missing GS setup, which is needed for stack canaries to work.
--- arch/x86/kernel/doublefault.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/doublefault.c +3 -0
@@ -65,6 +65,9 @@ struct x86_hw_tss doublefault_tss __cach .ss = __KERNEL_DS, .ds = __USER_DS, .fs = __KERNEL_PERCPU, +#ifndef CONFIG_X86_32_LAZY_GS + .gs = __KERNEL_STACK_CANARY, +#endif .__cr3 = __pa_nodebug(swapper_pg_dir), };
Greg Kroah-Hartman
maintainerPATCH 193/211 media: b2c2-flexcop-usb: add sanity checking
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 1b976fc6d684e3282914cdbe7a8d68fdce19095c upstream.
The driver needs an isochronous endpoint to be present. It will oops in its absence. Add checking for it.
--- drivers/media/usb/b2c2/flexcop-usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/usb/b2c2/flexcop-usb.c +3 -0
@@ -537,6 +537,9 @@ static int flexcop_usb_probe(struct usb_struct flexcop_device *fc =NULL ;int ret; +if (intf->cur_altsetting->desc.bNumEndpoints <1 ) +return -ENODEV ; +if ((fc =flexcop_device_kmalloc (sizeof (struct flexcop_usb ))) ==NULL ) {err ("out of memory\n" );return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 192/211 media: uvcvideo: Fix error path in control parsing failure
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
commit 8c279e9394cade640ed86ec6c6645a0e7df5e0b6 upstream.
When parsing the UVC control descriptors fails, the error path tries to cleanup a media device that hasn't been initialised, potentially resulting in a crash. Fix this by initialising the media device before the error handling path can be reached.
--- drivers/media/usb/uvc/uvc_driver.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +15 -13
@@ -2059,6 +2059,20 @@ static int uvc_probe(struct usb_interfac sizeof(dev->name) - len); } +/* Initialize the media device. */ +#ifdef CONFIG_MEDIA_CONTROLLER + dev->mdev.dev = &intf->dev; +strscpy (dev->mdev.model, dev->name,sizeof (dev->mdev.model)); +if (udev->serial) +strscpy (dev->mdev.serial, udev->serial, +sizeof (dev->mdev.serial)); +usb_make_path (udev, dev->mdev.bus_info,sizeof (dev->mdev.bus_info)); + dev->mdev.hw_revision =le16_to_cpu (udev->descriptor.bcdDevice); +media_device_init (&dev->mdev); + + dev->vdev.mdev = &dev->mdev; +#endif +/* Parse the Video Class control descriptor. */ if (uvc_parse_control (dev) <0 ) { uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
@@ -2079,19 +2093,7 @@ static int uvc_probe(struct usb_interfac "linux-uvc-devel mailing list.\n"); } -/* Initialize the media device and register the V4L2 device. */ -#ifdef CONFIG_MEDIA_CONTROLLER - dev->mdev.dev = &intf->dev; -strlcpy (dev->mdev.model, dev->name,sizeof (dev->mdev.model)); -if (udev->serial) -strlcpy (dev->mdev.serial, udev->serial, -sizeof (dev->mdev.serial)); -strcpy (dev->mdev.bus_info, udev->devpath); - dev->mdev.hw_revision =le16_to_cpu (udev->descriptor.bcdDevice); -media_device_init (&dev->mdev); - - dev->vdev.mdev = &dev->mdev; -#endif +/* Register the V4L2 device. */ if (v4l2_device_register (&intf->dev, &dev->vdev) <0 ) goto error;
Greg Kroah-Hartman
maintainerPATCH 194/211 media: cxusb: detect cxusb_ctrl_msg error in query
In reply to Greg Kroah-HartmanFrom: Vito Caputo <[email protected]>
commit ca8f245f284eeffa56f3b7a5eb6fc503159ee028 upstream.
Don't use uninitialized ircode[] in cxusb_rc_query() when cxusb_ctrl_msg() fails to populate its contents.
syzbot reported:
dvb-usb: bulk message failed: -22 (1/-30591)
=====================================================
BUG: KMSAN: uninit-value in ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline] BUG: KMSAN: uninit-value in rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline] BUG: KMSAN: uninit-value in rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816 CPU: 1 PID: 11436 Comm: kworker/1:2 Not tainted 5.3.0-rc7+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events dvb_usb_read_remote_control Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x191/0x1f0 lib/dump_stack.c:113 kmsan_report+0x13a/0x2b0 mm/kmsan/kmsan_report.c:108 __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:250 bsearch+0x1dd/0x250 lib/bsearch.c:41 ir_lookup_by_scancode drivers/media/rc/rc-main.c:494 [inline] rc_g_keycode_from_table drivers/media/rc/rc-main.c:582 [inline] rc_keydown+0x1a6/0x6f0 drivers/media/rc/rc-main.c:816 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:150 [inline] kmsan_internal_chain_origin+0xd2/0x170 mm/kmsan/kmsan.c:314 __msan_chain_origin+0x6b/0xe0 mm/kmsan/kmsan_instr.c:184 rc_g_keycode_from_table drivers/media/rc/rc-main.c:583 [inline] rc_keydown+0x2c4/0x6f0 drivers/media/rc/rc-main.c:816 cxusb_rc_query+0x2e1/0x360 drivers/media/usb/dvb-usb/cxusb.c:548 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261 process_one_work+0x1572/0x1ef0 kernel/workqueue.c:2269 worker_thread+0x111b/0x2460 kernel/workqueue.c:2415 kthread+0x4b5/0x4f0 kernel/kthread.c:256 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
Local variable description: ----ircode@cxusb_rc_query Variable was created at:
cxusb_rc_query+0x4d/0x360 drivers/media/usb/dvb-usb/cxusb.c:543 dvb_usb_read_remote_control+0xf9/0x290 drivers/media/usb/dvb-usb/dvb-usb-remote.c:261
--- drivers/media/usb/dvb-usb/cxusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb/cxusb.c +2 -1
@@ -455,7 +455,8 @@ static int cxusb_rc_query(struct dvb_usb {u8 ircode[4 ]; -cxusb_ctrl_msg (d,CMD_GET_IR_CODE ,NULL ,0 , ircode,4 ); +if (cxusb_ctrl_msg (d,CMD_GET_IR_CODE ,NULL ,0 , ircode,4 ) <0 ) +return 0 ;if (ircode[2 ] || ircode[3 ]) rc_keydown(d->rc_dev, RC_PROTO_NEC,
Greg Kroah-Hartman
maintainerPATCH 196/211 virtio_ring: fix return code on DMA mapping fails
In reply to Greg Kroah-HartmanFrom: Halil Pasic <[email protected]>
[ Upstream commit f7728002c1c7bfa787b276a31c3ef458739b8e7c ]
Commit 780bc7903a32 ("virtio_ring: Support DMA APIs") makes virtqueue_add() return -EIO when we fail to map our I/O buffers. This is a very realistic scenario for guests with encrypted memory, as swiotlb may run out of space, depending on it's size and the I/O load.
The virtio-blk driver interprets -EIO form virtqueue_add() as an IO error, despite the fact that swiotlb full is in absence of bugs a recoverable condition.
Let us change the return code to -ENOMEM, and make the block layer recover form these failures when virtio-blk encounters the condition described above.
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -432,7 +432,7 @@ unmap_release:kfree (desc);END_USE (vq); -return -EIO ; +return -ENOMEM ; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 198/211 usbip: Fix uninitialized symbol nents in stub_recv_cmd_submit()
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit 2a9125317b247f2cf35c196f968906dcf062ae2d upstream.
Smatch reported that nents is not initialized and used in stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc() and used to allocate multiple URBs when host controller doesn't support scatter-gather DMA. The use of uninitialized nents means that buf_len is zero and use_sg is true. But buffer length should not be zero when an URB uses scatter-gather DMA.
To prevent this situation, add the conditional that checks buf_len and use_sg. And move the use of nents right after the sgl_alloc() to avoid the use of uninitialized nents.
If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv will be released by stub event handler and connection will be shut down.
--- drivers/usb/usbip/stub_rx.c | 50 ++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-)
drivers/usb/usbip/stub_rx.c +32 -18
@@ -487,18 +487,50 @@ static void stub_recv_cmd_submit(structif (pipe ==-1 )return ; +/* +* Smatch reported the error case where use_sg is true and buf_len is 0. +* In this case, It adds SDEV_EVENT_ERROR_MALLOC and stub_priv will be +* released by stub event handler and connection will be shut down. +*/ priv =stub_priv_alloc (sdev, pdu);if (!priv)return ; buf_len = (unsigned long long )pdu->u.cmd_submit.transfer_buffer_length; +if (use_sg && !buf_len) { +dev_err (&udev->dev,"sg buffer with zero length\n" ); + goto err_malloc; + } +/* allocate urb transfer buffer, if needed */ if (buf_len) {if (use_sg) { sgl =sgl_alloc (buf_len,GFP_KERNEL , &nents);if (!sgl) goto err_malloc; + +/* Check if the server's HCD supports SG */ +if (!udev->bus->sg_tablesize) { +/* +* If the server's HCD doesn't support SG, break +* a single SG request into several URBs and map +* each SG list entry to corresponding URB +* buffer. The previously allocated SG list is +* stored in priv->sgl (If the server's HCD +* support SG, SG list is stored only in +* urb->sg) and it is used as an indicator that +* the server split single SG request into +* several URBs. Later, priv->sgl is used by +* stub_complete() and stub_send_ret_submit() to +* reassemble the divied URBs. +*/ + support_sg =0 ; + num_urbs = nents; + priv->completed_urbs =0 ; + pdu->u.cmd_submit.transfer_flags &= + ~URB_DMA_MAP_SG ; + } }else { buffer =kzalloc (buf_len,GFP_KERNEL );if (!buffer)
@@ -506,24 +538,6 @@ static void stub_recv_cmd_submit(struct } } -/* Check if the server's HCD supports SG */ -if (use_sg && !udev->bus->sg_tablesize) { -/* -* If the server's HCD doesn't support SG, break a single SG -* request into several URBs and map each SG list entry to -* corresponding URB buffer. The previously allocated SG -* list is stored in priv->sgl (If the server's HCD support SG, -* SG list is stored only in urb->sg) and it is used as an -* indicator that the server split single SG request into -* several URBs. Later, priv->sgl is used by stub_complete() and -* stub_send_ret_submit() to reassemble the divied URBs. -*/ - support_sg =0 ; - num_urbs = nents; - priv->completed_urbs =0 ; - pdu->u.cmd_submit.transfer_flags &= ~URB_DMA_MAP_SG ; - } -/* allocate urb array */ priv->num_urbs = num_urbs; priv->urbs =kmalloc_array (num_urbs,sizeof (*priv->urbs),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 182/211 x86/cpu_entry_area: Add guard page for entry stack on 32bit
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 880a98c339961eaa074393e3a2117cbe9125b8bb upstream.
The entry stack in the cpu entry area is protected against overflow by the readonly GDT on 64-bit, but on 32-bit the GDT needs to be writeable and therefore does not trigger a fault on stack overflow.
Add a guard page.
--- arch/x86/include/asm/cpu_entry_area.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/include/asm/cpu_entry_area.h +5 -1
@@ -20,8 +20,12 @@ struct cpu_entry_area {/* * The GDT is just below entry_stack and thus serves (on x86_64) as -* a a read-only guard page. +* a read-only guard page. On 32-bit the GDT must be writeable, so +* it needs an extra guard page. */ +#ifdef CONFIG_X86_32 +char guard_entry_stack[PAGE_SIZE ]; +#endif struct entry_stack_page entry_stack_page;/*
Greg Kroah-Hartman
maintainerPATCH 200/211 USB: chaoskey: fix error case of a timeout
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 92aa5986f4f7b5a8bf282ca0f50967f4326559f5 upstream.
In case of a timeout or if a signal aborts a read communication with the device needs to be ended lest we overwrite an active URB the next time we do IO to the device, as the URB may still be active.
--- drivers/usb/misc/chaoskey.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/usb/misc/chaoskey.c +21 -3
@@ -396,13 +396,17 @@ static int _chaoskey_fill(struct chaoske !dev->reading, (started ? NAK_TIMEOUT : ALEA_FIRST_TIMEOUT) ); -if (result <0 ) +if (result <0 ) { +usb_kill_urb (dev->urb); goto out; + } -if (result ==0 ) +if (result ==0 ) { result = -ETIMEDOUT ; -else +usb_kill_urb (dev->urb); + }else { result = dev->valid; + } out:/* Let the device go back to sleep eventually */ usb_autopm_put_interface (dev->interface);
@@ -538,7 +542,21 @@ static int chaoskey_suspend(struct usb_istatic int chaoskey_resume (struct usb_interface *interface) { +struct chaoskey *dev; +struct usb_device *udev =interface_to_usbdev (interface); +usb_dbg (interface,"resume" ); + dev =usb_get_intfdata (interface); + +/* +* We may have lost power. +* In that case the device that needs a long time +* for the first requests needs an extended timeout +* again +*/ +if (le16_to_cpu (udev->descriptor.idVendor) ==ALEA_VENDOR_ID ) + dev->reads_started = false; +return 0 ; }#else
Greg Kroah-Hartman
maintainerPATCH 201/211 appledisplay: fix error handling in the scheduled work
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 91feb01596e5efc0cc922cc73f5583114dccf4d2 upstream.
The work item can operate on
1. stale memory left over from the last transfer the actual length of the data transfered needs to be checked
2. memory already freed
the error handling in appledisplay_probe() needs to cancel the work in that case
--- drivers/usb/misc/appledisplay.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/misc/appledisplay.c +7 -1
@@ -182,7 +182,12 @@ static int appledisplay_bl_get_brightnes0 , pdata->msgdata,2 , ACD_USB_TIMEOUT); - brightness = pdata->msgdata[1 ]; +if (retval <2 ) { +if (retval >=0 ) + retval = -EMSGSIZE ; + }else { + brightness = pdata->msgdata[1 ]; + }mutex_unlock (&pdata->sysfslock);if (retval <0 )
@@ -317,6 +322,7 @@ error:if (pdata) {if (pdata->urb) {usb_kill_urb (pdata->urb); +cancel_delayed_work_sync (&pdata->work);if (pdata->urbdata)usb_free_coherent (pdata->udev,ACD_URB_BUFFER_LEN , pdata->urbdata, pdata->urb->transfer_dma);
Greg Kroah-Hartman
maintainerPATCH 203/211 USB: serial: mos7720: fix remote wakeup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit ea422312a462696093b5db59d294439796cba4ad upstream.
The driver was setting the device remote-wakeup feature during probe in violation of the USB specification (which says it should only be set just prior to suspending the device). This could potentially waste power during suspend as well as lead to spurious wakeups.
Note that USB core would clear the remote-wakeup feature at first resume.
--- drivers/usb/serial/mos7720.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/serial/mos7720.c +0 -4
@@ -1905,10 +1905,6 @@ static int mos7720_startup(struct usb_se product =le16_to_cpu (serial->dev->descriptor.idProduct); dev = serial->dev; -/* setting configuration feature to one */ -usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), - (__u8 )0x03 ,0x00 ,0x01 ,0x00 ,NULL ,0x00 ,5000 ); -if (product ==MOSCHIP_DEVICE_ID_7715 ) {struct urb *urb = serial->port[0 ]->interrupt_in_urb;
Greg Kroah-Hartman
maintainerPATCH 204/211 USB: serial: mos7840: fix remote wakeup
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 92fe35fb9c70a00d8fbbf5bd6172c921dd9c7815 upstream.
The driver was setting the device remote-wakeup feature during probe in violation of the USB specification (which says it should only be set just prior to suspending the device). This could potentially waste power during suspend as well as lead to spurious wakeups.
Note that USB core would clear the remote-wakeup feature at first resume.
--- drivers/usb/serial/mos7840.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/usb/serial/mos7840.c +0 -5
@@ -2338,11 +2338,6 @@ out: goto error; }else dev_dbg (&port->dev,"ZLP_REG5 Writing success status%d\n" , status); - -/* setting configuration feature to one */ -usb_control_msg (serial->dev,usb_sndctrlpipe (serial->dev,0 ), -0x03 ,0x00 ,0x01 ,0x00 ,NULL ,0x00 , -MOS_WDR_TIMEOUT ); }return 0 ; error:
Greg Kroah-Hartman
maintainerPATCH 206/211 USB: serial: option: add support for Foxconn T77W968 LTE modules
In reply to Greg Kroah-HartmanFrom: Aleksander Morgado <[email protected]>
commit f0797095423e6ea3b4be61134ee353c7f504d440 upstream.
These are the Foxconn-branded variants of the Dell DW5821e modules, same USB layout as those. The device exposes AT, NMEA and DIAG ports in both USB configurations.
P: Vendor=0489 ProdID=e0b4 Rev=03.18 S: Manufacturer=FII S: Product=T77W968 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
P: Vendor=0489 ProdID=e0b4 Rev=03.18 S: Manufacturer=FII S: Product=T77W968 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -1995,6 +1995,10 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x13) }, { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x14) }, { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xa31d, 0xff, 0x06, 0x1b) }, + { USB_DEVICE(0x0489, 0xe0b4), /* Foxconn T77W968 */ + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 */ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */
Greg Kroah-Hartman
maintainerPATCH 205/211 USB: serial: option: add support for DW5821e with eSIM support
In reply to Greg Kroah-HartmanFrom: Aleksander Morgado <[email protected]>
commit 957c31ea082e3fe5196f46d5b04018b10de47400 upstream.
The device exposes AT, NMEA and DIAG ports in both USB configurations. Exactly same layout as the default DW5821e module, just a different vid/pid.
P: Vendor=413c ProdID=81e0 Rev=03.18 S: Manufacturer=Dell Inc. S: Product=DW5821e-eSIM Snapdragon X20 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
P: Vendor=413c ProdID=81e0 Rev=03.18 S: Manufacturer=Dell Inc. S: Product=DW5821e-eSIM Snapdragon X20 LTE S: SerialNumber=0123456789ABCDEF C: #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=500mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim I: If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#=0x6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -200,6 +200,7 @@ static void option_instat_callback(struc#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b/* Novatel E371 */ #define DELL_PRODUCT_5821E 0x81d7 +#define DELL_PRODUCT_5821E_ESIM 0x81e0#define KYOCERA_VENDOR_ID 0x0c88#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -1047,6 +1048,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) }, { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E), .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
Greg Kroah-Hartman
maintainerPATCH 209/211 powerpc/book3s64: Fix link stack flush on context switch
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 39e72bf96f5847ba87cc5bd7a3ce0fed813dc9ad upstream.
In commit ee13cb249fab ("powerpc/64s: Add support for software count cache flush"), I added support for software to flush the count cache (indirect branch cache) on context switch if firmware told us that was the required mitigation for Spectre v2.
As part of that code we also added a software flush of the link stack (return address stack), which protects against Spectre-RSB between user processes.
That is all correct for CPUs that activate that mitigation, which is currently Power9 Nimbus DD2.3.
What I got wrong is that on older CPUs, where firmware has disabled the count cache, we also need to flush the link stack on context switch.
To fix it we create a new feature bit which is not set by firmware, which tells us we need to flush the link stack. We set that when firmware tells us that either of the existing Spectre v2 mitigations are enabled.
Then we adjust the patching code so that if we see that feature bit we enable the link stack flush. If we're also told to flush the count cache in software then we fall through and do that also.
On the older CPUs we don't need to do do the software count cache flush, firmware has disabled it, so in that case we patch in an early return after the link stack flush.
The naming of some of the functions is awkward after this patch, because they're called "count cache" but they also do link stack. But we'll fix that up in a later commit to ease backporting.
This is the fix for CVE-2019-18660.
--- arch/powerpc/include/asm/asm-prototypes.h | 1 arch/powerpc/include/asm/security_features.h | 3 + arch/powerpc/kernel/entry_64.S | 6 +++ arch/powerpc/kernel/security.c | 48 ++++++++++++++++++++++++--- 4 files changed, 54 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/asm-prototypes.h +1 -0
@@ -129,6 +129,7 @@ unsigned long prepare_ftrace_return(unsi/* Patch sites */ extern s32 patch__call_flush_count_cache;extern s32 patch__flush_count_cache_return; +extern s32 patch__flush_link_stack_return;extern long flush_count_cache;
arch/powerpc/include/asm/security_features.h +3 -0
@@ -81,6 +81,9 @@ static inline bool security_ftr_enabled(// Software required to flush count cache on context switch #define SEC_FTR_FLUSH_COUNT_CACHE 0x0000000000000400ull +// Software required to flush link stack on context switch +#define SEC_FTR_FLUSH_LINK_STACK 0x0000000000001000ull +// Features enabled by default #define SEC_FTR_DEFAULT \
arch/powerpc/kernel/entry_64.S +6 -0
@@ -524,6 +524,7 @@ flush_count_cache: /* Save LR into r9 */ mflr r9 + // Flush the link stack .rept 64 bl .+4 .endr
@@ -533,6 +534,11 @@ flush_count_cache: .balign 32 /* Restore LR */ 1: mtlr r9 + + // If we're just flushing the link stack, return here +3: nop + patch_site 3b patch__flush_link_stack_return + li r9,0x7fff mtctr r9
arch/powerpc/kernel/security.c +44 -4
90 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 207/211 staging: comedi: usbduxfast: usbduxfast_ai_cmdtest rounding error
In reply to Greg Kroah-HartmanFrom: Bernd Porr <[email protected]>
commit 5618332e5b955b4bff06d0b88146b971c8dd7b32 upstream.
The userspace comedilib function 'get_cmd_generic_timed' fills the cmd structure with an informed guess and then calls the function 'usbduxfast_ai_cmdtest' in this driver repeatedly while 'usbduxfast_ai_cmdtest' is modifying the cmd struct until it no longer changes. However, because of rounding errors this never converged because 'steps = (cmd->convert_arg * 30) / 1000' and then back to 'cmd->convert_arg = (steps * 1000) / 30' won't be the same because of rounding errors. 'Steps' should only be converted back to the 'convert_arg' if 'steps' has actually been modified. In addition the case of steps being 0 wasn't checked which is also now done.
--- drivers/staging/comedi/drivers/usbduxfast.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/staging/comedi/drivers/usbduxfast.c +14 -7
@@ -1,5 +1,5 @@/* -* Copyright (C) 2004-2014 Bernd Porr, [email protected] +* Copyright (C) 2004-2019 Bernd Porr, [email protected] * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@* Description: University of Stirling USB DAQ & INCITE Technology Limited * Devices: [ITL] USB-DUX-FAST (usbduxfast) * Author: Bernd Porr <[email protected]> -* Updated: 10 Oct 2014 +* Updated: 16 Nov 2019 * Status: stable */
@@ -31,6 +31,7 @@* * * Revision history: +* 1.0: Fixed a rounding error in usbduxfast_ai_cmdtest * 0.9: Dropping the first data packet which seems to be from the last transfer. * Buffer overflows in the FX2 are handed over to comedi. * 0.92: Dropping now 4 packets. The quad buffer has to be emptied.
@@ -359,6 +360,7 @@ static int usbduxfast_ai_cmdtest(struct struct comedi_cmd *cmd) {int err =0 ; +int err2 =0 ;unsigned int steps;unsigned int arg;
@@ -408,11 +410,16 @@ static int usbduxfast_ai_cmdtest(struct*/ steps = (cmd->convert_arg *30 ) /1000 ;if (cmd->chanlist_len !=1 ) - err |=comedi_check_trigger_arg_min (&steps, -MIN_SAMPLING_PERIOD ); - err |=comedi_check_trigger_arg_max (&steps,MAX_SAMPLING_PERIOD ); - arg = (steps *1000 ) /30 ; - err |=comedi_check_trigger_arg_is (&cmd->convert_arg, arg); + err2 |=comedi_check_trigger_arg_min (&steps, +MIN_SAMPLING_PERIOD ); +else + err2 |=comedi_check_trigger_arg_min (&steps,1 ); + err2 |=comedi_check_trigger_arg_max (&steps,MAX_SAMPLING_PERIOD ); +if (err2) { + err |= err2; + arg = (steps *1000 ) /30 ; + err |=comedi_check_trigger_arg_is (&cmd->convert_arg, arg); + }if (cmd->stop_src ==TRIG_COUNT ) err |=comedi_check_trigger_arg_min (&cmd->stop_arg,1 );
Greg Kroah-Hartman
maintainerPATCH 210/211 KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit af2e8c68b9c5403f77096969c516f742f5bb29e0 upstream.
On some systems that are vulnerable to Spectre v2, it is up to software to flush the link stack (return address stack), in order to protect against Spectre-RSB.
When exiting from a guest we do some house keeping and then potentially exit to C code which is several stack frames deep in the host kernel. We will then execute a series of returns without preceeding calls, opening up the possiblity that the guest could have poisoned the link stack, and direct speculative execution of the host to a gadget of some sort.
To prevent this we add a flush of the link stack on exit from a guest.
--- arch/powerpc/include/asm/asm-prototypes.h | 2 ++ arch/powerpc/kernel/security.c | 9 +++++++++ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+)
arch/powerpc/include/asm/asm-prototypes.h +2 -0
@@ -130,7 +130,9 @@ unsigned long prepare_ftrace_return(unsiextern s32 patch__call_flush_count_cache;extern s32 patch__flush_count_cache_return;extern s32 patch__flush_link_stack_return; +extern s32 patch__call_kvm_flush_link_stack;extern long flush_count_cache; +extern long kvm_flush_link_stack;#endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */
arch/powerpc/kernel/security.c +9 -0
@@ -392,6 +392,9 @@ static void toggle_count_cache_flush(booif (!enable) {patch_instruction_site (&patch__call_flush_count_cache,PPC_INST_NOP ); +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE +patch_instruction_site (&patch__call_kvm_flush_link_stack,PPC_INST_NOP ); +#endif pr_info ("link-stack-flush: software flush disabled.\n" ); link_stack_flush_enabled = false;no_count_cache_flush ();
@@ -402,6 +405,12 @@ static void toggle_count_cache_flush(boopatch_branch_site (&patch__call_flush_count_cache, (u64)&flush_count_cache,BRANCH_SET_LINK ); +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE +// This enables the branch from guest_exit_cont to kvm_flush_link_stack +patch_branch_site (&patch__call_kvm_flush_link_stack, + (u64)&kvm_flush_link_stack,BRANCH_SET_LINK ); +#endif +pr_info ("link-stack-flush: software flush enabled.\n" ); link_stack_flush_enabled = true;
arch/powerpc/kvm/book3s_hv_rmhandlers.S +27 -0
@@ -18,6 +18,7 @@ */ #include <asm/ppc_asm.h> +#include <asm/code-patching-asm.h> #include <asm/kvm_asm.h> #include <asm/reg.h> #include <asm/mmu.h>
@@ -1445,6 +1446,10 @@ mc_cont: 1: #endif /* CONFIG_KVM_XICS */ + /* Possibly flush the link stack here. */ +1: nop + patch_site 1b patch__call_kvm_flush_link_stack + stw r12, STACK_SLOT_TRAP(r1) mr r3, r12 /* Increment exit count, poke other threads to exit */
@@ -1957,6 +1962,28 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_R mtlr r0 blr +.balign 32 +.global kvm_flush_link_stack +kvm_flush_link_stack: + /* Save LR into r0 */ + mflr r0 + + /* Flush the link stack. On Power8 it's up to 32 entries in size. */ + .rept 32 + bl .+4 + .endr + + /* And on Power9 it's up to 64. */ +BEGIN_FTR_SECTION + .rept 32 + bl .+4 + .endr +END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) + + /* Restore LR */ + mtlr r0 + blr + /* * Check whether an HDSI is an HPTE not found fault or something else. * If it is an HPTE not found fault that is due to the guest accessing
Greg Kroah-Hartman
maintainerPATCH 184/211 selftests/x86/sigreturn/32: Invalidate DS and ES when abusing the kernel
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
commit 4d2fa82d98d2d296043a04eb517d7dbade5b13b8 upstream.
If the kernel accidentally uses DS or ES while the user values are loaded, it will work fine for sane userspace. In the interest of simulating maximally insane userspace, make sigreturn_32 zero out DS and ES for the nasty parts so that inadvertent use of these segments will crash.
--- tools/testing/selftests/x86/sigreturn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
tools/testing/selftests/x86/sigreturn.c +13 -0
@@ -459,6 +459,19 @@ static void sigusr1(int sig, siginfo_t * ctx->uc_mcontext.gregs[REG_SP ] = (unsigned long )0x8badf00d5aadc0deULL ; ctx->uc_mcontext.gregs[REG_CX ] =0 ; +#ifdef __i386__ +/* +* Make sure the kernel doesn't inadvertently use DS or ES-relative +* accesses in a region where user DS or ES is loaded. +* +* Skip this for 64-bit builds because long mode doesn't care about +* DS and ES and skipping it increases test coverage a little bit, +* since 64-bit kernels can still run the 32-bit build. +*/ + ctx->uc_mcontext.gregs[REG_DS ] =0 ; + ctx->uc_mcontext.gregs[REG_ES ] =0 ; +#endif +memcpy (&requested_regs, &ctx->uc_mcontext.gregs,sizeof (gregset_t)); requested_regs[REG_CX ] = *ssptr (ctx);/* The asm code does this. */
Greg Kroah-Hartman
maintainerPATCH 185/211 x86/pti/32: Calculate the various PTI cpu_entry_area sizes correctly, make the CPU_ENTRY_AREA_PAGES assert precise
In reply to Greg Kroah-HartmanFrom: Ingo Molnar <[email protected]>
commit 05b042a1944322844eaae7ea596d5f154166d68a upstream.
When two recent commits that increased the size of the 'struct cpu_entry_area' were merged in -tip, the 32-bit defconfig build started failing on the following build time assert:
./include/linux/compiler.h:391:38: error: call to ‘__compiletime_assert_189’ declared with attribute error: BUILD_BUG_ON failed: CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE arch/x86/mm/cpu_entry_area.c:189:2: note: in expansion of macro ‘BUILD_BUG_ON’
In function ‘setup_cpu_entry_area_ptes’,
Which corresponds to the following build time assert:
BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);
The purpose of this assert is to sanity check the fixed-value definition of CPU_ENTRY_AREA_PAGES arch/x86/include/asm/pgtable_32_types.h:
#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 41)
The '41' is supposed to match sizeof(struct cpu_entry_area)/PAGE_SIZE, which value we didn't want to define in such a low level header, because it would cause dependency hell.
Every time the size of cpu_entry_area is changed, we have to adjust CPU_ENTRY_AREA_PAGES accordingly - and this assert is checking that constraint.
But the assert is both imprecise and buggy, primarily because it doesn't include the single readonly IDT page that is mapped at CPU_ENTRY_AREA_BASE (which begins at a PMD boundary).
This bug was hidden by the fact that by accident CPU_ENTRY_AREA_PAGES is defined too large upstream (v5.4-rc8):
#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40)
While 'struct cpu_entry_area' is 155648 bytes, or 38 pages. So we had two extra pages, which hid the bug.
The following commit (not yet upstream) increased the size to 40 pages:
x86/iopl: ("Restrict iopl() permission scope")
... but increased CPU_ENTRY_AREA_PAGES only 41 - i.e. shortening the gap to just 1 extra page.
Then another not-yet-upstream commit changed the size again:
880a98c33996: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")
Which increased the cpu_entry_area size from 38 to 39 pages, but didn't change CPU_ENTRY_AREA_PAGES (kept it at 40). This worked fine, because we still had a page left from the accidental 'reserve'.
But when these two commits were merged into the same tree, the combined size of cpu_entry_area grew from 38 to 40 pages, while CPU_ENTRY_AREA_PAGES finally caught up to 40 as well.
Which is fine in terms of functionality, but the assert broke:
BUILD_BUG_ON(CPU_ENTRY_AREA_PAGES * PAGE_SIZE < CPU_ENTRY_AREA_MAP_SIZE);
because CPU_ENTRY_AREA_MAP_SIZE is the total size of the area, which is 1 page larger due to the IDT page.
To fix all this, change the assert to two precise asserts:
BUILD_BUG_ON((CPU_ENTRY_AREA_PAGES+1)*PAGE_SIZE != CPU_ENTRY_AREA_MAP_SIZE); BUILD_BUG_ON(CPU_ENTRY_AREA_TOTAL_SIZE != CPU_ENTRY_AREA_MAP_SIZE);
This takes the IDT page into account, and also connects the size-based define of CPU_ENTRY_AREA_TOTAL_SIZE with the address-subtraction based define of CPU_ENTRY_AREA_MAP_SIZE.
Also clean up some of the names which made it rather confusing:
- 'CPU_ENTRY_AREA_TOT_SIZE' wasn't actually the 'total' size of the cpu-entry-area, but the per-cpu array size, so rename this to CPU_ENTRY_AREA_ARRAY_SIZE.
- Introduce CPU_ENTRY_AREA_TOTAL_SIZE that _is_ the total mapping size, with the IDT included.
- Add comments where '+1' denotes the IDT mapping - it wasn't obvious and took me about 3 hours to decode...
Finally, because this particular commit is actually applied after this patch:
880a98c33996: ("x86/cpu_entry_area: Add guard page for entry stack on 32bit")
Fix the CPU_ENTRY_AREA_PAGES value from 40 pages to the correct 39 pages.
All future commits that change cpu_entry_area will have to adjust this value precisely.
As a side note, we should probably attempt to remove CPU_ENTRY_AREA_PAGES and derive its value directly from the structure, without causing header hell - but that is an adventure for another day! :-)
--- arch/x86/include/asm/cpu_entry_area.h | 12 +++++++----- arch/x86/include/asm/pgtable_32_types.h | 8 ++++---- arch/x86/mm/cpu_entry_area.c | 4 +++- 3 files changed, 14 insertions(+), 10 deletions(-)
arch/x86/include/asm/cpu_entry_area.h +7 -5
@@ -45,7 +45,6 @@ struct cpu_entry_area {*/ char exception_stacks[(N_EXCEPTION_STACKS -1 ) *EXCEPTION_STKSZ +DEBUG_STKSZ ];#endif -#ifdef CONFIG_CPU_SUP_INTEL /* * Per CPU debug store for Intel performance monitoring. Wastes a * full page at the moment.
@@ -56,24 +55,27 @@ struct cpu_entry_area {* Reserve enough fixmap PTEs. */ struct debug_store_buffers cpu_debug_buffers; -#endif }; -#define CPU_ENTRY_AREA_SIZE (sizeof(struct cpu_entry_area)) -#define CPU_ENTRY_AREA_TOT_SIZE (CPU_ENTRY_AREA_SIZE * NR_CPUS) +#define CPU_ENTRY_AREA_SIZE (sizeof(struct cpu_entry_area)) +#define CPU_ENTRY_AREA_ARRAY_SIZE (CPU_ENTRY_AREA_SIZE * NR_CPUS) + +/* Total size includes the readonly IDT mapping page as well: */ +#define CPU_ENTRY_AREA_TOTAL_SIZE (CPU_ENTRY_AREA_ARRAY_SIZE + PAGE_SIZE) DECLARE_PER_CPU(struct cpu_entry_area *, cpu_entry_area);extern void setup_cpu_entry_areas (void );extern void cea_set_pte (void *cea_vaddr,phys_addr_t pa,pgprot_t flags); +/* Single page reserved for the readonly IDT mapping: */ #define CPU_ENTRY_AREA_RO_IDT CPU_ENTRY_AREA_BASE#define CPU_ENTRY_AREA_PER_CPU (CPU_ENTRY_AREA_RO_IDT + PAGE_SIZE)#define CPU_ENTRY_AREA_RO_IDT_VADDR ((void *)CPU_ENTRY_AREA_RO_IDT)#define CPU_ENTRY_AREA_MAP_SIZE \ - (CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_TOT_SIZE - CPU_ENTRY_AREA_BASE) + (CPU_ENTRY_AREA_PER_CPU + CPU_ENTRY_AREA_ARRAY_SIZE - CPU_ENTRY_AREA_BASE)extern struct cpu_entry_area *get_cpu_entry_area (int cpu);
arch/x86/include/asm/pgtable_32_types.h +4 -4
@@ -42,11 +42,11 @@ extern bool __vmalloc_start_set; /* set* Define this here and validate with BUILD_BUG_ON() in pgtable_32.c * to avoid include recursion hell */ -#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40) +#define CPU_ENTRY_AREA_PAGES (NR_CPUS * 39) -#define CPU_ENTRY_AREA_BASE \ - ((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) \ - & PMD_MASK) +/* The +1 is for the readonly IDT page: */ +#define CPU_ENTRY_AREA_BASE \ + ((FIXADDR_TOT_START - PAGE_SIZE*(CPU_ENTRY_AREA_PAGES+1)) & PMD_MASK)#define PKMAP_BASE \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)
arch/x86/mm/cpu_entry_area.c +3 -1
@@ -143,7 +143,9 @@ static __init void setup_cpu_entry_area_#ifdef CONFIG_X86_32 unsigned long start, end; -BUILD_BUG_ON (CPU_ENTRY_AREA_PAGES *PAGE_SIZE <CPU_ENTRY_AREA_MAP_SIZE ); +/* The +1 is for the readonly IDT: */ +BUILD_BUG_ON ((CPU_ENTRY_AREA_PAGES +1 )*PAGE_SIZE !=CPU_ENTRY_AREA_MAP_SIZE ); +BUILD_BUG_ON (CPU_ENTRY_AREA_TOTAL_SIZE !=CPU_ENTRY_AREA_MAP_SIZE );BUG_ON (CPU_ENTRY_AREA_BASE & ~PMD_MASK ); start =CPU_ENTRY_AREA_BASE ;