4.9.229-rc1 review
Subsystems (6)
Sasha Levin
maintainercover 4.9.229-rc1 review
This is the start of the stable review cycle for the 4.9.229 release. There are 191 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 Wed 01 Jul 2020 03:40:00 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.9.y&id2=v4.9.228
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
--
Thanks,
Sasha
-------------------------
Pseudo-Shortlog of commits:
Aaron Plattner (1):
ALSA: hda: Add NVIDIA codec IDs 9a & 9d through a0 to patch table
Adam Honse (1):
i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets
Aditya Pakki (1):
rocker: fix incorrect error handling in dma_rings_init
Ahmed S. Darwish (2):
block: nr_sects_write(): Disable preemption on seqcount write
net: core: device_rename: Use rwsem instead of a seqcount
Al Cooper (1):
xhci: Fix enumeration issue when setting max packet size for FS
devices.
Al Viro (1):
fix a braino in "sparc32: fix register window handling in
genregs32_[gs]et()"
Alain Volmat (1):
clk: clk-flexgen: fix clock-critical handling
Alex Williamson (1):
vfio-pci: Mask cap zero
Alexander Lobakin (3):
net: qed: fix left elements count calculation
net: qed: fix NVMe login fails over VFs
net: qed: fix excessive QM ILT lines consumption
Alexander Tsoy (1):
ALSA: usb-audio: Improve frames size computation
Andreas Klinger (1):
iio: bmp280: fix compensation of humidity
Andrew Murray (1):
PCI: rcar: Fix incorrect programming of OB windows
Andy Shevchenko (1):
iio: pressure: bmp280: Tolerate IRQ before registering
Ard Biesheuvel (1):
x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld
Arnd Bergmann (2):
dlm: remove BUG() before panic() include/linux/bitops.h: avoid clang shift-count-overflow warnings
Bjorn Helgaas (1):
PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream
Port
Bob Peterson (1):
gfs2: Allow lock_nolock mount to specify jid=X
Boris Brezillon (1):
mtd: rawnand: Pass a nand_chip object to nand_release()
Bryan O'Donoghue (1):
clk: qcom: msm8916: Fix the address location of pll->config_reg
Chen Yu (1):
e1000e: Do not wake up the system via WOL if device wakeup is disabled
Chris Wilson (1):
drm/i915: Whitelist context-local timestamp in the gen9 cmdparser
Christophe JAILLET (4):
power: supply: lp8788: Fix an error handling path in
'lp8788_charger_probe()'
extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()'
pinctrl: imxl: Fix an error handling path in
'imx1_pinctrl_core_probe()' scsi: acornscsi: Fix an error handling path in acornscsi_probe()
Chuck Lever (1):
SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
Chuhong Yuan (1):
USB: ohci-sm501: Add missed iounmap() in remove
Colin Ian King (2):
usb: gadget: lpc32xx_udc: don't dereference ep pointer before null
check
media: dvb_frontend: initialize variable s with FE_NONE instead of 0
Dan Carpenter (2):
ALSA: isa/wavefront: prevent out of bounds write in ioctl
usb: gadget: udc: Potential Oops in error handling code
David Christensen (1):
tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
David Howells (1):
rxrpc: Fix notification call on completion of discarded calls
Denis Efremov (1):
drm/radeon: fix fb_div check in ni_init_smc_spll_table()
Dmitry Osipenko (1):
power: supply: smb347-charger: IRQSTAT_D is volatile
Dmitry V. Levin (1):
s390: fix syscall_get_error for compat processes
Emmanuel Nicolet (1):
ps3disk: use the default segment boundary
Enric Balletbo i Serra (1):
power: supply: bq24257_charger: Replace depends on REGMAP_I2C with
select
Eric Biggers (1):
crypto: algboss - don't wait during notifier callback
Eric Dumazet (1):
tcp: grow window for OOO packets only for SACK flows
Fabrice Gasnier (1):
usb: dwc2: gadget: move gadget resume after the core is in L0 state
Fan Guo (1):
RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
Fedor Tokarev (1):
net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
Gaurav Singh (1):
perf report: Fix NULL pointer dereference in
hists__fprintf_nr_sample_events()
Geoff Levand (1):
powerpc/ps3: Fix kexec shutdown hang
Gregory CLEMENT (3):
tty: n_gsm: Fix SOF skipping
tty: n_gsm: Fix waking up upper tty layer when room available
tty: n_gsm: Fix bogus i++ in gsm_data_kick
Huacai Chen (1):
drm/qxl: Use correct notify port address when creating cursor ring
Jaedon Shin (3):
media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.c
media: dvb_frontend: Add compat_ioctl callback
media: dvb_frontend: Add commands implementation for compat ioct
Jann Horn (1):
lib/zlib: remove outdated and incorrect pre-increment optimization
Jason Yan (1):
block: Fix use-after-free in blkdev_get()
Jeffle Xu (1):
ext4: fix partial cluster initialization when splitting extent
Jeremy Kerr (1):
net: usb: ax88179_178a: fix packet alignment padding
Jiping Ma (1):
arm64: perf: Report the PC value in REGS_ABI_32 mode
Jiri Olsa (1):
kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
Joakim Tjernlund (1):
cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
John Stultz (1):
serial: amba-pl011: Make sure we initialize the port.lock spinlock
Jon Hunter (1):
backlight: lp855x: Ensure regulators are disabled on probe failure
Julian Scheel (1):
ALSA: usb-audio: uac1: Invalidate ctl on interrupt
Julian Wiedmann (1):
s390/qdio: put thinint indicator after early error
Junxiao Bi (3):
ocfs2: load global_inode_alloc
ocfs2: fix value of OCFS2_INVALID_SLOT
ocfs2: fix panic on nfs server over ocfs2
Juri Lelli (1):
sched/core: Fix PI boosting between RT and DEADLINE tasks
Kai-Heng Feng (3):
PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
libata: Use per port sync for detach
xhci: Poll for U0 after disabling USB2 LPM
Kajol Jain (1):
powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple
hv-24x7 events run
Katsuhiro Suzuki (1):
media: dvb_frontend: fix wrong cast in compat_ioctl
Kuppuswamy Sathyanarayanan (1):
drivers: base: Fix NULL pointer exception in __platform_driver_probe()
if a driver developer is foolish
Linus Walleij (1):
ARM: integrator: Add some Kconfig selections
Longfang Liu (1):
USB: ehci: reopen solution for Synopsys HC bug
Luis Chamberlain (1):
blktrace: break out of blktrace setup on concurrent calls
Lyude Paul (2):
drm/dp_mst: Reformat drm_dp_check_act_status() a bit drm/dp_mst: Increase ACT retry timeout to 3s
Maor Gottlieb (1):
IB/cma: Fix ports memory leak in cma_configfs
Marcelo Ricardo Leitner (1):
sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
Marek Szyprowski (2):
mfd: wm8994: Fix driver operation if loaded as modules
clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1
Martin Wilck (1):
scsi: scsi_devinfo: handle non-terminated strings
Masahiro Yamada (1):
kbuild: improve cc-option to clean up all temporary files
Masami Hiramatsu (3):
kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex x86/kprobes: Avoid kretprobe recursion bug
tracing: Fix event trigger to accept redundant spaces
Matej Dujava (1):
staging: sm750fb: add missing case while setting FB_VISUAL
Mathias Nyman (1):
xhci: Fix incorrect EP_STATE_MASK
Mauro Carvalho Chehab (14):
media: dvb/frontend.h: move out a private internal structure
media: dvb/frontend.h: document the uAPI file
media: dvb_frontend: get rid of get_property() callback
media: stv0288: get rid of set_property boilerplate
media: stv6110: get rid of a srate dead code
media: friio-fe: get rid of set_property()
media: dvb_frontend: get rid of set_property() callback
media: dvb_frontend: cleanup dvb_frontend_ioctl_properties()
media: dvb_frontend: cleanup ioctl handling logic
media: dvb_frontend: get rid of property cache's state
media: dvb_frontend: better document the -EPERM condition
media: dvb_frontend: fix return values for FE_SET_PROPERTY
media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl()
return code
media: dvb_frontend: fix return error code
Minas Harutyunyan (1):
usb: dwc2: Postponed gadget registration to the udc class driver
Miquel Raynal (8):
mtd: rawnand: diskonchip: Fix the probe error path
mtd: rawnand: sharpsl: Fix the probe error path
mtd: rawnand: xway: Fix the probe error path
mtd: rawnand: orion: Fix the probe error path
mtd: rawnand: socrates: Fix the probe error path
mtd: rawnand: plat_nand: Fix the probe error path
mtd: rawnand: mtk: Fix the probe error path
mtd: rawnand: tmio: Fix the probe error path
Nathan Chancellor (3):
USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in
s3c2410_udc_nuke
clk: bcm2835: Fix return type of bcm2835_register_gate
ACPI: sysfs: Fix pm_profile_attr type
Naveen N. Rao (1):
powerpc/kprobes: Fixes for kprobe_lookup_name() on BE
Neal Cardwell (1):
tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
Nicholas Piggin (1):
powerpc/pseries/ras: Fix FWNMI_VALID off by one
Nick Desaulniers (1):
elfnote: mark all .note sections SHF_ALLOC
Olga Kornievskaia (2):
NFSv4.1 fix rpc_call_done assignment for BIND_CONN_TO_SESSION NFSv4 fix CLOSE not waiting for direct IO compeletion
Oliver Neukum (1):
usblp: poison URBs upon disconnect
Pali Rohár (1):
PCI: aardvark: Don't blindly enable ASPM L0s and don't write to
read-only register
Pawel Laszczak (1):
usb: gadget: Fix issue with config_ep_by_speed function
Pingfan Liu (1):
powerpc/crashkernel: Take "mem=" option into account
Qais Yousef (3):
usb/ohci-platform: Fix a warning when hibernating usb/xhci-plat: Set PM runtime as active on resume usb/ehci-platform: Set PM runtime as active on resume
Qian Cai (2):
vfio/pci: fix memory leaks in alloc_perm_bits()
powerpc/64s/pgtable: fix an undefined behaviour
Qiushi Wu (3):
usb: gadget: fix potential double-free in m66592_probe.
scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
Raghavendra Rao Ananta (1):
tty: hvc: Fix data abort due to race in hvc_open
Ram Pai (1):
selftests/vm/pkeys: fix alloc_random_pkey() to make it really random
Ridge Kennedy (1):
l2tp: Allow duplicate session creation with UDP
Rikard Falkeborn (1):
clk: sunxi: Fix incorrect usage of round_down()
Roy Spliet (1):
drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
Russell King (3):
i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
netfilter: ipset: fix unaligned atomic access
Sasha Levin (1):
Linux 4.9.229-rc1
Satendra Singh Thakur (1):
media: dvb_frontend: dtv_property_process_set() cleanups
Simon Arlott (1):
scsi: sr: Fix sr_probe() missing deallocate of device minor
Stafford Horne (1):
openrisc: Fix issue with argument clobbering for clone/fork
Stefan Riedmueller (1):
watchdog: da9062: No need to ping manually before setting timeout
Suganath Prabu S (1):
scsi: mpt3sas: Fix double free warnings
Sven Schnelle (1):
s390/ptrace: fix setting syscall number
Taehee Yoo (3):
ip_tunnel: fix use-after-free in ip_tunnel_lookup()
ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
net: core: reduce recursion limit value
Takashi Iwai (3):
ALSA: usb-audio: Clean up mixer element list traverse
ALSA: usb-audio: Fix OOB access of mixer element list
ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()
Tang Bin (2):
USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
Tariq Toukan (1):
net: Do not clear the sock TX queue in sk_set_socket()
Tero Kristo (2):
clk: ti: composite: fix memory leak
crypto: omap-sham - add proper load balancing support for multicore
Thomas Gleixner (1):
sched/rt, net: Use CONFIG_PREEMPTION.patch
Tom Rix (1):
selinux: fix double free
Tomasz Meresiński (1):
usb: add USB_QUIRK_DELAY_INIT for Logitech C922
Trond Myklebust (1):
pNFS/flexfiles: Fix list corruption if the mirror count changes
Tyrel Datwyler (1):
scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM
Valentin Longchamp (1):
net: sched: export __netdev_watchdog_up()
Vasily Averin (1):
sunrpc: fixed rollback in rpc_gssd_dummy_populate()
Viacheslav Dubeyko (1):
scsi: qla2xxx: Fix issue with adapter's stopping state
Waiman Long (1):
mm/slab: use memzero_explicit() in kzfree()
Wang Hai (2):
yam: fix possible memory leak in yam_init_driver
mld: fix memory leak in ipv6_mc_destroy_dev()
Wolfram Sang (1):
drm: encoder_slave: fix refcouting error for modules
Xiaoyao Li (1):
KVM: X86: Fix MSR range of APIC registers in X2APIC mode
Xiyu Yang (3):
scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
nfsd: Fix svc_xprt refcnt leak when setup callback client failed
ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed
Yang Yingliang (1):
net: fix memleak in register_netdevice()
Ye Bin (1):
ata/libata: Fix usage of page address by page_address in
ata_scsi_mode_select_xlat function
Yick W. Tse (1):
ALSA: usb-audio: add quirk for Denon DCD-1500RE
Zekun Shen (1):
net: alx: fix race condition in alx_remove
Zhang Xiaoxu (2):
cifs/smb3: Fix data inconsistent when punch hole cifs/smb3: Fix data inconsistent when zero file range
Zheng Bin (1):
xfs: add agf freeblocks verify in xfs_agf_verify
Zhiqiang Liu (1):
bcache: fix potential deadlock problem in btree_gc_coalesce
ashimida (1):
mksysmap: Fix the mismatch of '.L' symbols in System.map
guodeqing (1):
net: Fix the arp error in some cases
tannerlove (1):
selftests/net: in timestamping, strncpy needs to preserve null byte
yu kuai (1):
ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
.../media/uapi/dvb/fe-get-property.rst | 7 +- Makefile | 4 +- arch/arm/mach-imx/pm-imx5.c | 6 +- arch/arm/mach-integrator/Kconfig | 7 +- arch/arm64/kernel/perf_regs.c | 25 +- arch/openrisc/kernel/entry.S | 4 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 23 +- arch/powerpc/include/asm/kprobes.h | 3 +- arch/powerpc/kernel/machine_kexec.c | 8 +- arch/powerpc/perf/hv-24x7.c | 10 - arch/powerpc/platforms/ps3/mm.c | 22 +- arch/powerpc/platforms/pseries/ras.c | 5 +- arch/s390/include/asm/syscall.h | 12 +- arch/s390/kernel/ptrace.c | 31 +- arch/sparc/kernel/ptrace_32.c | 9 +- arch/x86/boot/Makefile | 2 +- arch/x86/kernel/kprobes/core.c | 12 +- arch/x86/kvm/x86.c | 4 +- crypto/algboss.c | 2 - drivers/acpi/sysfs.c | 4 +- drivers/ata/libata-core.c | 11 +- drivers/ata/libata-scsi.c | 9 +- drivers/base/platform.c | 2 + drivers/block/ps3disk.c | 1 - drivers/clk/bcm/clk-bcm2835.c | 10 +- drivers/clk/qcom/gcc-msm8916.c | 8 +- drivers/clk/samsung/clk-exynos5433.c | 3 +- drivers/clk/st/clk-flexgen.c | 1 + drivers/clk/sunxi/clk-sunxi.c | 2 +- drivers/clk/ti/composite.c | 1 + drivers/crypto/omap-sham.c | 64 +- drivers/extcon/extcon-adc-jack.c | 3 +- drivers/firmware/efi/esrt.c | 2 +- drivers/gpu/drm/drm_dp_mst_topology.c | 58 +- drivers/gpu/drm/drm_encoder_slave.c | 5 +- drivers/gpu/drm/i915/i915_cmd_parser.c | 4 + drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 3 +- drivers/gpu/drm/qxl/qxl_kms.c | 2 +- drivers/gpu/drm/radeon/ni_dpm.c | 2 +- drivers/i2c/busses/i2c-piix4.c | 3 +- drivers/i2c/busses/i2c-pxa.c | 13 +- drivers/iio/pressure/bmp280-core.c | 7 +- drivers/infiniband/core/cma_configfs.c | 13 + drivers/infiniband/core/mad.c | 1 + drivers/md/bcache/btree.c | 8 +- drivers/media/dvb-core/dvb_frontend.c | 569 +++++++++++------ drivers/media/dvb-core/dvb_frontend.h | 13 - drivers/media/dvb-frontends/lg2160.c | 14 - drivers/media/dvb-frontends/stv0288.c | 7 - drivers/media/dvb-frontends/stv6110.c | 9 - drivers/media/usb/dvb-usb/friio-fe.c | 24 - drivers/mfd/wm8994-core.c | 1 + drivers/mtd/nand/ams-delta.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/au1550nd.c | 2 +- drivers/mtd/nand/bcm47xxnflash/main.c | 2 +- drivers/mtd/nand/bf5xx_nand.c | 2 +- drivers/mtd/nand/brcmnand/brcmnand.c | 2 +- drivers/mtd/nand/cafe_nand.c | 2 +- drivers/mtd/nand/cmx270_nand.c | 2 +- drivers/mtd/nand/cs553x_nand.c | 2 +- drivers/mtd/nand/davinci_nand.c | 2 +- drivers/mtd/nand/denali.c | 2 +- drivers/mtd/nand/diskonchip.c | 9 +- drivers/mtd/nand/docg4.c | 4 +- drivers/mtd/nand/fsl_elbc_nand.c | 2 +- drivers/mtd/nand/fsl_ifc_nand.c | 2 +- drivers/mtd/nand/fsl_upm.c | 2 +- drivers/mtd/nand/fsmc_nand.c | 2 +- drivers/mtd/nand/gpio.c | 2 +- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 2 +- drivers/mtd/nand/hisi504_nand.c | 5 +- drivers/mtd/nand/jz4740_nand.c | 4 +- drivers/mtd/nand/jz4780_nand.c | 4 +- drivers/mtd/nand/lpc32xx_mlc.c | 5 +- drivers/mtd/nand/lpc32xx_slc.c | 5 +- drivers/mtd/nand/mpc5121_nfc.c | 2 +- drivers/mtd/nand/mtk_nand.c | 4 +- drivers/mtd/nand/mxc_nand.c | 2 +- drivers/mtd/nand/nand_base.c | 8 +- drivers/mtd/nand/nandsim.c | 4 +- drivers/mtd/nand/ndfc.c | 2 +- drivers/mtd/nand/nuc900_nand.c | 2 +- drivers/mtd/nand/omap2.c | 2 +- drivers/mtd/nand/orion_nand.c | 5 +- drivers/mtd/nand/pasemi_nand.c | 2 +- drivers/mtd/nand/plat_nand.c | 4 +- drivers/mtd/nand/pxa3xx_nand.c | 2 +- drivers/mtd/nand/qcom_nandc.c | 4 +- drivers/mtd/nand/r852.c | 4 +- drivers/mtd/nand/s3c2410.c | 2 +- drivers/mtd/nand/sh_flctl.c | 2 +- drivers/mtd/nand/sharpsl.c | 4 +- drivers/mtd/nand/socrates_nand.c | 5 +- drivers/mtd/nand/sunxi_nand.c | 4 +- drivers/mtd/nand/tmio_nand.c | 4 +- drivers/mtd/nand/txx9ndfmc.c | 2 +- drivers/mtd/nand/vf610_nfc.c | 2 +- drivers/mtd/nand/xway_nand.c | 4 +- drivers/net/ethernet/atheros/alx/main.c | 9 +- drivers/net/ethernet/broadcom/tg3.c | 4 +- drivers/net/ethernet/intel/e1000e/netdev.c | 14 +- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 2 +- drivers/net/ethernet/qlogic/qed/qed_vf.c | 23 +- drivers/net/ethernet/rocker/rocker_main.c | 4 +- drivers/net/hamradio/yam.c | 1 + drivers/net/usb/ax88179_178a.c | 11 +- drivers/pci/host/pci-aardvark.c | 4 - drivers/pci/host/pcie-rcar.c | 9 +- drivers/pci/pcie/aspm.c | 10 - drivers/pci/pcie/ptm.c | 22 +- drivers/pinctrl/freescale/pinctrl-imx1-core.c | 1 - drivers/power/supply/Kconfig | 2 +- drivers/power/supply/lp8788-charger.c | 18 +- drivers/power/supply/smb347-charger.c | 1 + drivers/s390/cio/qdio.h | 1 - drivers/s390/cio/qdio_setup.c | 1 - drivers/s390/cio/qdio_thinint.c | 14 +- drivers/scsi/arm/acornscsi.c | 4 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 2 + drivers/scsi/iscsi_boot_sysfs.c | 2 +- drivers/scsi/lpfc/lpfc_els.c | 2 + drivers/scsi/mpt3sas/mpt3sas_base.c | 2 + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 + drivers/scsi/scsi_devinfo.c | 5 +- drivers/scsi/sr.c | 6 +- drivers/staging/sm750fb/sm750.c | 1 + drivers/tty/hvc/hvc_console.c | 16 +- drivers/tty/n_gsm.c | 26 +- drivers/tty/serial/amba-pl011.c | 1 + drivers/usb/class/cdc-acm.c | 2 + drivers/usb/class/usblp.c | 5 +- drivers/usb/core/quirks.c | 3 +- drivers/usb/dwc2/core_intr.c | 7 +- drivers/usb/dwc2/gadget.c | 6 - drivers/usb/dwc2/platform.c | 11 + drivers/usb/gadget/composite.c | 78 ++- drivers/usb/gadget/udc/lpc32xx_udc.c | 11 +- drivers/usb/gadget/udc/m66592-udc.c | 2 +- drivers/usb/gadget/udc/mv_udc_core.c | 3 +- drivers/usb/gadget/udc/s3c2410_udc.c | 4 - drivers/usb/host/ehci-exynos.c | 5 +- drivers/usb/host/ehci-mxc.c | 2 + drivers/usb/host/ehci-pci.c | 7 + drivers/usb/host/ehci-platform.c | 5 + drivers/usb/host/ohci-platform.c | 5 + drivers/usb/host/ohci-sm501.c | 1 + drivers/usb/host/xhci-plat.c | 11 +- drivers/usb/host/xhci.c | 4 + drivers/usb/host/xhci.h | 2 +- drivers/vfio/pci/vfio_pci_config.c | 14 +- drivers/video/backlight/lp855x_bl.c | 20 +- drivers/watchdog/da9062_wdt.c | 5 - fs/block_dev.c | 12 +- fs/cifs/smb2ops.c | 12 + fs/compat_ioctl.c | 17 - fs/dlm/dlm_internal.h | 1 - fs/ext4/extents.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- fs/nfs/direct.c | 13 +- fs/nfs/file.c | 1 + fs/nfs/flexfilelayout/flexfilelayout.c | 11 +- fs/nfs/nfs4proc.c | 2 +- fs/nfsd/nfs4callback.c | 2 + fs/ocfs2/ocfs2_fs.h | 4 +- fs/ocfs2/suballoc.c | 9 +- fs/xfs/libxfs/xfs_alloc.c | 16 + include/linux/bitops.h | 2 +- include/linux/elfnote.h | 2 +- include/linux/genhd.h | 2 + include/linux/kprobes.h | 4 + include/linux/libata.h | 3 + include/linux/mtd/nand.h | 6 +- include/linux/netdevice.h | 2 +- include/linux/qed/qed_chain.h | 26 +- include/linux/usb/composite.h | 3 + include/net/sctp/constants.h | 8 +- include/net/sock.h | 1 - include/uapi/linux/dvb/frontend.h | 591 +++++++++++++++--- kernel/kprobes.c | 27 +- kernel/sched/core.c | 3 +- kernel/trace/blktrace.c | 13 + kernel/trace/trace_events_trigger.c | 21 +- lib/zlib_inflate/inffast.c | 91 ++- mm/slab_common.c | 2 +- net/core/dev.c | 47 +- net/core/sock.c | 2 + net/ipv4/fib_semantics.c | 2 +- net/ipv4/ip_tunnel.c | 14 +- net/ipv4/tcp_cubic.c | 2 + net/ipv4/tcp_input.c | 12 +- net/ipv6/ip6_gre.c | 9 +- net/ipv6/mcast.c | 1 + net/l2tp/l2tp_core.c | 7 +- net/netfilter/ipset/ip_set_core.c | 2 + net/rxrpc/call_accept.c | 7 + net/sched/sch_generic.c | 1 + net/sctp/associola.c | 5 +- net/sctp/bind_addr.c | 1 + net/sctp/protocol.c | 1 + net/sunrpc/addr.c | 4 +- net/sunrpc/rpc_pipe.c | 1 + net/sunrpc/xdr.c | 4 + scripts/Kbuild.include | 11 +- scripts/mksysmap | 2 +- security/selinux/ss/services.c | 4 + sound/isa/wavefront/wavefront_synth.c | 8 +- sound/pci/hda/patch_hdmi.c | 5 + sound/soc/fsl/fsl_asrc_dma.c | 1 + sound/usb/card.h | 4 + sound/usb/endpoint.c | 43 +- sound/usb/endpoint.h | 1 + sound/usb/mixer.c | 34 +- sound/usb/mixer.h | 15 +- sound/usb/mixer_quirks.c | 11 +- sound/usb/mixer_scarlett.c | 6 +- sound/usb/pcm.c | 2 + sound/usb/quirks.c | 1 + tools/perf/builtin-report.c | 3 +- .../networking/timestamping/timestamping.c | 10 +- tools/testing/selftests/x86/protection_keys.c | 3 +- 221 files changed, 1919 insertions(+), 930 deletions(-)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 1/191 power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select
From: Enric Balletbo i Serra <[email protected]>
[ Upstream commit 87c3d579c8ed0eaea6b1567d529a8daa85a2bc6c ]
regmap is a library function that gets selected by drivers that need it. No driver modules should depend on it. Depending on REGMAP_I2C makes this driver only build if another driver already selected REGMAP_I2C, as the symbol can't be selected through the menu kernel configuration.
--- drivers/power/supply/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/Kconfig +1 -1
@@ -424,7 +424,7 @@ config CHARGER_BQ24257 tristate "TI BQ24250/24251/24257 battery charger driver" depends on I2C depends on GPIOLIB || COMPILE_TEST - depends on REGMAP_I2C + select REGMAP_I2C help Say Y to enable support for the TI BQ24250, BQ24251, and BQ24257 battery chargers.
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/191 clk: sunxi: Fix incorrect usage of round_down()
In reply to Sasha LevinFrom: Rikard Falkeborn <[email protected]>
[ Upstream commit ee25d9742dabed3fd18158b518f846abeb70f319 ]
round_down() can only round to powers of 2. If round_down() is asked to round to something that is not a power of 2, incorrect results are produced. The incorrect results can be both too large and too small.
Instead, use rounddown() which can round to any number.
--- drivers/clk/sunxi/clk-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi/clk-sunxi.c +1 -1
@@ -98,7 +98,7 @@ static void sun6i_a31_get_pll1_factors(struct factors_request *req)* Round down the frequency to the closest multiple of either * 6 or 16 */ -u32 round_freq_6 =round_down (freq_mhz,6 ); +u32 round_freq_6 =rounddown (freq_mhz,6 );u32 round_freq_16 =round_down (freq_mhz,16 );if (round_freq_6 > round_freq_16)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/191 i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets
In reply to Sasha LevinFrom: Adam Honse <[email protected]>
[ Upstream commit f27237c174fd9653033330e4e532cd9d153ce824 ]
The AMD X370 and other AM4 chipsets (A/B/X 3/4/5 parts) and Threadripper equivalents have a secondary SMBus controller at I/O port address 0x0B20. This bus is used by several manufacturers to control motherboard RGB lighting via embedded controllers. I have been using this bus in my OpenRGB project to control the Aura RGB on many motherboards and ASRock also uses this bus for their Polychrome RGB controller.
I am not aware of any CZ-compatible platforms which do not have the second SMBus channel. All of AMD's AM4- and Threadripper- series chipsets that OpenRGB users have tested appear to have this secondary bus. I also noticed this secondary bus is present on older AMD platforms including my FM1 home server.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202587
--- drivers/i2c/busses/i2c-piix4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-piix4.c +2 -1
@@ -840,7 +840,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) }if (dev->vendor ==PCI_VENDOR_ID_AMD && - dev->device ==PCI_DEVICE_ID_AMD_HUDSON2_SMBUS ) { + (dev->device ==PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || + dev->device ==PCI_DEVICE_ID_AMD_KERNCZ_SMBUS )) { retval =piix4_setup_sb800 (dev, id,1 ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/191 iio: pressure: bmp280: Tolerate IRQ before registering
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 97b31a6f5fb95b1ec6575b78a7240baddba34384 ]
With DEBUG_SHIRQ enabled we have a kernel crash
[ 116.482696] BUG: kernel NULL pointer dereference, address: 0000000000000000
...
[ 116.606571] Call Trace: [ 116.609023] <IRQ> [ 116.611047] complete+0x34/0x50 [ 116.614206] bmp085_eoc_irq+0x9/0x10 [bmp280]
because DEBUG_SHIRQ mechanism fires an IRQ before registration and drivers ought to be able to handle an interrupt happening before request_irq() returns.
--- drivers/iio/pressure/bmp280-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/pressure/bmp280-core.c +4 -1
@@ -630,7 +630,7 @@ static int bmp180_measure(struct bmp280_data *data, u8 ctrl_meas)unsigned int ctrl;if (data->use_eoc) -init_completion (&data->done); +reinit_completion (&data->done); ret =regmap_write (data->regmap,BMP280_REG_CTRL_MEAS , ctrl_meas);if (ret)
@@ -886,6 +886,9 @@ static int bmp085_fetch_eoc_irq(struct device *dev, "trying to enforce it\n"); irq_trig =IRQF_TRIGGER_RISING ; } + +init_completion (&data->done); + ret = devm_request_threaded_irq(dev, irq, bmp085_eoc_irq,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/191 clk: qcom: msm8916: Fix the address location of pll->config_reg
In reply to Sasha LevinFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit f47ab3c2f5338828a67e89d5f688d2cef9605245 ]
During the process of debugging a processor derived from the msm8916 which we found the new processor was not starting one of its PLLs.
After tracing the addresses and writes that downstream was doing and comparing to upstream it became obvious that we were writing to a different register location than downstream when trying to configure the PLL.
This error is also present in upstream msm8916.
As an example clk-pll.c::clk_pll_recalc_rate wants to write to pll->config_reg updating the bit-field POST_DIV_RATIO. That bit-field is defined in PLL_USER_CTL not in PLL_CONFIG_CTL. Taking the BIMC PLL as an example
lm80-p0436-13_c_qc_snapdragon_410_processor_hrd.pdf
0x01823010 GCC_BIMC_PLL_USER_CTL0x01823014 GCC_BIMC_PLL_CONFIG_CTL
This pattern is repeated for gpll0, gpll1, gpll2 and bimc_pll.
This error is likely not apparent since the bootloader will already have initialized these PLLs.
This patch corrects the location of config_reg from PLL_CONFIG_CTL to PLL_USER_CTL for all relevant PLLs on msm8916.
Fixes commit 3966fab8b6ab ("clk: qcom: Add MSM8916 Global Clock Controller support")
--- drivers/clk/qcom/gcc-msm8916.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/gcc-msm8916.c +4 -4
@@ -270,7 +270,7 @@ static struct clk_pll gpll0 = { .l_reg = 0x21004, .m_reg = 0x21008, .n_reg = 0x2100c, - .config_reg = 0x21014, + .config_reg = 0x21010, .mode_reg = 0x21000, .status_reg = 0x2101c, .status_bit = 17,
@@ -297,7 +297,7 @@ static struct clk_pll gpll1 = { .l_reg = 0x20004, .m_reg = 0x20008, .n_reg = 0x2000c, - .config_reg = 0x20014, + .config_reg = 0x20010, .mode_reg = 0x20000, .status_reg = 0x2001c, .status_bit = 17,
@@ -324,7 +324,7 @@ static struct clk_pll gpll2 = { .l_reg = 0x4a004, .m_reg = 0x4a008, .n_reg = 0x4a00c, - .config_reg = 0x4a014, + .config_reg = 0x4a010, .mode_reg = 0x4a000, .status_reg = 0x4a01c, .status_bit = 17,
@@ -351,7 +351,7 @@ static struct clk_pll bimc_pll = { .l_reg = 0x23004, .m_reg = 0x23008, .n_reg = 0x2300c, - .config_reg = 0x23014, + .config_reg = 0x23010, .mode_reg = 0x23000, .status_reg = 0x2301c, .status_bit = 17,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/191 backlight: lp855x: Ensure regulators are disabled on probe failure
In reply to Sasha LevinFrom: Jon Hunter <[email protected]>
[ Upstream commit d8207c155a7c6015eb7f43739baa7dfb1fa638af ]
If probing the LP885x backlight fails after the regulators have been enabled, then the following warning is seen when releasing the regulators ...
WARNING: CPU: 1 PID: 289 at drivers/regulator/core.c:2051 _regulator_put.part.28+0x158/0x160 Modules linked in: tegra_xudc lp855x_bl(+) host1x pwm_tegra ip_tables x_tables ipv6 nf_defrag_ipv6 CPU: 1 PID: 289 Comm: systemd-udevd Not tainted 5.6.0-rc2-next-20200224 #1 Hardware name: NVIDIA Jetson TX1 Developer Kit (DT)
...
Call trace: _regulator_put.part.28+0x158/0x160 regulator_put+0x34/0x50 devm_regulator_release+0x10/0x18 release_nodes+0x12c/0x230 devres_release_all+0x34/0x50 really_probe+0x1c0/0x370 driver_probe_device+0x58/0x100 device_driver_attach+0x6c/0x78 __driver_attach+0xb0/0xf0 bus_for_each_dev+0x68/0xc8 driver_attach+0x20/0x28 bus_add_driver+0x160/0x1f0 driver_register+0x60/0x110 i2c_register_driver+0x40/0x80 lp855x_driver_init+0x20/0x1000 [lp855x_bl] do_one_initcall+0x58/0x1a0 do_init_module+0x54/0x1d0 load_module+0x1d80/0x21c8 __do_sys_finit_module+0xe8/0x100 __arm64_sys_finit_module+0x18/0x20 el0_svc_common.constprop.3+0xb0/0x168 do_el0_svc+0x20/0x98 el0_sync_handler+0xf4/0x1b0 el0_sync+0x140/0x180
Fix this by ensuring that the regulators are disabled, if enabled, on probe failure.
Finally, ensure that the vddio regulator is disabled in the driver remove handler.
--- drivers/video/backlight/lp855x_bl.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/video/backlight/lp855x_bl.c +16 -4
@@ -460,7 +460,7 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) ret =regulator_enable (lp->enable);if (ret <0 ) {dev_err (lp->dev,"failed to enable vddio: %d\n" , ret); -return ret; + goto disable_supply; }/*
@@ -475,24 +475,34 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) ret =lp855x_configure (lp);if (ret) {dev_err (lp->dev,"device config err: %d" , ret); -return ret; + goto disable_vddio; } ret =lp855x_backlight_register (lp);if (ret) {dev_err (lp->dev,"failed to register backlight. err: %d\n" , ret); -return ret; + goto disable_vddio; } ret =sysfs_create_group (&lp->dev->kobj, &lp855x_attr_group);if (ret) {dev_err (lp->dev,"failed to register sysfs. err: %d\n" , ret); -return ret; + goto disable_vddio; }backlight_update_status (lp->bl); +return 0 ; + +disable_vddio: +if (lp->enable) +regulator_disable (lp->enable); +disable_supply: +if (lp->supply) +regulator_disable (lp->supply); + +return ret; }static int lp855x_remove (struct i2c_client *cl)
@@ -501,6 +511,8 @@ static int lp855x_remove(struct i2c_client *cl) lp->bl->props.brightness =0 ;backlight_update_status (lp->bl); +if (lp->enable) +regulator_disable (lp->enable);if (lp->supply)regulator_disable (lp->supply);sysfs_remove_group (&lp->dev->kobj, &lp855x_attr_group);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/191 ARM: integrator: Add some Kconfig selections
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit d2854bbe5f5c4b4bec8061caf4f2e603d8819446 ]
The CMA and DMA_CMA Kconfig options need to be selected by the Integrator in order to produce boot console on some Integrator systems.
The REGULATOR and REGULATOR_FIXED_VOLTAGE need to be selected in order to boot the system from an external MMC card when using MMCI/PL181 from the device tree probe path.
Select these things directly from the Kconfig so we are sure to be able to bring the systems up with console from any device tree.
--- arch/arm/mach-integrator/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm/mach-integrator/Kconfig +4 -3
@@ -3,6 +3,8 @@ menuconfig ARCH_INTEGRATOR depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6 select ARM_AMBA select COMMON_CLK_VERSATILE + select CMA + select DMA_CMA select HAVE_TCM select ICST select MFD_SYSCON
@@ -34,14 +36,13 @@ config INTEGRATOR_IMPD1 select ARM_VIC select GPIO_PL061 select GPIOLIB + select REGULATOR + select REGULATOR_FIXED_VOLTAGE help The IM-PD1 is an add-on logic module for the Integrator which allows ARM(R) Ltd PrimeCells to be developed and evaluated. The IM-PD1 can be found on the Integrator/PP2 platform. - To compile this driver as a module, choose M here: the - module will be called impd1. - config INTEGRATOR_CM7TDMI bool "Integrator/CM7TDMI core module" depends on ARCH_INTEGRATOR_AP
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/191 ALSA: isa/wavefront: prevent out of bounds write in ioctl
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7f0d5053c5a9d23fe5c2d337495a9d79038d267b ]
The "header->number" comes from the ioctl and it needs to be clamped to prevent out of bounds writes.
--- sound/isa/wavefront/wavefront_synth.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/isa/wavefront/wavefront_synth.c +7 -1
@@ -1174,7 +1174,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)"alias for %d\n" , header->number, header->hdr.a.OriginalSample); - + +if (header->number >=WF_MAX_SAMPLE ) +return -EINVAL ; +munge_int32 (header->number, &alias_hdr[0 ],2 );munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2 ],2 ); munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset),
@@ -1205,6 +1208,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)int num_samples;unsigned char *msample_hdr; +if (header->number >=WF_MAX_SAMPLE ) +return -EINVAL ; + msample_hdr =kmalloc (WF_MSAMPLE_BYTES ,GFP_KERNEL );if (! msample_hdr)return -ENOMEM ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/191 scsi: qla2xxx: Fix issue with adapter's stopping state
In reply to Sasha LevinFrom: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 803e45550b11c8e43d89812356fe6f105adebdf9 ]
The goal of the following command sequence is to restart the adapter. However, the tgt_stop flag remains set, indicating that the adapter is still in stopping state even after re-enabling it.
echo 0x7fffffff > /sys/module/qla2xxx/parameters/logging modprobe target_core_mod
modprobe tcm_qla2xxx
mkdir /sys/kernel/config/target/qla2xxx
mkdir /sys/kernel/config/target/qla2xxx/<port-name>
mkdir /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1 echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable echo 0 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
kernel: PID 1396:qla_target.c:1555 qlt_stop_phase1(): tgt_stop 0x0, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-e803:1: PID 1396:qla_target.c:1567: Stopping target for host 1(c0000000033557e8)
kernel: PID 1396:qla_target.c:1579 qlt_stop_phase1(): tgt_stop 0x1, tgt_stopped 0x0
kernel: PID 1396:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-e801:1: PID 1396:qla_target.c:1316: Scheduling sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7 <skipped>
kernel: qla2xxx [0001:00:02.0]-290a:1: PID 340:qla_target.c:1187: qlt_unreg_sess sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7 <skipped>
kernel: qla2xxx [0001:00:02.0]-f801:1: PID 340:qla_target.c:1145: Unregistration of sess c00000002d5cd800 21:00:00:24:ff:7f:35:c7 finished fcp_cnt 0
kernel: PID 340:qla_target.c:1155 qlt_free_session_done(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
<skipped>
kernel: qla2xxx [0001:00:02.0]-28f1:1: PID 346:qla_os.c:3956: Mark all dev lost
kernel: PID 346:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.
<skipped>
kernel: PID 1396:qla_target.c:6812 qlt_enable_vha(): tgt_stop 0x1, tgt_stopped 0x0
<skipped>
kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
<skipped>
kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.
qlt_handle_cmd_for_atio() rejects the request to send commands because the adapter is in the stopping state:
kernel: PID 0:qla_target.c:4442 qlt_handle_cmd_for_atio(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-3861:1: PID 0:qla_target.c:4447: New command while device c000000005314600 is shutting down
kernel: qla2xxx [0001:00:02.0]-e85f:1: PID 0:qla_target.c:5728: qla_target: Unable to send command to target
This patch calls qla_stop_phase2() in addition to qlt_stop_phase1() in tcm_qla2xxx_tpg_enable_store() and tcm_qla2xxx_npiv_tpg_enable_store(). The qlt_stop_phase1() marks adapter as stopping (tgt_stop == 0x1, tgt_stopped == 0x0) but qlt_stop_phase2() marks adapter as stopped (tgt_stop == 0x0, tgt_stopped == 0x1).
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -0
@@ -855,6 +855,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,atomic_set (&tpg->lport_tpg_enabled,0 );qlt_stop_phase1 (vha->vha_tgt.qla_tgt); +qlt_stop_phase2 (vha->vha_tgt.qla_tgt); }return count;
@@ -1019,6 +1020,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,atomic_set (&tpg->lport_tpg_enabled,0 );qlt_stop_phase1 (vha->vha_tgt.qla_tgt); +qlt_stop_phase2 (vha->vha_tgt.qla_tgt); }return count;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/191 iio: bmp280: fix compensation of humidity
In reply to Sasha LevinFrom: Andreas Klinger <[email protected]>
[ Upstream commit dee2dabc0e4115b80945fe2c91603e634f4b4686 ]
Limit the output of humidity compensation to the range between 0 and 100 percent.
Depending on the calibration parameters of the individual sensor it happens, that a humidity above 100 percent or below 0 percent is calculated, which don't make sense in terms of relative humidity.
Add a clamp to the compensation formula as described in the datasheet of the sensor in chapter 4.2.3.
Although this clamp is documented, it was never in the driver of the kernel.
It depends on the circumstances (calibration parameters, temperature, humidity) if one can see a value above 100 percent without the clamp. The writer of this patch was working with this type of sensor without noting this error. So it seems to be a rare event when this bug occures.
--- drivers/iio/pressure/bmp280-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/pressure/bmp280-core.c +2 -0
@@ -182,6 +182,8 @@ static u32 bmp280_compensate_humidity(struct bmp280_data *data, + (s32)2097152) * H2 + 8192) >> 14); var -= ((((var >>15 ) * (var >>15 )) >>7 ) * (s32 )H1 ) >>4 ; + var =clamp_val (var,0 ,419430400 ); +return var >>12 ; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/191 i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit e81c979f4e071d516aa27cf5a0c3939da00dc1ca ]
If we timeout during a message transfer, the control register may contain bits that cause an action to be set. Read-modify-writing the register leaving these bits set may trigger the hardware to attempt one of these actions unintentionally.
Always clear these bits when cleaning up after a message or after a timeout.
--- drivers/i2c/busses/i2c-pxa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-pxa.c +2 -4
@@ -691,11 +691,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c) {u32 icr; -/* -* Clear the STOP and ACK flags -*/ +/* Clear the START, STOP, ACK, TB and MA flags */ icr =readl (_ICR (i2c)); - icr &= ~(ICR_STOP |ICR_ACKNAK ); + icr &= ~(ICR_START |ICR_STOP |ICR_ACKNAK |ICR_TB |ICR_MA );writel (icr,_ICR (i2c)); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/191 usblp: poison URBs upon disconnect
In reply to Sasha LevinFrom: Oliver Neukum <[email protected]>
[ Upstream commit 296a193b06120aa6ae7cf5c0d7b5e5b55968026e ]
syzkaller reported an URB that should have been killed to be active. We do not understand it, but this should fix the issue if it is real.
--- drivers/usb/class/usblp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/class/usblp.c +4 -1
@@ -481,7 +481,8 @@ static int usblp_release(struct inode *inode, struct file *file)usb_autopm_put_interface (usblp->intf);if (!usblp->present)/* finish cleanup from disconnect */ -usblp_cleanup (usblp); +usblp_cleanup (usblp);/* any URBs must be dead */ +mutex_unlock (&usblp_mutex);return 0 ; }
@@ -1397,9 +1398,11 @@ static void usblp_disconnect(struct usb_interface *intf)usblp_unlink_urbs (usblp);mutex_unlock (&usblp->mut); +usb_poison_anchored_urbs (&usblp->urbs);if (!usblp->used)usblp_cleanup (usblp); +mutex_unlock (&usblp_mutex); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/191 PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 90c6cb4a355e7befcb557d217d1d8b8bd5875a05 ]
Trying to change Link Status register does not have any effect as this is a read-only register. Trying to overwrite bits for Negotiated Link Width does not make sense.
In future proper change of link width can be done via Lane Count Select bits in PCIe Control 0 register.
Trying to unconditionally enable ASPM L0s via ASPM Control bits in Link Control register is wrong. There should be at least some detection if endpoint supports L0s as isn't mandatory.
Moreover ASPM Control bits in Link Control register are controlled by pcie/aspm.c code which sets it according to system ASPM settings, immediately after aardvark driver probes. So setting these bits by aardvark driver has no long running effect.
Remove code which touches ASPM L0s bits from this driver and let kernel's ASPM implementation to set ASPM state properly.
Some users are reporting issues that this code is problematic for some Intel wifi cards and removing it fixes them, see e.g.:
https://bugzilla.kernel.org/show_bug.cgi?id=196339
If problems with Intel wifi cards occur even after this commit, then pcie/aspm.c code could be modified / hooked to not enable ASPM L0s state for affected problematic cards.
--- drivers/pci/host/pci-aardvark.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pci/host/pci-aardvark.c +0 -4
@@ -363,10 +363,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)advk_pcie_wait_for_link (pcie); - reg =PCIE_CORE_LINK_L0S_ENTRY | - (1 <<PCIE_CORE_LINK_WIDTH_SHIFT ); -advk_writel (pcie, reg,PCIE_CORE_LINK_CTRL_STAT_REG ); - reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); reg |=PCIE_CORE_CMD_MEM_ACCESS_EN | PCIE_CORE_CMD_IO_ACCESS_EN |
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/191 ps3disk: use the default segment boundary
In reply to Sasha LevinFrom: Emmanuel Nicolet <[email protected]>
[ Upstream commit 720bc316690bd27dea9d71510b50f0cd698ffc32 ]
Since commit dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count"), the kernel will bug_on on the PS3 because bio_split() is called with sectors == 0:
kernel BUG at block/bio.c:1853!
Oops: Exception in kernel mode, sig: 5 [#1] BE PAGE_SIZE=4K MMU=Hash PREEMPT SMP NR_CPUS=8 NUMA PS3 Modules linked in: firewire_sbp2 rtc_ps3(+) soundcore ps3_gelic(+) \ ps3rom(+) firewire_core ps3vram(+) usb_common crc_itu_t CPU: 0 PID: 97 Comm: blkid Not tainted 5.3.0-rc4 #1 NIP: c00000000027d0d0 LR: c00000000027d0b0 CTR: 0000000000000000 REGS: c00000000135ae90 TRAP: 0700 Not tainted (5.3.0-rc4) MSR: 8000000000028032 <SF,EE,IR,DR,RI> CR: 44008240 XER: 20000000 IRQMASK: 0 GPR00: c000000000289368 c00000000135b120 c00000000084a500 c000000004ff8300 GPR04: 0000000000000c00 c000000004c905e0 c000000004c905e0 000000000000ffff GPR08: 0000000000000000 0000000000000001 0000000000000000 000000000000ffff GPR12: 0000000000000000 c0000000008ef000 000000000000003e 0000000000080001 GPR16: 0000000000000100 000000000000ffff 0000000000000000 0000000000000004 GPR20: c00000000062fd7e 0000000000000001 000000000000ffff 0000000000000080 GPR24: c000000000781788 c00000000135b350 0000000000000080 c000000004c905e0 GPR28: c00000000135b348 c000000004ff8300 0000000000000000 c000000004c90000 NIP [c00000000027d0d0] .bio_split+0x28/0xac LR [c00000000027d0b0] .bio_split+0x8/0xac Call Trace: [c00000000135b120] [c00000000027d130] .bio_split+0x88/0xac (unreliable) [c00000000135b1b0] [c000000000289368] .__blk_queue_split+0x11c/0x53c [c00000000135b2d0] [c00000000028f614] .blk_mq_make_request+0x80/0x7d4 [c00000000135b3d0] [c000000000283a8c] .generic_make_request+0x118/0x294 [c00000000135b4b0] [c000000000283d34] .submit_bio+0x12c/0x174 [c00000000135b580] [c000000000205a44] .mpage_bio_submit+0x3c/0x4c [c00000000135b600] [c000000000206184] .mpage_readpages+0xa4/0x184 [c00000000135b750] [c0000000001ff8fc] .blkdev_readpages+0x24/0x38 [c00000000135b7c0] [c0000000001589f0] .read_pages+0x6c/0x1a8 [c00000000135b8b0] [c000000000158c74] .__do_page_cache_readahead+0x118/0x184 [c00000000135b9b0] [c0000000001591a8] .force_page_cache_readahead+0xe4/0xe8 [c00000000135ba50] [c00000000014fc24] .generic_file_read_iter+0x1d8/0x830 [c00000000135bb50] [c0000000001ffadc] .blkdev_read_iter+0x40/0x5c [c00000000135bbc0] [c0000000001b9e00] .new_sync_read+0x144/0x1a0 [c00000000135bcd0] [c0000000001bc454] .vfs_read+0xa0/0x124 [c00000000135bd70] [c0000000001bc7a4] .ksys_read+0x70/0xd8 [c00000000135be20] [c00000000000a524] system_call+0x5c/0x70 Instruction dump: 7fe3fb78 482e30dc 7c0802a6 482e3085 7c9e2378 f821ff71 7ca42b78 7d3e00d0 7c7d1b78 79290fe0 7cc53378 69290001 <0b090000> 81230028 7bca0020 7929ba62 [ end trace 313fec760f30aa1f ]---
The problem originates from setting the segment boundary of the request queue to -1UL. This makes get_max_segment_size() return zero when offset is zero, whatever the max segment size. The test with BLK_SEG_BOUNDARY_MASK fails and 'mask - (mask & offset) + 1' overflows to zero in the return statement.
Not setting the segment boundary and using the default value (BLK_SEG_BOUNDARY_MASK) fixes the problem.
--- drivers/block/ps3disk.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/ps3disk.c +0 -1
@@ -464,7 +464,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)blk_queue_bounce_limit (queue,BLK_BOUNCE_HIGH );blk_queue_max_hw_sectors (queue, dev->bounce_size >>9 ); -blk_queue_segment_boundary (queue,-1UL );blk_queue_dma_alignment (queue, dev->blk_size-1 );blk_queue_logical_block_size (queue, dev->blk_size);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 15/191 vfio/pci: fix memory leaks in alloc_perm_bits()
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit 3e63b94b6274324ff2e7d8615df31586de827c4e ]
vfio_pci_disable() calls vfio_config_free() but forgets to call free_perm_bits() resulting in memory leaks,
unreferenced object 0xc000000c4db2dee0 (size 16):
comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s) hex dump (first 16 bytes):
00 00 ff 00 ff ff ff ff ff ff ff ff ff ff 00 00 ................
backtrace:
[<00000000a6a4552d>] alloc_perm_bits+0x58/0xe0 [vfio_pci]
[<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
init_pci_cap_msi_perm at drivers/vfio/pci/vfio_pci_config.c:1125
(inlined by) vfio_msi_cap_len at drivers/vfio/pci/vfio_pci_config.c:1180
(inlined by) vfio_cap_len at drivers/vfio/pci/vfio_pci_config.c:1241
(inlined by) vfio_cap_init at drivers/vfio/pci/vfio_pci_config.c:1468
(inlined by) vfio_config_init at drivers/vfio/pci/vfio_pci_config.c:1707
[<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
[<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
[<000000009e34c54f>] ksys_ioctl+0xd8/0x130
[<000000006577923d>] sys_ioctl+0x28/0x40
[<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
[<0000000008ea7dd5>] system_call_common+0xf0/0x278
unreferenced object 0xc000000c4db2e330 (size 16):
comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
hex dump (first 16 bytes):
00 ff ff 00 ff ff ff ff ff ff ff ff ff ff 00 00 ................
backtrace:
[<000000004c71914f>] alloc_perm_bits+0x44/0xe0 [vfio_pci]
[<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
[<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
[<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
[<000000009e34c54f>] ksys_ioctl+0xd8/0x130
[<000000006577923d>] sys_ioctl+0x28/0x40
[<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
[<0000000008ea7dd5>] system_call_common+0xf0/0x278--- drivers/vfio/pci/vfio_pci_config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vfio/pci/vfio_pci_config.c +5 -2
@@ -1729,8 +1729,11 @@ void vfio_config_free(struct vfio_pci_device *vdev) vdev->vconfig =NULL ;kfree (vdev->pci_config_map); vdev->pci_config_map =NULL ; -kfree (vdev->msi_perm); - vdev->msi_perm =NULL ; +if (vdev->msi_perm) { +free_perm_bits (vdev->msi_perm); +kfree (vdev->msi_perm); + vdev->msi_perm =NULL ; + } }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/191 mfd: wm8994: Fix driver operation if loaded as modules
In reply to Sasha LevinFrom: Marek Szyprowski <[email protected]>
[ Upstream commit d4f9b5428b53dd67f49ee8deed8d4366ed6b1933 ]
WM8994 chip has built-in regulators, which might be used for chip operation. They are controlled by a separate wm8994-regulator driver, which should be loaded before this driver calls regulator_get(), because that driver also provides consumer-supply mapping for the them. If that driver is not yet loaded, regulator core substitute them with dummy regulator, what breaks chip operation, because the built-in regulators are never enabled. Fix this by annotating this driver with MODULE_SOFTDEP() "pre" dependency to "wm8994_regulator" module.
--- drivers/mfd/wm8994-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/wm8994-core.c +1 -0
@@ -698,3 +698,4 @@ module_i2c_driver(wm8994_i2c_driver);MODULE_DESCRIPTION ("Core support for the WM8994 audio CODEC" );MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Mark Brown <[email protected]>" ); +MODULE_SOFTDEP ("pre: wm8994_regulator" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/191 scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 7217e6e694da3aae6d17db8a7f7460c8d4817ebf ]
In order to create or activate a new node, lpfc_els_unsol_buffer() invokes lpfc_nlp_init() or lpfc_enable_node() or lpfc_nlp_get(), all of them will return a reference of the specified lpfc_nodelist object to "ndlp" with increased refcnt.
When lpfc_els_unsol_buffer() returns, local variable "ndlp" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of lpfc_els_unsol_buffer(). When "ndlp" in DEV_LOSS, the function forgets to decrease the refcnt increased by lpfc_nlp_init() or lpfc_enable_node() or lpfc_nlp_get(), causing a refcnt leak.
Fix this issue by calling lpfc_nlp_put() when "ndlp" in DEV_LOSS.
--- drivers/scsi/lpfc/lpfc_els.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +2 -0
@@ -7606,6 +7606,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,spin_lock_irq (shost->host_lock);if (ndlp->nlp_flag &NLP_IN_DEV_LOSS ) {spin_unlock_irq (shost->host_lock); +if (newnode) +lpfc_nlp_put (ndlp); goto dropit; }spin_unlock_irq (shost->host_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 18/191 clk: clk-flexgen: fix clock-critical handling
In reply to Sasha LevinFrom: Alain Volmat <[email protected]>
[ Upstream commit a403bbab1a73d798728d76931cab3ff0399b9560 ]
Fixes an issue leading to having all clocks following a critical clocks marked as well as criticals.
--- drivers/clk/st/clk-flexgen.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/st/clk-flexgen.c +1 -0
@@ -371,6 +371,7 @@ static void __init st_of_flexgen_setup(struct device_node *np)break ; } + flex_flags &= ~CLK_IS_CRITICAL ;of_clk_detect_critical (np, i, &flex_flags);/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/191 powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run
In reply to Sasha LevinFrom: Kajol Jain <[email protected]>
[ Upstream commit b4ac18eead28611ff470d0f47a35c4e0ac080d9c ]
Commit 2b206ee6b0df ("powerpc/perf/hv-24x7: Display change in counter values")' added to print _change_ in the counter value rather then raw value for 24x7 counters. Incase of transactions, the event count is set to 0 at the beginning of the transaction. It also sets the event's prev_count to the raw value at the time of initialization. Because of setting event count to 0, we are seeing some weird behaviour, whenever we run multiple 24x7 events at a time.
For example:
command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/,
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}"
-C 0 -I 1000 sleep 100
1.000121704 120 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
1.000121704 5 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
2.000357733 8 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
2.000357733 10 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
3.000495215 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
3.000495215 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
4.000641884 56 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
4.000641884 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
5.000791887 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/Getting these large values in case we do -I.
As we are setting event_count to 0, for interval case, overall event_count is not coming in incremental order. As we may can get new delta lesser then previous count. Because of which when we print intervals, we are getting negative value which create these large values.
This patch removes part where we set event_count to 0 in function 'h_24x7_event_read'. There won't be much impact as we do set event->hw.prev_count to the raw value at the time of initialization to print change value.
With this patch
In power9 platform
command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/,
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}"
-C 0 -I 1000 sleep 100
1.000117685 93 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
1.000117685 1 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
2.000349331 98 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
2.000349331 2 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
3.000495900 131 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
3.000495900 4 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
4.000645920 204 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
4.000645920 61 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
4.284169997 22 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/--- arch/powerpc/perf/hv-24x7.c | 10 ---------- 1 file changed, 10 deletions(-)
arch/powerpc/perf/hv-24x7.c +0 -10
@@ -1306,16 +1306,6 @@ static void h_24x7_event_read(struct perf_event *event) h24x7hw = &get_cpu_var (hv_24x7_hw); h24x7hw->events[i] = event;put_cpu_var (h24x7hw); -/* -* Clear the event count so we can compute the _change_ -* in the 24x7 raw counter value at the end of the txn. -* -* Note that we could alternatively read the 24x7 value -* now and save its value in event->hw.prev_count. But -* that would require issuing a hcall, which would then -* defeat the purpose of using the txn interface. -*/ -local64_set (&event->count,0 ); }put_cpu_var (hv_24x7_reqb);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 20/191 nfsd: Fix svc_xprt refcnt leak when setup callback client failed
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit a4abc6b12eb1f7a533c2e7484cfa555454ff0977 ]
nfsd4_process_cb_update() invokes svc_xprt_get(), which increases the refcount of the "c->cn_xprt".
The reference counting issue happens in one exception handling path of nfsd4_process_cb_update(). When setup callback client failed, the function forgets to decrease the refcnt increased by svc_xprt_get(), causing a refcnt leak.
Fix this issue by calling svc_xprt_put() when setup callback client failed.
--- fs/nfsd/nfs4callback.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/nfs4callback.c +2 -0
@@ -1156,6 +1156,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb) err =setup_callback_client (clp, &conn, ses);if (err) {nfsd4_mark_cb_down (clp, err); +if (c) +svc_xprt_put (c->cn_xprt);return ; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 21/191 powerpc/crashkernel: Take "mem=" option into account
In reply to Sasha LevinFrom: Pingfan Liu <[email protected]>
[ Upstream commit be5470e0c285a68dc3afdea965032f5ddc8269d7 ]
'mem=" option is an easy way to put high pressure on memory during some test. Hence after applying the memory limit, instead of total mem, the actual usable memory should be considered when reserving mem for crashkernel. Otherwise the boot up may experience OOM issue.
E.g. it would reserve 4G prior to the change and 512M afterward, if passing crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and mem=5G on a 256G machine.
This issue is powerpc specific because it puts higher priority on fadump and kdump reservation than on "mem=". Referring the following code:
if (fadump_reserve_mem() == 0)
reserve_crashkernel();
...
/* Ensure that total memory size is page-aligned. */
limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
memblock_enforce_memory_limit(limit);While on other arches, the effect of "mem=" takes a higher priority and pass through memblock_phys_mem_size() before calling reserve_crashkernel().
--- arch/powerpc/kernel/machine_kexec.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/kernel/machine_kexec.c +5 -3
@@ -113,11 +113,12 @@ void machine_kexec(struct kimage *image)void __init reserve_crashkernel (void ) { -unsigned long long crash_size, crash_base; +unsigned long long crash_size, crash_base, total_mem_sz;int ret; + total_mem_sz = memory_limit ? memory_limit :memblock_phys_mem_size ();/* use common parsing */ - ret =parse_crashkernel (boot_command_line,memblock_phys_mem_size (), + ret =parse_crashkernel (boot_command_line, total_mem_sz, &crash_size, &crash_base);if (ret ==0 && crash_size >0 ) { crashk_res.start = crash_base;
@@ -176,6 +177,7 @@ void __init reserve_crashkernel(void)/* Crash kernel trumps memory limit */ if (memory_limit && memory_limit <= crashk_res.end) { memory_limit = crashk_res.end +1 ; + total_mem_sz = memory_limit;printk ("Adjusted memory limit for crashkernel, now 0x%llx\n" , memory_limit); }
@@ -184,7 +186,7 @@ void __init reserve_crashkernel(void)"for crashkernel (System RAM: %ldMB)\n" , (unsigned long )(crash_size >>20 ), (unsigned long )(crashk_res.start >>20 ), - (unsigned long)(memblock_phys_mem_size() >> 20)); + (unsigned long)(total_mem_sz >> 20));if (!memblock_is_region_memory (crashk_res.start, crash_size) ||memblock_reserve (crashk_res.start, crash_size)) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/191 yam: fix possible memory leak in yam_init_driver
In reply to Sasha LevinFrom: Wang Hai <[email protected]>
[ Upstream commit 98749b7188affbf2900c2aab704a8853901d1139 ]
If register_netdev(dev) fails, free_netdev(dev) needs to be called, otherwise a memory leak will occur.
--- drivers/net/hamradio/yam.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/hamradio/yam.c +1 -0
@@ -1160,6 +1160,7 @@ static int __init yam_init_driver(void) err =register_netdev (dev);if (err) {printk (KERN_WARNING "yam: cannot register net device %s\n" , dev->name); +free_netdev (dev); goto error; } yam_devs[i] = dev;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 23/191 mksysmap: Fix the mismatch of '.L' symbols in System.map
In reply to Sasha LevinFrom: ashimida <[email protected]>
[ Upstream commit 72d24accf02add25e08733f0ecc93cf10fcbd88c ]
When System.map was generated, the kernel used mksysmap to filter the kernel symbols, but all the symbols with the second letter 'L' in the kernel were filtered out, not just the symbols starting with 'dot + L'.
For example:
ashimida@ubuntu:~/linux$ cat System.map |grep ' .L' ashimida@ubuntu:~/linux$ nm -n vmlinux |grep ' .L' ffff0000088028e0 t bLength_show ...... ffff0000092e0408 b PLLP_OUTC_lock ffff0000092e0410 b PLLP_OUTA_lock
The original intent should be to filter out all local symbols starting with '.L', so the dot should be escaped.
--- scripts/mksysmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mksysmap +1 -1
@@ -41,4 +41,4 @@ # so we just ignore them to let readprofile continue to work. # (At least sparc64 has __crc_ in the middle). -$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2 +$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 24/191 scsi: sr: Fix sr_probe() missing deallocate of device minor
In reply to Sasha LevinFrom: Simon Arlott <[email protected]>
[ Upstream commit 6555781b3fdec5e94e6914511496144241df7dee ]
If the cdrom fails to be registered then the device minor should be deallocated.
--- drivers/scsi/sr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/sr.c +5 -1
@@ -745,7 +745,7 @@ static int sr_probe(struct device *dev) cd->cdi.disk = disk;if (register_cdrom (&cd->cdi)) - goto fail_put; + goto fail_minor;/* * Initialize block layer runtime PM stuffs before the
@@ -763,6 +763,10 @@ static int sr_probe(struct device *dev)return 0 ; +fail_minor: +spin_lock (&sr_index_lock); +clear_bit (minor, sr_index_bits); +spin_unlock (&sr_index_lock); fail_put:put_disk (disk); fail_free:
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 25/191 scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM
In reply to Sasha LevinFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit 4919b33b63c8b69d8dcf2b867431d0e3b6dc6d28 ]
The adapter info MAD is used to send the client info and receive the host info as a response. A persistent buffer is used and as such the client info is overwritten after the response. During the course of a normal adapter reset the client info is refreshed in the buffer in preparation for sending the adapter info MAD.
However, in the special case of LPM where we reenable the CRQ instead of a full CRQ teardown and reset we fail to refresh the client info in the adapter info buffer. As a result, after Live Partition Migration (LPM) we erroneously report the host's info as our own.
[mkp: typos]
--- drivers/scsi/ibmvscsi/ibmvscsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/ibmvscsi/ibmvscsi.c +2 -0
@@ -425,6 +425,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,int rc =0 ;struct vio_dev *vdev =to_vio_dev (hostdata->dev); +set_adapter_info (hostdata); +/* Re-enable the CRQ */ do { if (rc)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 26/191 ALSA: usb-audio: Improve frames size computation
In reply to Sasha LevinFrom: Alexander Tsoy <[email protected]>
[ Upstream commit f0bd62b64016508938df9babe47f65c2c727d25c ]
For computation of the the next frame size current value of fs/fps and accumulated fractional parts of fs/fps are used, where values are stored in Q16.16 format. This is quite natural for computing frame size for asynchronous endpoints driven by explicit feedback, since in this case fs/fps is a value provided by the feedback endpoint and it's already in the Q format. If an error is accumulated over time, the device can adjust fs/fps value to prevent buffer overruns/underruns.
But for synchronous endpoints the accuracy provided by these computations is not enough. Due to accumulated error the driver periodically produces frames with incorrect size (+/- 1 audio sample).
This patch fixes this issue by implementing a different algorithm for frame size computation. It is based on accumulating of the remainders from division fs/fps and it doesn't accumulate errors over time. This new method is enabled for synchronous and adaptive playback endpoints.
--- sound/usb/card.h | 4 ++++ sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++----- sound/usb/endpoint.h | 1 + sound/usb/pcm.c | 2 ++ 4 files changed, 45 insertions(+), 5 deletions(-)
sound/usb/card.h +4 -0
@@ -80,6 +80,10 @@ struct snd_usb_endpoint {dma_addr_t sync_dma;/* DMA address of syncbuf */ unsigned int pipe;/* the data i/o pipe */ +unsigned int framesize[2 ];/* small/large frame sizes in samples */ +unsigned int sample_rem;/* remainder from division fs/fps */ +unsigned int sample_accum;/* sample accumulator */ +unsigned int fps;/* frames per second */ unsigned int freqn;/* nominal sampling rate in fs/fps in Q16.16 format */ unsigned int freqm;/* momentary sampling rate in fs/fps in Q16.16 format */ int freqshift;/* how much to shift the feedback value to get Q16.16 */
sound/usb/endpoint.c +38 -5
78 lines not on this page · raw message
sound/usb/endpoint.h +1 -0
@@ -27,6 +27,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);void snd_usb_endpoint_free (struct snd_usb_endpoint *ep);int snd_usb_endpoint_implicit_feedback_sink (struct snd_usb_endpoint *ep); +int snd_usb_endpoint_slave_next_packet_size (struct snd_usb_endpoint *ep);int snd_usb_endpoint_next_packet_size (struct snd_usb_endpoint *ep); void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
sound/usb/pcm.c +2 -0
@@ -1483,6 +1483,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,for (i =0 ; i < ctx->packets; i++) {if (ctx->packet_size[i]) counts = ctx->packet_size[i]; +else if (ep->sync_master) + counts =snd_usb_endpoint_slave_next_packet_size (ep);else counts =snd_usb_endpoint_next_packet_size (ep);
Signature · 1 line
2.25.1
Re: [PATCH 4.9 026/191] ALSA: usb-audio: Improve frames size computation
В Пн, 29/06/2020 в 11:37 -0400, Sasha Levin пишет:
Quoted 33 lines
From: Alexander Tsoy <[email protected]>
[ Upstream commit
f0bd62b64016508938df9babe47f65c2c727d25c]For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can adjust fs/fps value to prevent buffer overruns/underruns.But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).This patch fixes this issue by implementing a different algorithm for frame size computation. It is based on accumulating of the remainders from division fs/fps and it doesn't accumulate errors over time. This new method is enabled for synchronous and adaptive playback endpoints.
Signed-off-by Alexander Tsoy <[email protected]>Link:
https://lore.kernel.org/r/[email protected]Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 7 lines
--- sound/usb/card.h | 4 ++++ sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-- --- sound/usb/endpoint.h | 1 + sound/usb/pcm.c | 2 ++ 4 files changed, 45 insertions(+), 5 deletions(-)
Please drop this patch from the queue for now (and for 4.4 as well). It introduced a regression for some devices. The fix is available, but not accepted yet.
Sasha Levin
maintainerRe: [PATCH 4.9 026/191] ALSA: usb-audio: Improve frames size computation
Quoted 42 lines · Alexander Tsoy
В Пн, 29/06/2020 в 11:37 -0400, Sasha Levin пишет:
Quoted 33 lines
From: Alexander Tsoy <[email protected]>
[ Upstream commit
f0bd62b64016508938df9babe47f65c2c727d25c]For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can adjust fs/fps value to prevent buffer overruns/underruns.But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).This patch fixes this issue by implementing a different algorithm for frame size computation. It is based on accumulating of the remainders from division fs/fps and it doesn't accumulate errors over time. This new method is enabled for synchronous and adaptive playback endpoints.
Signed-off-by Alexander Tsoy <[email protected]>Link:
https://lore.kernel.org/r/[email protected]Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 7 lines
--- sound/usb/card.h | 4 ++++ sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-- --- sound/usb/endpoint.h | 1 + sound/usb/pcm.c | 2 ++ 4 files changed, 45 insertions(+), 5 deletions(-)
Quoted 3 lines
Please drop this patch from the queue for now (and for 4.4 as well). It introduced a regression for some devices. The fix is available, but not accepted yet.
I've dropped it from the older branches, but note that it's already in newer released stable kernels. Should it be reverted or should we wait for the fix?
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 4.9 026/191] ALSA: usb-audio: Improve frames size computation
Quoted 43 lines · Sasha Levin
Quoted 42 lines · Alexander Tsoy
В Пн, 29/06/2020 в 11:37 -0400, Sasha Levin пишет:
Quoted 40 lines
From: Alexander Tsoy <[email protected]>
[ Upstream commit
f0bd62b64016508938df9babe47f65c2c727d25c]For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can adjust fs/fps value to prevent buffer overruns/underruns.But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).This patch fixes this issue by implementing a different algorithm for frame size computation. It is based on accumulating of the remainders from division fs/fps and it doesn't accumulate errors over time. This new method is enabled for synchronous and adaptive playback endpoints.
Signed-off-by Alexander Tsoy <[email protected]>Link:
https://lore.kernel.org/r/[email protected]Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/usb/card.h | 4 ++++ sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-- --- sound/usb/endpoint.h | 1 + sound/usb/pcm.c | 2 ++ 4 files changed, 45 insertions(+), 5 deletions(-)
Quoted 7 lines
Quoted 3 lines
Please drop this patch from the queue for now (and for 4.4 as well). It introduced a regression for some devices. The fix is available, but not accepted yet.
I've dropped it from the older branches, but note that it's already in newer released stable kernels. Should it be reverted or should we wait for the fix?
I was going to wait for the fix.
Re: [PATCH 4.9 026/191] ALSA: usb-audio: Improve frames size computation
Quoted 49 lines · Greg KH
Quoted 47 lines · Sasha Levin
Quoted 45 lines · Alexander Tsoy
В Пн, 29/06/2020 в 11:37 -0400, Sasha Levin пишет:
Quoted 33 lines
From: Alexander Tsoy <[email protected]>
[ Upstream commit
f0bd62b64016508938df9babe47f65c2c727d25c]For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can adjust fs/fps value to prevent buffer overruns/underruns.But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).This patch fixes this issue by implementing a different algorithm for frame size computation. It is based on accumulating of the remainders from division fs/fps and it doesn't accumulate errors over time. This new method is enabled for synchronous and adaptive playback endpoints.
Signed-off-by Alexander Tsoy <[email protected]>Link:
https://lore.kernel.org/r/[email protected]Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 7 lines
--- sound/usb/card.h | 4 ++++ sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-- --- sound/usb/endpoint.h | 1 + sound/usb/pcm.c | 2 ++ 4 files changed, 45 insertions(+), 5 deletions(-)Please drop this patch from the queue for now (and for 4.4 as well). It introduced a regression for some devices. The fix is available, but not accepted yet.
Quoted 5 lines
Quoted 3 lines
I've dropped it from the older branches, but note that it's already in newer released stable kernels. Should it be reverted or should we wait for the fix?
I was going to wait for the fix.
The corresponding fix is now in sound git tree.
But since I'm traveling in this week, the pull request to Linus will be delayed likely to the next week.
thanks,
Takashi
Sasha Levin
maintainerPATCH 27/191 s390/qdio: put thinint indicator after early error
In reply to Sasha LevinFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 75e82bec6b2622c6f455b7a543fb5476a5d0eed7 ]
qdio_establish() calls qdio_setup_thinint() via qdio_setup_irq(). If the subsequent qdio_establish_thinint() fails, we miss to put the DSCI again. Thus the DSCI isn't available for re-use. Given enough of such errors, we could end up with having only the shared DSCI available.
Merge qdio_setup_thinint() into qdio_establish_thinint(), and deal with such an error internally.
--- drivers/s390/cio/qdio.h | 1 - drivers/s390/cio/qdio_setup.c | 1 - drivers/s390/cio/qdio_thinint.c | 14 ++++++++------ 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/s390/cio/qdio.h +0 -1
@@ -376,7 +376,6 @@ static inline int multicast_outbound(struct qdio_q *q)extern u64 last_ai_time;/* prototypes for thin interrupt */ -void qdio_setup_thinint (struct qdio_irq *irq_ptr);int qdio_establish_thinint (struct qdio_irq *irq_ptr);void qdio_shutdown_thinint (struct qdio_irq *irq_ptr);void tiqdio_add_input_queues (struct qdio_irq *irq_ptr);
drivers/s390/cio/qdio_setup.c +0 -1
@@ -479,7 +479,6 @@ int qdio_setup_irq(struct qdio_initialize *init_data)setup_queues (irq_ptr, init_data);setup_qib (irq_ptr, init_data); -qdio_setup_thinint (irq_ptr); set_impl_params(irq_ptr, init_data->qib_param_field_format, init_data->qib_param_field, init_data->input_slib_elements,
drivers/s390/cio/qdio_thinint.c +8 -6
@@ -268,17 +268,19 @@ int __init tiqdio_register_thinints(void)int qdio_establish_thinint (struct qdio_irq *irq_ptr) { +int rc; +if (!is_thinint_irq (irq_ptr))return 0 ; -return set_subchannel_ind (irq_ptr,0 ); -} -void qdio_setup_thinint (struct qdio_irq *irq_ptr) -{ -if (!is_thinint_irq (irq_ptr)) -return ; irq_ptr->dsci =get_indicator ();DBF_HEX (&irq_ptr->dsci,sizeof (void *)); + + rc =set_subchannel_ind (irq_ptr,0 ); +if (rc) +put_indicator (irq_ptr->dsci); + +return rc; }void qdio_shutdown_thinint (struct qdio_irq *irq_ptr)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 28/191 tty: hvc: Fix data abort due to race in hvc_open
In reply to Sasha LevinFrom: Raghavendra Rao Ananta <[email protected]>
[ Upstream commit e2bd1dcbe1aa34ff5570b3427c530e4332ecf0fe ]
Potentially, hvc_open() can be called in parallel when two tasks calls open() on /dev/hvcX. In such a scenario, if the hp->ops->notifier_add() callback in the function fails, where it sets the tty->driver_data to NULL, the parallel hvc_open() can see this NULL and cause a memory abort. Hence, serialize hvc_open and check if tty->private_data is NULL before proceeding ahead.
The issue can be easily reproduced by launching two tasks simultaneously that does nothing but open() and close() on /dev/hvcX.
For example:
$ ./simple_open_close /dev/hvc0 & ./simple_open_close /dev/hvc0 &
--- drivers/tty/hvc/hvc_console.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/tty/hvc/hvc_console.c +14 -2
@@ -89,6 +89,8 @@ static LIST_HEAD(hvc_structs);*/ static DEFINE_SPINLOCK (hvc_structs_lock); +/* Mutex to serialize hvc_open */ +static DEFINE_MUTEX (hvc_open_mutex);/* * This value is used to assign a tty->index value to a hvc_struct based * upon order of exposure via hvc_probe(), when we can not match it to
@@ -333,16 +335,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)*/ static int hvc_open (struct tty_struct *tty,struct file * filp) { -struct hvc_struct *hp = tty->driver_data; +struct hvc_struct *hp;unsigned long flags;int rc =0 ; +mutex_lock (&hvc_open_mutex); + + hp = tty->driver_data; +if (!hp) { + rc = -EIO ; + goto out; + } +spin_lock_irqsave (&hp->port.lock, flags);/* Check and then increment for fast path open. */ if (hp->port.count++ >0 ) {spin_unlock_irqrestore (&hp->port.lock, flags);hvc_kick (); -return 0 ; + goto out; }/* else count == 0 */ spin_unlock_irqrestore (&hp->port.lock, flags);
@@ -370,6 +380,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)/* Force wakeup of the polling thread */ hvc_kick (); +out: +mutex_unlock (&hvc_open_mutex);return rc; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 29/191 staging: sm750fb: add missing case while setting FB_VISUAL
In reply to Sasha LevinFrom: Matej Dujava <[email protected]>
[ Upstream commit fa90133377f4a7f15a937df6ad55133bb57c5665 ]
Switch statement does not contain all cases: 8, 16, 24, 32. This patch will add missing one (24)
--- drivers/staging/sm750fb/sm750.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/sm750fb/sm750.c +1 -0
@@ -897,6 +897,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) fix->visual =FB_VISUAL_PSEUDOCOLOR ;break ;case 16 : +case 24 :case 32 : fix->visual =FB_VISUAL_TRUECOLOR ;break ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 30/191 i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit 88b73ee7ca4c90baf136ed5a8377fc5a9b73ac08 ]
The IRQ log output is supposed to appear on a single line. However, commit 3a2dc1677b60 ("i2c: pxa: Update debug function to dump more info on error") resulted in it being printed one-entry-per-line, which is excessively long.
Fixing this is not a trivial matter; using pr_cont() doesn't work as the previous dev_dbg() may not have been compiled in, or may be dynamic.
Since the rest of this function output is at error level, and is also debug output, promote this to error level as well to avoid this problem.
Reduce the number of always zero prefix digits to save screen real- estate.
--- drivers/i2c/busses/i2c-pxa.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-pxa.c +3 -4
@@ -297,11 +297,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)dev_err (dev,"IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n" ,readl (_IBMR (i2c)),readl (_IDBR (i2c)),readl (_ICR (i2c)),readl (_ISR (i2c))); -dev_dbg (dev,"log: " ); +dev_err (dev,"log:" );for (i =0 ; i < i2c->irqlogidx; i++) -pr_debug ("[%08x:%08x] " , i2c->isrlog[i], i2c->icrlog[i]); - - pr_debug("\n"); +pr_cont (" [%03x:%05x]" , i2c->isrlog[i], i2c->icrlog[i]); + pr_cont("\n"); }#else /* ifdef DEBUG */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 31/191 serial: amba-pl011: Make sure we initialize the port.lock spinlock
In reply to Sasha LevinFrom: John Stultz <[email protected]>
[ Upstream commit 8508f4cba308f785b2fd4b8c38849c117b407297 ]
Valentine reported seeing:
[ 3.626638] INFO: trying to register non-static key. [ 3.626639] the code is fine but needs lockdep annotation. [ 3.626640] turning off the locking correctness validator. [ 3.626644] CPU: 7 PID: 51 Comm: kworker/7:1 Not tainted 5.7.0-rc2-00115-g8c2e9790f196 #116 [ 3.626646] Hardware name: HiKey960 (DT) [ 3.626656] Workqueue: events deferred_probe_work_func [ 3.632476] sd 0:0:0:0: [sda] Optimal transfer size 8192 bytes not a multiple of physical block size (16384 bytes) [ 3.640220] Call trace: [ 3.640225] dump_backtrace+0x0/0x1b8 [ 3.640227] show_stack+0x20/0x30 [ 3.640230] dump_stack+0xec/0x158 [ 3.640234] register_lock_class+0x598/0x5c0 [ 3.640235] __lock_acquire+0x80/0x16c0 [ 3.640236] lock_acquire+0xf4/0x4a0 [ 3.640241] _raw_spin_lock_irqsave+0x70/0xa8 [ 3.640245] uart_add_one_port+0x388/0x4b8 [ 3.640248] pl011_register_port+0x70/0xf0 [ 3.640250] pl011_probe+0x184/0x1b8 [ 3.640254] amba_probe+0xdc/0x180 [ 3.640256] really_probe+0xe0/0x338 [ 3.640257] driver_probe_device+0x60/0xf8 [ 3.640259] __device_attach_driver+0x8c/0xd0 [ 3.640260] bus_for_each_drv+0x84/0xd8 [ 3.640261] __device_attach+0xe4/0x140 [ 3.640263] device_initial_probe+0x1c/0x28 [ 3.640265] bus_probe_device+0xa4/0xb0 [ 3.640266] deferred_probe_work_func+0x7c/0xb8 [ 3.640269] process_one_work+0x2c0/0x768 [ 3.640271] worker_thread+0x4c/0x498 [ 3.640272] kthread+0x14c/0x158 [ 3.640275] ret_from_fork+0x10/0x1c
Which seems to be due to the fact that after allocating the uap structure, nothing initializes the spinlock.
Its a little confusing, as uart_port_spin_lock_init() is one place where the lock is supposed to be initialized, but it has an exception for the case where the port is a console.
This makes it seem like a deeper fix is needed to properly register the console, but I'm not sure what that entails, and Andy suggested that this approach is less invasive.
Thus, this patch resolves the issue by initializing the spinlock in the driver, and resolves the resulting warning.
--- drivers/tty/serial/amba-pl011.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/amba-pl011.c +1 -0
@@ -2524,6 +2524,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, uap->port.fifosize = uap->fifosize; uap->port.flags =UPF_BOOT_AUTOCONF ; uap->port.line = index; +spin_lock_init (&uap->port.lock); amba_ports[index] = uap;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 32/191 drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish
In reply to Sasha LevinFrom: Kuppuswamy Sathyanarayanan <[email protected]>
[ Upstream commit 388bcc6ecc609fca1b4920de7dc3806c98ec535e ]
If platform bus driver registration is failed then, accessing platform bus spin lock (&drv->driver.bus->p->klist_drivers.k_lock) in __platform_driver_probe() without verifying the return value __platform_driver_register() can lead to NULL pointer exception.
So check the return value before attempting the spin lock.
One such example is below:
For a custom usecase, I have intentionally failed the platform bus registration and I expected all the platform device/driver registrations to fail gracefully. But I came across this panic issue.
[ 1.331067] BUG: kernel NULL pointer dereference, address: 00000000000000c8 [ 1.331118] #PF: supervisor write access in kernel mode [ 1.331163] #PF: error_code(0x0002) - not-present page [ 1.331208] PGD 0 P4D 0 [ 1.331233] Oops: 0002 [#1] PREEMPT SMP [ 1.331268] CPU: 3 PID: 1 Comm: swapper/0 Tainted: G W 5.6.0-00049-g670d35fb0144 #165 [ 1.331341] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 [ 1.331406] RIP: 0010:_raw_spin_lock+0x15/0x30 [ 1.331588] RSP: 0000:ffffc9000001be70 EFLAGS: 00010246 [ 1.331632] RAX: 0000000000000000 RBX: 00000000000000c8 RCX: 0000000000000001 [ 1.331696] RDX: 0000000000000001 RSI: 0000000000000092 RDI: 0000000000000000 [ 1.331754] RBP: 00000000ffffffed R08: 0000000000000501 R09: 0000000000000001 [ 1.331817] R10: ffff88817abcc520 R11: 0000000000000670 R12: 00000000ffffffed [ 1.331881] R13: ffffffff82dbc268 R14: ffffffff832f070a R15: 0000000000000000 [ 1.331945] FS: 0000000000000000(0000) GS:ffff88817bd80000(0000) knlGS:0000000000000000 [ 1.332008] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.332062] CR2: 00000000000000c8 CR3: 000000000681e001 CR4: 00000000003606e0 [ 1.332126] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1.332189] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1.332252] Call Trace: [ 1.332281] __platform_driver_probe+0x92/0xee [ 1.332323] ? rtc_dev_init+0x2b/0x2b [ 1.332358] cmos_init+0x37/0x67 [ 1.332396] do_one_initcall+0x7d/0x168 [ 1.332428] kernel_init_freeable+0x16c/0x1c9 [ 1.332473] ? rest_init+0xc0/0xc0 [ 1.332508] kernel_init+0x5/0x100 [ 1.332543] ret_from_fork+0x1f/0x30 [ 1.332579] CR2: 00000000000000c8 [ 1.332616] ---[ end trace 3bd87f12e9010b87 ]--- [ 1.333549] note: swapper/0[1] exited with preempt_count 1 [ 1.333592] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 1.333736] Kernel Offset: disabled
Note, this can only be triggered if a driver errors out from this call, which should never happen. If it does, the driver needs to be fixed.
--- drivers/base/platform.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/platform.c +2 -0
@@ -692,6 +692,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv,/* temporary section violation during probe() */ drv->probe = probe; retval = code =__platform_driver_register (drv, module); +if (retval) +return retval;/* * Fixup that section violation, being paranoid about code scanning
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 33/191 PCI: rcar: Fix incorrect programming of OB windows
In reply to Sasha LevinFrom: Andrew Murray <[email protected]>
[ Upstream commit 2b9f217433e31d125fb697ca7974d3de3ecc3e92 ]
The outbound windows (PCIEPAUR(x), PCIEPALR(x)) describe a mapping between a CPU address (which is determined by the window number 'x') and a programmed PCI address - Thus allowing the controller to translate CPU accesses into PCI accesses.
However the existing code incorrectly writes the CPU address - lets fix this by writing the PCI address instead.
For memory transactions, existing DT users describe a 1:1 identity mapping and thus this change should have no effect. However the same isn't true for I/O.
--- drivers/pci/host/pcie-rcar.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/pci/host/pcie-rcar.c +5 -4
@@ -328,11 +328,12 @@ static struct pci_ops rcar_pcie_ops = { };static void rcar_pcie_setup_window (int win,struct rcar_pcie *pcie, -struct resource *res) +struct resource_entry *window) {/* Setup PCIe address space mappings for each resource */ resource_size_t size;resource_size_t res_start; +struct resource *res = window->res;u32 mask;rcar_pci_write_reg (pcie,0x00000000 ,PCIEPTCTLR (win));
@@ -346,9 +347,9 @@ static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie,rcar_pci_write_reg (pcie, mask <<7 ,PCIEPAMR (win));if (res->flags &IORESOURCE_IO ) - res_start =pci_pio_to_address (res->start); + res_start =pci_pio_to_address (res->start) - window->offset;else - res_start = res->start; + res_start = res->start - window->offset;rcar_pci_write_reg (pcie,upper_32_bits (res_start),PCIEPAUR (win)); rcar_pci_write_reg(pcie, lower_32_bits(res_start) & ~0x7F,
@@ -377,7 +378,7 @@ static int rcar_pcie_setup(struct list_head *resource, struct rcar_pcie *pci)switch (resource_type (res)) {case IORESOURCE_IO :case IORESOURCE_MEM : -rcar_pcie_setup_window (i, pci, res); +rcar_pcie_setup_window (i, pci, win); i++;break ;case IORESOURCE_BUS :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 34/191 PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 66ff14e59e8a30690755b08bc3042359703fb07a ]
7d715a6c1ae5 ("PCI: add PCI Express ASPM support") added the ability for Linux to enable ASPM, but for some undocumented reason, it didn't enable ASPM on links where the downstream component is a PCIe-to-PCI/PCI-X Bridge.
Remove this exclusion so we can enable ASPM on these links.
The Dell OptiPlex 7080 mentioned in the bugzilla has a TI XIO2001 PCIe-to-PCI Bridge. Enabling ASPM on the link leading to it allows the Intel SoC to enter deeper Package C-states, which is a significant power savings.
[bhelgaas: commit log]
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207571
--- drivers/pci/pcie/aspm.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/pci/pcie/aspm.c +0 -10
@@ -410,16 +410,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)/* Setup initial capable state. Will be updated later */ link->aspm_capable = link->aspm_support; -/* -* If the downstream component has pci bridge function, don't -* do ASPM for now. -*/ -list_for_each_entry (child, &linkbus->devices, bus_list) { -if (pci_pcie_type (child) ==PCI_EXP_TYPE_PCI_BRIDGE ) { - link->aspm_disable =ASPM_STATE_ALL ; -break ; - } - }/* Get and check endpoint acceptable latencies */ list_for_each_entry (child, &linkbus->devices, bus_list) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 35/191 power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 934ed3847a4ebc75b655659c4d2349ba4337941c ]
In the probe function, in case of error, resources allocated in 'lp8788_setup_adc_channel()' must be released.
This can be achieved easily by using the devm_ variant of 'iio_channel_get()'.
This has the extra benefit to simplify the remove function and to axe the 'lp8788_release_adc_channel()' function which is now useless.
--- drivers/power/supply/lp8788-charger.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/power/supply/lp8788-charger.c +2 -16
@@ -603,27 +603,14 @@ static void lp8788_setup_adc_channel(struct device *dev,return ;/* ADC channel for battery voltage */ - chan =iio_channel_get (dev, pdata->adc_vbatt); + chan =devm_iio_channel_get (dev, pdata->adc_vbatt); pchg->chan[LP8788_VBATT ] =IS_ERR (chan) ?NULL : chan;/* ADC channel for battery temperature */ - chan =iio_channel_get (dev, pdata->adc_batt_temp); + chan =devm_iio_channel_get (dev, pdata->adc_batt_temp); pchg->chan[LP8788_BATT_TEMP ] =IS_ERR (chan) ?NULL : chan; } -static void lp8788_release_adc_channel (struct lp8788_charger *pchg) -{ -int i; - -for (i =0 ; i <LP8788_NUM_CHG_ADC ; i++) { -if (!pchg->chan[i]) -continue ; - -iio_channel_release (pchg->chan[i]); - pchg->chan[i] =NULL ; - } -} -static ssize_t lp8788_show_charger_status (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -744,7 +731,6 @@ static int lp8788_charger_remove(struct platform_device *pdev)lp8788_irq_unregister (pdev, pchg);sysfs_remove_group (&pdev->dev.kobj, &lp8788_attr_group);lp8788_psy_unregister (pchg); -lp8788_release_adc_channel (pchg);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 36/191 power: supply: smb347-charger: IRQSTAT_D is volatile
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit c32ea07a30630ace950e07ffe7a18bdcc25898e1 ]
Fix failure when USB cable is connected:
smb347 2-006a: reading IRQSTAT_D failed
--- drivers/power/supply/smb347-charger.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/smb347-charger.c +1 -0
@@ -1141,6 +1141,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg)switch (reg) {case IRQSTAT_A :case IRQSTAT_C : +case IRQSTAT_D :case IRQSTAT_E :case IRQSTAT_F :case STAT_A :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 37/191 scsi: mpt3sas: Fix double free warnings
In reply to Sasha LevinFrom: Suganath Prabu S <[email protected]>
[ Upstream commit cbbfdb2a2416c9f0cde913cf09670097ac281282 ]
Fix following warning from Smatch static analyser:
drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->hpr_lookup' double freed
drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->internal_lookup' double freed
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_base.c +2 -0
@@ -3166,7 +3166,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ioc->scsi_lookup =NULL ; }kfree (ioc->hpr_lookup); + ioc->hpr_lookup =NULL ;kfree (ioc->internal_lookup); + ioc->internal_lookup =NULL ;if (ioc->chain_lookup) {for (i =0 ; i < ioc->chain_depth; i++) {if (ioc->chain_lookup[i].chain_buffer)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 38/191 dlm: remove BUG() before panic()
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit fe204591cc9480347af7d2d6029b24a62e449486 ]
Building a kernel with clang sometimes fails with an objtool error in dlm:
fs/dlm/lock.o: warning: objtool: revert_lock_pc()+0xbd: can't find jump dest instruction at .text+0xd7fc
The problem is that BUG() never returns and the compiler knows that anything after it is unreachable, however the panic still emits some code that does not get fully eliminated.
Having both BUG() and panic() is really pointless as the BUG() kills the current process and the subsequent panic() never hits. In most cases, we probably don't really want either and should replace the DLM_ASSERT() statements with WARN_ON(), as has been done for some of them.
Remove the BUG() here so the user at least sees the panic message and we can reliably build randconfig kernels.
--- fs/dlm/dlm_internal.h | 1 - 1 file changed, 1 deletion(-)
fs/dlm/dlm_internal.h +0 -1
@@ -100,7 +100,6 @@ do { \ __LINE__, __FILE__, #x, jiffies); \ {do} \ printk("\n"); \ - BUG(); \ panic("DLM: Record message above and reboot.\n"); \ } \ }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 39/191 clk: ti: composite: fix memory leak
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
[ Upstream commit c7c1cbbc9217ebb5601b88d138d4a5358548de9d ]
The parent_names is never released for a component clock definition, causing some memory leak. Fix by releasing it once it is no longer needed.
--- drivers/clk/ti/composite.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/ti/composite.c +1 -0
@@ -226,6 +226,7 @@ static void __init _register_composite(struct clk_hw *hw,if (!cclk->comp_clks[i])continue ;list_del (&cclk->comp_clks[i]->link); +kfree (cclk->comp_clks[i]->parent_names);kfree (cclk->comp_clks[i]); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 40/191 tty: n_gsm: Fix SOF skipping
In reply to Sasha LevinFrom: Gregory CLEMENT <[email protected]>
[ Upstream commit 84d6f81c1fb58b56eba81ff0a36cf31946064b40 ]
For at least some modems like the TELIT LE910, skipping SOF makes transfers blocking indefinitely after a short amount of data transferred.
Given the small improvement provided by skipping the SOF (just one byte on about 100 bytes), it seems better to completely remove this "feature" than make it optional.
--- drivers/tty/n_gsm.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/tty/n_gsm.c +1 -7
@@ -685,7 +685,6 @@ static void gsm_data_kick(struct gsm_mux *gsm) {struct gsm_msg *msg, *nmsg;int len; -int skip_sof =0 ;list_for_each_entry_safe (msg, nmsg, &gsm->tx_list, list) {if (gsm->constipated && msg->addr)
@@ -707,15 +706,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)print_hex_dump_bytes ("gsm_data_kick: " ,DUMP_PREFIX_OFFSET , gsm->txframe, len); - -if (gsm->output (gsm, gsm->txframe + skip_sof, - len - skip_sof) <0 ) +if (gsm->output (gsm, gsm->txframe, len) <0 )break ;/* FIXME: Can eliminate one SOF in many more cases */ gsm->tx_bytes -= msg->len; -/* For a burst of frames skip the extra SOF within the -burst */ - skip_sof =1 ;list_del (&msg->list);kfree (msg);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 41/191 tty: n_gsm: Fix waking up upper tty layer when room available
In reply to Sasha LevinFrom: Gregory CLEMENT <[email protected]>
[ Upstream commit 01dbb362f0a114fbce19c8abe4cd6f4710e934d5 ]
Warn the upper layer when n_gms is ready to receive data again. Without this the associated virtual tty remains blocked indefinitely.
--- drivers/tty/n_gsm.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/tty/n_gsm.c +22 -4
@@ -681,7 +681,7 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,* FIXME: lock against link layer control transmissions */ -static void gsm_data_kick (struct gsm_mux *gsm) +static void gsm_data_kick (struct gsm_mux *gsm,struct gsm_dlci *dlci) {struct gsm_msg *msg, *nmsg;int len;
@@ -713,6 +713,24 @@ static void gsm_data_kick(struct gsm_mux *gsm)list_del (&msg->list);kfree (msg); + +if (dlci) { +tty_port_tty_wakeup (&dlci->port); + }else { +int i =0 ; + +for (i =0 ; i <NUM_DLCI ; i++) { +struct gsm_dlci *dlci; + + dlci = gsm->dlci[i]; +if (dlci ==NULL ) { + i++; +continue ; + } + +tty_port_tty_wakeup (&dlci->port); + } + } } }
@@ -764,7 +782,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)/* Add to the actual output queue */ list_add_tail (&msg->list, &gsm->tx_list); gsm->tx_bytes += msg->len; -gsm_data_kick (gsm); +gsm_data_kick (gsm, dlci); }/**
@@ -1225,7 +1243,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,gsm_control_reply (gsm,CMD_FCON ,NULL ,0 );/* Kick the link in case it is idling */ spin_lock_irqsave (&gsm->tx_lock, flags); -gsm_data_kick (gsm); +gsm_data_kick (gsm,NULL );spin_unlock_irqrestore (&gsm->tx_lock, flags);break ;case CMD_FCOFF :
@@ -2408,7 +2426,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty)/* Queue poll */ clear_bit (TTY_DO_WRITE_WAKEUP , &tty->flags);spin_lock_irqsave (&gsm->tx_lock, flags); -gsm_data_kick (gsm); +gsm_data_kick (gsm,NULL );if (gsm->tx_bytes <TX_THRESH_LO ) {gsm_dlci_data_sweep (gsm); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 42/191 powerpc/pseries/ras: Fix FWNMI_VALID off by one
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit deb70f7a35a22dffa55b2c3aac71bc6fb0f486ce ]
This was discovered developing qemu fwnmi sreset support. This off-by-one bug means the last 16 bytes of the rtas area can not be used for a 16 byte save area.
It's not a serious bug, and QEMU implementation has to retain a workaround for old kernels, but it's good to tighten it.
--- arch/powerpc/platforms/pseries/ras.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/ras.c +3 -2
@@ -311,10 +311,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)/* * Some versions of FWNMI place the buffer inside the 4kB page starting at * 0x7000. Other versions place it inside the rtas buffer. We check both. +* Minimum size of the buffer is 16 bytes. */ #define VALID_FWNMI_BUFFER (A ) \ - ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ - (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) + ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ + (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16))))/* * Get the error information for errors coming through the
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 43/191 powerpc/ps3: Fix kexec shutdown hang
In reply to Sasha LevinFrom: Geoff Levand <[email protected]>
[ Upstream commit 126554465d93b10662742128918a5fc338cda4aa ]
The ps3_mm_region_destroy() and ps3_mm_vas_destroy() routines are called very late in the shutdown via kexec's mmu_cleanup_all routine. By the time mmu_cleanup_all runs it is too late to use udbg_printf, and calling it will cause PS3 systems to hang.
Remove all debugging statements from ps3_mm_region_destroy() and ps3_mm_vas_destroy() and replace any error reporting with calls to lv1_panic.
With this change builds with 'DEBUG' defined will not cause kexec reboots to hang, and builds with 'DEBUG' defined or not will end in lv1_panic if an error is encountered.
--- arch/powerpc/platforms/ps3/mm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
arch/powerpc/platforms/ps3/mm.c +12 -10
@@ -212,13 +212,14 @@ void ps3_mm_vas_destroy(void) {int result; -DBG ("%s:%d: map.vas_id = %llu\n" , __func__, __LINE__, map.vas_id); -if (map.vas_id) { result =lv1_select_virtual_address_space (0 ); -BUG_ON (result); - result =lv1_destruct_virtual_address_space (map.vas_id); -BUG_ON (result); + result +=lv1_destruct_virtual_address_space (map.vas_id); + +if (result) { +lv1_panic (0 ); + } + map.vas_id =0 ; } }
@@ -316,19 +317,20 @@ static void ps3_mm_region_destroy(struct mem_region *r)int result;if (!r->destroy) { -pr_info ("%s:%d: Not destroying high region: %llxh %llxh\n" , - __func__, __LINE__, r->base, r->size);return ; } -DBG ("%s:%d: r->base = %llxh\n" , __func__, __LINE__, r->base); -if (r->base) { result =lv1_release_memory (r->base); -BUG_ON (result); + +if (result) { +lv1_panic (0 ); + } + r->size = r->base = r->offset =0 ; map.total = map.rm.size; } +ps3_mm_set_repository_highmem (NULL ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 44/191 vfio-pci: Mask cap zero
In reply to Sasha LevinFrom: Alex Williamson <[email protected]>
[ Upstream commit bc138db1b96264b9c1779cf18d5a3b186aa90066 ]
The PCI Code and ID Assignment Specification changed capability ID 0 from reserved to a NULL capability in the v1.1 revision. The NULL capability is defined to include only the 16-bit capability header, ie. only the ID and next pointer. Unfortunately vfio-pci creates a map of config space, where ID 0 is used to reserve the standard type 0 header. Finding an actual capability with this ID therefore results in a bogus range marked in that map and conflicts with subsequent capabilities. As this seems to be a dummy capability anyway and we already support dropping capabilities, let's hide this one rather than delving into the potentially subtle dependencies within our map.
Seen on an NVIDIA Tesla T4.
--- drivers/vfio/pci/vfio_pci_config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_config.c +6 -1
@@ -1461,7 +1461,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)if (ret)return ret; -if (cap <=PCI_CAP_ID_MAX ) { +/* +* ID 0 is a NULL capability, conflicting with our fake +* PCI_CAP_ID_BASIC. As it has no content, consider it +* hidden for now. +*/ +if (cap && cap <=PCI_CAP_ID_MAX ) { len = pci_cap_length[cap];if (len ==0xFF ) {/* Variable length */ len =vfio_cap_len (vdev, cap, pos);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 45/191 usb/ohci-platform: Fix a warning when hibernating
In reply to Sasha LevinFrom: Qais Yousef <[email protected]>
[ Upstream commit 1cb3b0095c3d0bb96912bfbbce4fc006d41f367c ]
The following warning was observed when attempting to suspend to disk using a USB flash as a swap device.
[ 111.779649] ------------[ cut here ]------------ [ 111.788382] URB (____ptrval____) submitted while active [ 111.796646] WARNING: CPU: 3 PID: 365 at drivers/usb/core/urb.c:363 usb_submit_urb+0x3d8/0x590 [ 111.805417] Modules linked in: [ 111.808584] CPU: 3 PID: 365 Comm: kworker/3:2 Not tainted 5.6.0-rc6-00002-gdfd1731f9a3e-dirty #545 [ 111.817796] Hardware name: ARM Juno development board (r2) (DT) [ 111.823896] Workqueue: usb_hub_wq hub_event [ 111.828217] pstate: 60000005 (nZCv daif -PAN -UAO) [ 111.833156] pc : usb_submit_urb+0x3d8/0x590 [ 111.837471] lr : usb_submit_urb+0x3d8/0x590 [ 111.841783] sp : ffff800018de38b0 [ 111.845205] x29: ffff800018de38b0 x28: 0000000000000003 [ 111.850682] x27: ffff000970530b20 x26: ffff8000133fd000 [ 111.856159] x25: ffff8000133fd000 x24: ffff800018de3b38 [ 111.861635] x23: 0000000000000004 x22: 0000000000000c00 [ 111.867112] x21: 0000000000000000 x20: 00000000fffffff0 [ 111.872589] x19: ffff0009704e7a00 x18: ffffffffffffffff [ 111.878065] x17: 00000000a7c8f4bc x16: 000000002af33de8 [ 111.883542] x15: ffff8000133fda88 x14: 0720072007200720 [ 111.889019] x13: 0720072007200720 x12: 0720072007200720 [ 111.894496] x11: 0000000000000000 x10: 00000000a5286134 [ 111.899973] x9 : 0000000000000002 x8 : ffff000970c837a0 [ 111.905449] x7 : 0000000000000000 x6 : ffff800018de3570 [ 111.910926] x5 : 0000000000000001 x4 : 0000000000000003 [ 111.916401] x3 : 0000000000000000 x2 : ffff800013427118 [ 111.921879] x1 : 9d4e965b4b7d7c00 x0 : 0000000000000000 [ 111.927356] Call trace: [ 111.929892] usb_submit_urb+0x3d8/0x590 [ 111.933852] hub_activate+0x108/0x7f0 [ 111.937633] hub_resume+0xac/0x148 [ 111.941149] usb_resume_interface.isra.10+0x60/0x138 [ 111.946265] usb_resume_both+0xe4/0x140 [ 111.950225] usb_runtime_resume+0x24/0x30 [ 111.954365] __rpm_callback+0xdc/0x138 [ 111.958236] rpm_callback+0x34/0x98 [ 111.961841] rpm_resume+0x4a8/0x720 [ 111.965445] rpm_resume+0x50c/0x720 [ 111.969049] __pm_runtime_resume+0x4c/0xb8 [ 111.973276] usb_autopm_get_interface+0x28/0x60 [ 111.977948] hub_event+0x80/0x16d8 [ 111.981466] process_one_work+0x2a4/0x748 [ 111.985604] worker_thread+0x48/0x498 [ 111.989387] kthread+0x13c/0x140 [ 111.992725] ret_from_fork+0x10/0x18 [ 111.996415] irq event stamp: 354 [ 111.999756] hardirqs last enabled at (353): [<ffff80001019ea1c>] console_unlock+0x504/0x5b8 [ 112.008441] hardirqs last disabled at (354): [<ffff8000100a95d0>] do_debug_exception+0x1a8/0x258 [ 112.017479] softirqs last enabled at (350): [<ffff8000100818a4>] __do_softirq+0x4bc/0x568 [ 112.025984] softirqs last disabled at (343): [<ffff8000101145a4>] irq_exit+0x144/0x150 [ 112.034129] ---[ end trace dc96030b9cf6c8a3 ]---
The problem was tracked down to a missing call to pm_runtime_set_active() on resume in ohci-platform.
--- drivers/usb/host/ohci-platform.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/ohci-platform.c +5 -0
@@ -340,6 +340,11 @@ static int ohci_platform_resume(struct device *dev) }ohci_resume (hcd, false); + +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); +return 0 ; }#endif /* CONFIG_PM_SLEEP */
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 46/191 drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
In reply to Sasha LevinFrom: Roy Spliet <[email protected]>
[ Upstream commit e4337877c5d578722c0716f131fb774522013cf5 ]
When allocation for mdp5_kms fails, calling mdp5_destroy() leads to undefined behaviour, likely a nullptr exception or use-after-free troubles.
--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +2 -1
@@ -769,7 +769,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)return 0 ; fail: -mdp5_destroy (pdev); +if (mdp5_kms) +mdp5_destroy (pdev);return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 47/191 USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
In reply to Sasha LevinFrom: Tang Bin <[email protected]>
[ Upstream commit d49292025f79693d3348f8e2029a8b4703be0f0a ]
The function ehci_mxc_drv_probe() does not perform sufficient error checking after executing platform_get_irq(), thus fix it.
--- drivers/usb/host/ehci-mxc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/ehci-mxc.c +2 -0
@@ -63,6 +63,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; hcd =usb_create_hcd (&ehci_mxc_hc_driver, dev,dev_name (dev));if (!hcd)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 48/191 tty: n_gsm: Fix bogus i++ in gsm_data_kick
In reply to Sasha LevinFrom: Gregory CLEMENT <[email protected]>
[ Upstream commit 4dd31f1ffec6c370c3c2e0c605628bf5e16d5c46 ]
When submitting the previous fix "tty: n_gsm: Fix waking up upper tty layer when room available". It was suggested to switch from a while to a for loop, but when doing it, there was a remaining bogus i++.
This patch removes this i++ and also reorganizes the code making it more compact.
--- drivers/tty/n_gsm.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/tty/n_gsm.c +3 -11
@@ -719,17 +719,9 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) }else {int i =0 ; -for (i =0 ; i <NUM_DLCI ; i++) { -struct gsm_dlci *dlci; - - dlci = gsm->dlci[i]; -if (dlci ==NULL ) { - i++; -continue ; - } - -tty_port_tty_wakeup (&dlci->port); - } +for (i =0 ; i <NUM_DLCI ; i++) +if (gsm->dlci[i]) +tty_port_tty_wakeup (&gsm->dlci[i]->port); } } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 49/191 clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1
In reply to Sasha LevinFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 25bdae0f1c6609ceaf55fe6700654f0be2253d8e ]
Mark the SCLK clock for Exynos5433 I2S1 device with IGNORE_UNUSED flag to match its behaviour with SCLK clock for AUD_I2S (I2S0) device until a proper fix for Exynos I2S driver is ready.
This fixes the following synchronous abort issue revealed by the probe order change caused by the commit 93d2e4322aa7 ("of: platform: Batch fwnode parsing when adding all top level devices")
Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 50 Comm: kworker/0:1 Not tainted 5.7.0-rc5+ #701 Hardware name: Samsung TM2E board (DT) Workqueue: events deferred_probe_work_func pstate: 60000005 (nZCv daif -PAN -UAO) pc : samsung_i2s_probe+0x768/0x8f0 lr : samsung_i2s_probe+0x688/0x8f0 ... Call trace: samsung_i2s_probe+0x768/0x8f0 platform_drv_probe+0x50/0xa8 really_probe+0x108/0x370 driver_probe_device+0x54/0xb8 __device_attach_driver+0x90/0xc0 bus_for_each_drv+0x70/0xc8 __device_attach+0xdc/0x140 device_initial_probe+0x10/0x18 bus_probe_device+0x94/0xa0 deferred_probe_work_func+0x70/0xa8 process_one_work+0x2a8/0x718 worker_thread+0x48/0x470 kthread+0x134/0x160 ret_from_fork+0x10/0x1c Code: 17ffffaf d503201f f94086c0 91003000 (88dffc00) ---[ end trace ccf721c9400ddbd6 ]---
--- drivers/clk/samsung/clk-exynos5433.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/samsung/clk-exynos5433.c +2 -1
@@ -1672,7 +1672,8 @@ static const struct samsung_gate_clock peric_gate_clks[] __initconst = {GATE (CLK_SCLK_PCM1 ,"sclk_pcm1" ,"sclk_pcm1_peric" ,ENABLE_SCLK_PERIC ,7 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_SCLK_I2S1 ,"sclk_i2s1" ,"sclk_i2s1_peric" , -ENABLE_SCLK_PERIC ,6 ,CLK_SET_RATE_PARENT ,0 ), +ENABLE_SCLK_PERIC ,6 , +CLK_SET_RATE_PARENT |CLK_IGNORE_UNUSED ,0 ),GATE (CLK_SCLK_SPI2 ,"sclk_spi2" ,"sclk_spi2_peric" ,ENABLE_SCLK_PERIC ,5 ,CLK_SET_RATE_PARENT ,0 ), GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 50/191 powerpc/64s/pgtable: fix an undefined behaviour
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit c2e929b18cea6cbf71364f22d742d9aad7f4677a ]
Booting a power9 server with hash MMU could trigger an undefined behaviour because pud_offset(p4d, 0) will do,
0 >> (PAGE_SHIFT:16 + PTE_INDEX_SIZE:8 + H_PMD_INDEX_SIZE:10)
Fix it by converting pud_index() and friends to static inline functions.
UBSAN: shift-out-of-bounds in arch/powerpc/mm/ptdump/ptdump.c:282:15 shift exponent 34 is too large for 32-bit type 'int' CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.6.0-rc4-next-20200303+ #13 Call Trace: dump_stack+0xf4/0x164 (unreliable) ubsan_epilogue+0x18/0x78 __ubsan_handle_shift_out_of_bounds+0x160/0x21c walk_pagetables+0x2cc/0x700 walk_pud at arch/powerpc/mm/ptdump/ptdump.c:282 (inlined by) walk_pagetables at arch/powerpc/mm/ptdump/ptdump.c:311 ptdump_check_wx+0x8c/0xf0 mark_rodata_ro+0x48/0x80 kernel_init+0x74/0x194 ret_from_kernel_thread+0x5c/0x74
--- arch/powerpc/include/asm/book3s/64/pgtable.h | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +19 -4
@@ -754,10 +754,25 @@ extern struct page *pgd_page(pgd_t pgd);#define pud_page_vaddr (pud) __va(pud_val(pud) & ~PUD_MASKED_BITS)#define pgd_page_vaddr (pgd) __va(pgd_val(pgd) & ~PGD_MASKED_BITS) -#define pgd_index (address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) -#define pud_index (address) (((address) >> (PUD_SHIFT)) & (PTRS_PER_PUD - 1)) -#define pmd_index (address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) -#define pte_index (address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) +static inline unsigned long pgd_index (unsigned long address) +{ +return (address >>PGDIR_SHIFT ) & (PTRS_PER_PGD -1 ); +} + +static inline unsigned long pud_index (unsigned long address) +{ +return (address >>PUD_SHIFT ) & (PTRS_PER_PUD -1 ); +} + +static inline unsigned long pmd_index (unsigned long address) +{ +return (address >>PMD_SHIFT ) & (PTRS_PER_PMD -1 ); +} + +static inline unsigned long pte_index (unsigned long address) +{ +return (address >>PAGE_SHIFT ) & (PTRS_PER_PTE -1 ); +}/* * Find an entry in a page-table-directory. We combine the address region
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 51/191 PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port
In reply to Sasha LevinFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 7b38fd9760f51cc83d80eed2cfbde8b5ead9e93a ]
Except for Endpoints, we enable PTM at enumeration-time. Previously we did not account for the fact that Switch Downstream Ports are not permitted to have a PTM capability; their PTM behavior is controlled by the Upstream Port (PCIe r5.0, sec 7.9.16). Since Downstream Ports don't have a PTM capability, we did not mark them as "ptm_enabled", which meant that pci_enable_ptm() on an Endpoint failed because there was no PTM path to it.
Mark Downstream Ports as "ptm_enabled" if their Upstream Port has PTM enabled.
--- drivers/pci/pcie/ptm.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/pci/pcie/ptm.c +17 -5
@@ -47,10 +47,6 @@ void pci_ptm_init(struct pci_dev *dev)if (!pci_is_pcie (dev))return ; - pos =pci_find_ext_capability (dev,PCI_EXT_CAP_ID_PTM ); -if (!pos) -return ; -/* * Enable PTM only on interior devices (root ports, switch ports, * etc.) on the assumption that it causes no link traffic until an
@@ -60,6 +56,23 @@ void pci_ptm_init(struct pci_dev *dev) pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END))return ; +/* +* Switch Downstream Ports are not permitted to have a PTM +* capability; their PTM behavior is controlled by the Upstream +* Port (PCIe r5.0, sec 7.9.16). +*/ + ups =pci_upstream_bridge (dev); +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_DOWNSTREAM && + ups && ups->ptm_enabled) { + dev->ptm_granularity = ups->ptm_granularity; + dev->ptm_enabled =1 ; +return ; + } + + pos =pci_find_ext_capability (dev,PCI_EXT_CAP_ID_PTM ); +if (!pos) +return ; +pci_read_config_dword (dev, pos +PCI_PTM_CAP , &cap); local_clock = (cap &PCI_PTM_GRANULARITY_MASK ) >>8 ;
@@ -69,7 +82,6 @@ void pci_ptm_init(struct pci_dev *dev)* the spec recommendation (PCIe r3.1, sec 7.32.3), select the * furthest upstream Time Source as the PTM Root. */ - ups =pci_upstream_bridge (dev);if (ups && ups->ptm_enabled) { ctrl =PCI_PTM_CTRL_ENABLE ;if (ups->ptm_granularity ==0 )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 52/191 IB/cma: Fix ports memory leak in cma_configfs
In reply to Sasha LevinFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 63a3345c2d42a9b29e1ce2d3a4043689b3995cea ]
The allocated ports structure in never freed. The free function should be called by release_cma_ports_group, but the group is never released since we don't remove its default group.
Remove default groups when device group is deleted.
--- drivers/infiniband/core/cma_configfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/infiniband/core/cma_configfs.c +13 -0
@@ -277,8 +277,21 @@ static struct config_group *make_cma_dev(struct config_group *group,return ERR_PTR (err); } +static void drop_cma_dev (struct config_group *cgroup,struct config_item *item) +{ +struct config_group *group = + container_of(item, struct config_group, cg_item); +struct cma_dev_group *cma_dev_group = + container_of(group, struct cma_dev_group, device_group); + +configfs_remove_default_groups (&cma_dev_group->ports_group); +configfs_remove_default_groups (&cma_dev_group->device_group); +config_item_put (item); +} +static struct configfs_group_operations cma_subsys_group_ops = { .make_group = make_cma_dev, + .drop_item = drop_cma_dev, };static struct config_item_type cma_subsys_type = {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 53/191 watchdog: da9062: No need to ping manually before setting timeout
In reply to Sasha LevinFrom: Stefan Riedmueller <[email protected]>
[ Upstream commit a0948ddba65f4f6d3cfb5e2b84685485d0452966 ]
There is actually no need to ping the watchdog before disabling it during timeout change. Disabling the watchdog already takes care of resetting the counter.
This fixes an issue during boot when the userspace watchdog handler takes over and the watchdog is already running. Opening the watchdog in this case leads to the first ping and directly after that without the required heartbeat delay a second ping issued by the set_timeout call. Due to the missing delay this resulted in a reset.
--- drivers/watchdog/da9062_wdt.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -5
@@ -94,11 +94,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, unsigned int regval) {struct da9062 *chip = wdt->hw; -int ret; - - ret =da9062_reset_watchdog_timer (wdt); -if (ret) -return ret; return regmap_update_bits(chip->regmap, DA9062AA_CONTROL_D,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 54/191 usb: dwc2: gadget: move gadget resume after the core is in L0 state
In reply to Sasha LevinFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 8c935deacebb8fac8f41378701eb79d12f3c2e2d ]
When the remote wakeup interrupt is triggered, lx_state is resumed from L2 to L0 state. But when the gadget resume is called, lx_state is still L2. This prevents the resume callback to queue any request. Any attempt to queue a request from resume callback will result in:
- "submit request only in active state" debug message to be issued
- dwc2_hsotg_ep_queue() returns -EAGAIN
Call the gadget resume routine after the core is in L0 state.
--- drivers/usb/dwc2/core_intr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/dwc2/core_intr.c +5 -2
@@ -365,10 +365,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)if (ret && (ret != -ENOTSUPP ))dev_err (hsotg->dev,"exit hibernation failed\n" ); +/* Change to L0 state */ + hsotg->lx_state =DWC2_L0 ;call_gadget (hsotg, resume); + }else { +/* Change to L0 state */ + hsotg->lx_state =DWC2_L0 ; } -/* Change to L0 state */ - hsotg->lx_state =DWC2_L0 ; }else {if (hsotg->core_params->hibernation)return ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 55/191 USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 7a0fbcf7c308920bc6116b3a5fb21c8cc5fec128 ]
Clang warns:
drivers/usb/gadget/udc/s3c2410_udc.c:255:11: warning: comparison of address of 'ep->queue' equal to a null pointer is always false [-Wtautological-pointer-compare]
if (&ep->queue == NULL)
~~~~^~~~~ ~~~~1 warning generated.
It is not wrong, queue is not a pointer so if ep is not NULL, the address of queue cannot be NULL. No other driver does a check like this and this check has been around since the driver was first introduced, presumably with no issues so it does not seem like this check should be something else. Just remove it.
Commit afe956c577b2d ("kbuild: Enable -Wtautological-compare") exposed this but it is not the root cause of the warning.
--- drivers/usb/gadget/udc/s3c2410_udc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/gadget/udc/s3c2410_udc.c +0 -4
@@ -269,10 +269,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep,static void s3c2410_udc_nuke (struct s3c2410_udc *udc,struct s3c2410_ep *ep,int status) { -/* Sanity check */ -if (&ep->queue ==NULL ) -return ; -while (!list_empty (&ep->queue)) {struct s3c2410_request *req; req = list_entry(ep->queue.next, struct s3c2410_request,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 56/191 usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit eafa80041645cd7604c4357b1a0cd4a3c81f2227 ]
Currently pointer ep is being dereferenced before it is null checked leading to a null pointer dereference issue. Fix this by only assigning pointer udc once ep is known to be not null. Also remove a debug message that requires a valid udc which may not be possible at that point.
Addresses-Coverity: ("Dereference before null check")
--- drivers/usb/gadget/udc/lpc32xx_udc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/lpc32xx_udc.c +6 -5
@@ -1615,17 +1615,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) { struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); -struct lpc32xx_udc *udc = ep->udc; +struct lpc32xx_udc *udc;u16 maxpacket;u32 tmp;unsigned long flags;/* Verify EP data */ if ((!_ep) || (!ep) || (!desc) || - (desc->bDescriptorType !=USB_DT_ENDPOINT )) { -dev_dbg (udc->dev,"bad ep or descriptor\n" ); + (desc->bDescriptorType !=USB_DT_ENDPOINT ))return -EINVAL ; - } + + udc = ep->udc; maxpacket =usb_endpoint_maxp (desc);if ((maxpacket ==0 ) || (maxpacket > ep->maxpacket)) {dev_dbg (udc->dev,"bad ep descriptor's packet size\n" );
@@ -1873,7 +1873,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)static int lpc32xx_ep_set_halt (struct usb_ep *_ep,int value) { struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep); -struct lpc32xx_udc *udc = ep->udc; +struct lpc32xx_udc *udc;unsigned long flags;if ((!ep) || (ep->hwep_num <=1 ))
@@ -1883,6 +1883,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value)if (ep->is_in)return -EAGAIN ; + udc = ep->udc;spin_lock_irqsave (&udc->lock, flags);if (value ==1 ) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 57/191 usb: gadget: fix potential double-free in m66592_probe.
In reply to Sasha LevinFrom: Qiushi Wu <[email protected]>
[ Upstream commit 44734a594196bf1d474212f38fe3a0d37a73278b ]
m66592_free_request() is called under label "err_add_udc" and "clean_up", and m66592->ep0_req is not set to NULL after first free, leading to a double-free. Fix this issue by setting m66592->ep0_req to NULL after the first free.
--- drivers/usb/gadget/udc/m66592-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/m66592-udc.c +1 -1
@@ -1672,7 +1672,7 @@ static int m66592_probe(struct platform_device *pdev) err_add_udc:m66592_free_request (&m66592->ep[0 ].ep, m66592->ep0_req); - + m66592->ep0_req =NULL ; clean_up3:if (m66592->pdata->on_chip) {clk_disable (m66592->clk);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 58/191 usb: gadget: Fix issue with config_ep_by_speed function
In reply to Sasha LevinFrom: Pawel Laszczak <[email protected]>
[ Upstream commit 5d363120aa548ba52d58907a295eee25f8207ed2 ]
This patch adds new config_ep_by_speed_and_alt function which extends the config_ep_by_speed about alt parameter.
This additional parameter allows to find proper usb_ss_ep_comp_descriptor.
Problem has appeared during testing f_tcm (BOT/UAS) driver function.
f_tcm function for SS use array of headers for both BOT/UAS alternate setting:
static struct usb_descriptor_header *uasp_ss_function_desc[] = {
(struct usb_descriptor_header *) &bot_intf_desc, (struct usb_descriptor_header *) &uasp_ss_bi_desc, (struct usb_descriptor_header *) &bot_bi_ep_comp_desc, (struct usb_descriptor_header *) &uasp_ss_bo_desc, (struct usb_descriptor_header *) &bot_bo_ep_comp_desc,
(struct usb_descriptor_header *) &uasp_intf_desc, (struct usb_descriptor_header *) &uasp_ss_bi_desc, (struct usb_descriptor_header *) &uasp_bi_ep_comp_desc, (struct usb_descriptor_header *) &uasp_bi_pipe_desc, (struct usb_descriptor_header *) &uasp_ss_bo_desc, (struct usb_descriptor_header *) &uasp_bo_ep_comp_desc, (struct usb_descriptor_header *) &uasp_bo_pipe_desc, (struct usb_descriptor_header *) &uasp_ss_status_desc, (struct usb_descriptor_header *) &uasp_status_in_ep_comp_desc, (struct usb_descriptor_header *) &uasp_status_pipe_desc, (struct usb_descriptor_header *) &uasp_ss_cmd_desc, (struct usb_descriptor_header *) &uasp_cmd_comp_desc, (struct usb_descriptor_header *) &uasp_cmd_pipe_desc, NULL,
};
The first 5 descriptors are associated with BOT alternate setting, and others are associated with UAS.
During handling UAS alternate setting f_tcm driver invokes config_ep_by_speed and this function sets incorrect companion endpoint descriptor in usb_ep object.
Instead setting ep->comp_desc to uasp_bi_ep_comp_desc function in this case set ep->comp_desc to uasp_ss_bi_desc.
This is due to the fact that it searches endpoint based on endpoint address:
for_each_ep_desc(speed_desc, d_spd) {
chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
if (chosen_desc->bEndpoitAddress == _ep->address)
goto ep_found;
}And in result it uses the descriptor from BOT alternate setting instead UAS.
Finally, it causes that controller driver during enabling endpoints detect that just enabled endpoint for bot.
--- drivers/usb/gadget/composite.c | 78 ++++++++++++++++++++++++++-------- include/linux/usb/composite.h | 3 ++ 2 files changed, 64 insertions(+), 17 deletions(-)
drivers/usb/gadget/composite.c +61 -17
@@ -100,40 +100,43 @@ function_descriptors(struct usb_function *f, }/** -* next_ep_desc() - advance to the next EP descriptor +* next_desc() - advance to the next desc_type descriptor * @t: currect pointer within descriptor array +* @desc_type: descriptor type * -* Return: next EP descriptor or NULL +* Return: next desc_type descriptor or NULL * -* Iterate over @t until either EP descriptor found or +* Iterate over @t until either desc_type descriptor found or * NULL (that indicates end of list) encountered */ static struct usb_descriptor_header ** -next_ep_desc (struct usb_descriptor_header **t) +next_desc (struct usb_descriptor_header **t,u8 desc_type) {for (; *t; t++) { -if ((*t)->bDescriptorType ==USB_DT_ENDPOINT ) +if ((*t)->bDescriptorType == desc_type)return t; }return NULL ; }/* -* for_each_ep_desc()- iterate over endpoint descriptors in the -* descriptors list -* @start: pointer within descriptor array. -* @ep_desc: endpoint descriptor to use as the loop cursor +* for_each_desc() - iterate over desc_type descriptors in the +* descriptors list +* @start: pointer within descriptor array. +* @iter_desc: desc_type descriptor to use as the loop cursor +* @desc_type: wanted descriptr type */ -#define for_each_ep_desc (start, ep_desc) \ - for (ep_desc = next_ep_desc(start); \ - ep_desc; ep_desc = next_ep_desc(ep_desc+1)) +#define for_each_desc (start, iter_desc, desc_type) \ + for (iter_desc = next_desc(start, desc_type); \ + iter_desc; iter_desc = next_desc(iter_desc + 1, desc_type))/** -* config_ep_by_speed() - configures the given endpoint +* config_ep_by_speed_and_alt() - configures the given endpoint * according to gadget speed. * @g: pointer to the gadget * @f: usb function * @_ep: the endpoint to configure +* @alt: alternate setting number * * Return: error code, 0 on success *
@@ -146,11 +149,13 @@ next_ep_desc(struct usb_descriptor_header **t)* Note: the supplied function should hold all the descriptors * for supported speeds */ -int config_ep_by_speed (struct usb_gadget *g, -struct usb_function *f, -struct usb_ep *_ep) +int config_ep_by_speed_and_alt (struct usb_gadget *g, +struct usb_function *f, +struct usb_ep *_ep, +u8 alt) {struct usb_endpoint_descriptor *chosen_desc =NULL ; +struct usb_interface_descriptor *int_desc =NULL ;struct usb_descriptor_header **speed_desc =NULL ;struct usb_ss_ep_comp_descriptor *comp_desc =NULL ;
@@ -186,8 +191,21 @@ int config_ep_by_speed(struct usb_gadget *g,default : speed_desc = f->fs_descriptors; } + +/* find correct alternate setting descriptor */ +for_each_desc (speed_desc, d_spd,USB_DT_INTERFACE ) { + int_desc = (struct usb_interface_descriptor *)*d_spd; + +if (int_desc->bAlternateSetting == alt) { + speed_desc = d_spd; + goto intf_found; + } + } +return -EIO ; + +intf_found:/* find descriptors */ -for_each_ep_desc (speed_desc, d_spd) { +for_each_desc (speed_desc, d_spd,USB_DT_ENDPOINT ) { chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;if (chosen_desc->bEndpointAddress == _ep->address) goto ep_found;
@@ -240,6 +258,32 @@ int config_ep_by_speed(struct usb_gadget *g, }return 0 ; } +EXPORT_SYMBOL_GPL (config_ep_by_speed_and_alt); + +/** +* config_ep_by_speed() - configures the given endpoint +* according to gadget speed. +* @g: pointer to the gadget +* @f: usb function +* @_ep: the endpoint to configure +* +* Return: error code, 0 on success +* +* This function chooses the right descriptors for a given +* endpoint according to gadget speed and saves it in the +* endpoint desc field. If the endpoint already has a descriptor +* assigned to it - overwrites it with currently corresponding +* descriptor. The endpoint maxpacket field is updated according +* to the chosen descriptor. +* Note: the supplied function should hold all the descriptors +* for supported speeds +*/ +int config_ep_by_speed (struct usb_gadget *g, +struct usb_function *f, +struct usb_ep *_ep) +{ +return config_ep_by_speed_and_alt (g, f, _ep,0 ); +}EXPORT_SYMBOL_GPL (config_ep_by_speed);/**
include/linux/usb/composite.h +3 -0
@@ -248,6 +248,9 @@ int usb_function_activate(struct usb_function *);int usb_interface_id (struct usb_configuration *,struct usb_function *); +int config_ep_by_speed_and_alt (struct usb_gadget *g,struct usb_function *f, +struct usb_ep *_ep,u8 alt); +int config_ep_by_speed (struct usb_gadget *g,struct usb_function *f,struct usb_ep *_ep);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 59/191 clk: bcm2835: Fix return type of bcm2835_register_gate
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit f376c43bec4f8ee8d1ba5c5c4cfbd6e84fb279cb ]
bcm2835_register_gate is used as a callback for the clk_register member of bcm2835_clk_desc, which expects a struct clk_hw * return type but bcm2835_register_gate returns a struct clk *.
This discrepancy is hidden by the fact that bcm2835_register_gate is cast to the typedef bcm2835_clk_register by the _REGISTER macro. This turns out to be a control flow integrity violation, which is how this was noticed.
Change the return type of bcm2835_register_gate to be struct clk_hw * and use clk_hw_register_gate to do so. This should be a non-functional change as clk_register_gate calls clk_hw_register_gate anyways but this is needed to avoid issues with further changes.
--- drivers/clk/bcm/clk-bcm2835.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +5 -5
@@ -1295,13 +1295,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,return &clock->hw; } -static struct clk *bcm2835_register_gate (struct bcm2835_cprman *cprman, +static struct clk_hw *bcm2835_register_gate (struct bcm2835_cprman *cprman,const struct bcm2835_gate_data *data) { -return clk_register_gate (cprman->dev, data->name, data->parent, -CLK_IGNORE_UNUSED |CLK_SET_RATE_GATE , - cprman->regs + data->ctl_reg, -CM_GATE_BIT ,0 , &cprman->regs_lock); +return clk_hw_register_gate (cprman->dev, data->name, data->parent, +CLK_IGNORE_UNUSED |CLK_SET_RATE_GATE , + cprman->regs + data->ctl_reg, +CM_GATE_BIT ,0 , &cprman->regs_lock); } typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 60/191 net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
In reply to Sasha LevinFrom: Fedor Tokarev <[email protected]>
[ Upstream commit 118917d696dc59fd3e1741012c2f9db2294bed6f ]
Fix off-by-one issues in 'rpc_ntop6':
- 'snprintf' returns the number of characters which would have been written if enough space had been available, excluding the terminating null byte. Thus, a return value of 'sizeof(scopebuf)' means that the last character was dropped.
- 'strcat' adds a terminating null byte to the string, thus if len == buflen, the null byte is written past the end of the buffer.
--- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/addr.c +2 -2
@@ -81,11 +81,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, rc =snprintf (scopebuf,sizeof (scopebuf),"%c%u" ,IPV6_SCOPE_DELIMITER , sin6->sin6_scope_id); -if (unlikely ((size_t )rc >sizeof (scopebuf))) +if (unlikely ((size_t )rc >=sizeof (scopebuf)))return 0 ; len += rc; -if (unlikely (len > buflen)) +if (unlikely (len >= buflen))return 0 ;strcat (buf, scopebuf);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 61/191 NFSv4.1 fix rpc_call_done assignment for BIND_CONN_TO_SESSION
In reply to Sasha LevinFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 1c709b766e73e54d64b1dde1b7cfbcf25bcb15b9 ]
--- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4proc.c +1 -1
@@ -7151,7 +7151,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) }static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { - .rpc_call_done = &nfs4_bind_one_conn_to_session_done, + .rpc_call_done = nfs4_bind_one_conn_to_session_done, };/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 62/191 extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bc84cff2c92ae5ccb2c37da73756e7174b1b430f ]
In some error handling paths, a call to 'iio_channel_get()' is not balanced by a corresponding call to 'iio_channel_release()'.
This can be achieved easily by using the devm_ variant of 'iio_channel_get()'.
This has the extra benefit to simplify the remove function.
--- drivers/extcon/extcon-adc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/extcon/extcon-adc-jack.c +1 -2
@@ -128,7 +128,7 @@ static int adc_jack_probe(struct platform_device *pdev)for (i =0 ; data->adc_conditions[i].id !=EXTCON_NONE ; i++); data->num_conditions = i; - data->chan =iio_channel_get (&pdev->dev, pdata->consumer_channel); + data->chan =devm_iio_channel_get (&pdev->dev, pdata->consumer_channel);if (IS_ERR (data->chan))return PTR_ERR (data->chan);
@@ -170,7 +170,6 @@ static int adc_jack_remove(struct platform_device *pdev)free_irq (data->irq, data);cancel_work_sync (&data->handler.work); -iio_channel_release (data->chan);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 63/191 ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 36124fb19f1ae68a500cd76a76d40c6e81bee346 ]
fsl_asrc_dma_hw_params() invokes dma_request_channel() or fsl_asrc_get_dma_channel(), which returns a reference of the specified dma_chan object to "pair->dma_chan[dir]" with increased refcnt.
The reference counting issue happens in one exception handling path of fsl_asrc_dma_hw_params(). When config DMA channel failed for Back-End, the function forgets to decrease the refcnt increased by dma_request_channel() or fsl_asrc_get_dma_channel(), causing a refcnt leak.
Fix this issue by calling dma_release_channel() when config DMA channel failed.
--- sound/soc/fsl/fsl_asrc_dma.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl_asrc_dma.c +1 -0
@@ -243,6 +243,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream, ret =dmaengine_slave_config (pair->dma_chan[dir], &config_be);if (ret) {dev_err (dev,"failed to config DMA channel for Back-End\n" ); +dma_release_channel (pair->dma_chan[dir]);return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 64/191 openrisc: Fix issue with argument clobbering for clone/fork
In reply to Sasha LevinFrom: Stafford Horne <[email protected]>
[ Upstream commit 6bd140e14d9aaa734ec37985b8b20a96c0ece948 ]
Working on the OpenRISC glibc port I found that sometimes clone was working strange. That the tls data argument sent in r7 was always wrong. Further investigation revealed that the arguments were getting clobbered in the entry code. This patch removes the code that writes to the argument registers. This was likely due to some old code hanging around.
This patch fixes this up for clone and fork. This fork clobber is harmless but also useless so remove.
--- arch/openrisc/kernel/entry.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/openrisc/kernel/entry.S +2 -2
@@ -1092,13 +1092,13 @@ ENTRY(__sys_clone) l.movhi r29,hi(sys_clone) l.ori r29,r29,lo(sys_clone) l.j _fork_save_extra_regs_and_call - l.addi r7,r1,0 + l.nop ENTRY(__sys_fork) l.movhi r29,hi(sys_fork) l.ori r29,r29,lo(sys_fork) l.j _fork_save_extra_regs_and_call - l.addi r3,r1,0 + l.nop ENTRY(sys_rt_sigreturn) l.j _sys_rt_sigreturn
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 65/191 gfs2: Allow lock_nolock mount to specify jid=X
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit ea22eee4e6027d8927099de344f7fff43c507ef9 ]
Before this patch, a simple typo accidentally added \n to the jid= string for lock_nolock mounts. This made it impossible to mount a gfs2 file system with a journal other than journal0. Thus:
mount -tgfs2 -o hostdata="jid=1" <device> <mount pt>
Resulted in:
mount: wrong fs type, bad option, bad superblock on <device>
In most cases this is not a problem. However, for debugging and testing purposes we sometimes want to test the integrity of other journals. This patch removes the unnecessary \n and thus allows lock_nolock users to specify an alternate journal.
--- fs/gfs2/ops_fstype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/ops_fstype.c +1 -1
@@ -920,7 +920,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo) }static const match_table_t nolock_tokens = { - { Opt_jid,"jid=%d\n" , }, + { Opt_jid,"jid=%d" , }, { Opt_err,NULL }, };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 66/191 scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
In reply to Sasha LevinFrom: Qiushi Wu <[email protected]>
[ Upstream commit 0267ffce562c8bbf9b57ebe0e38445ad04972890 ]
kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
--- drivers/scsi/iscsi_boot_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/iscsi_boot_sysfs.c +1 -1
@@ -360,7 +360,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset, boot_kobj->kobj.kset = boot_kset->kset;if (kobject_init_and_add (&boot_kobj->kobj, &iscsi_boot_ktype,NULL , name, index)) { -kfree (boot_kobj); +kobject_put (&boot_kobj->kobj);return NULL ; } boot_kobj->data = data;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 67/191 pinctrl: imxl: Fix an error handling path in 'imx1_pinctrl_core_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 9eb728321286c4b31e964d2377fca2368526d408 ]
When 'pinctrl_register()' has been turned into 'devm_pinctrl_register()', an error handling path has not been updated.
Axe a now unneeded 'pinctrl_unregister()'.
--- drivers/pinctrl/freescale/pinctrl-imx1-core.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/freescale/pinctrl-imx1-core.c +0 -1
@@ -642,7 +642,6 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, ret =of_platform_populate (pdev->dev.of_node,NULL ,NULL , &pdev->dev);if (ret) { -pinctrl_unregister (ipctl->pctl);dev_err (&pdev->dev,"Failed to populate subdevices\n" );return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 68/191 crypto: omap-sham - add proper load balancing support for multicore
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
[ Upstream commit 281c377872ff5d15d80df25fc4df02d2676c7cde ]
The current implementation of the multiple accelerator core support for OMAP SHA does not work properly. It always picks up the first probed accelerator core if this is available, and rest of the book keeping also gets confused if there are two cores available. Add proper load balancing support for SHA, and also fix any bugs related to the multicore support while doing it.
--- drivers/crypto/omap-sham.c | 64 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 33 deletions(-)
drivers/crypto/omap-sham.c +31 -33
@@ -167,8 +167,6 @@ struct omap_sham_hmac_ctx { };struct omap_sham_ctx { -struct omap_sham_dev *dd; -unsigned long flags;/* fallback stuff */
@@ -915,27 +913,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd)return 0 ; } +struct omap_sham_dev *omap_sham_find_dev (struct omap_sham_reqctx *ctx) +{ +struct omap_sham_dev *dd; + +if (ctx->dd) +return ctx->dd; + +spin_lock_bh (&sham.lock); + dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); +list_move_tail (&dd->list, &sham.dev_list); + ctx->dd = dd; +spin_unlock_bh (&sham.lock); + +return dd; +} +static int omap_sham_init (struct ahash_request *req) {struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);struct omap_sham_ctx *tctx =crypto_ahash_ctx (tfm);struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_dev *dd =NULL , *tmp; +struct omap_sham_dev *dd;int bs =0 ; -spin_lock_bh (&sham.lock); -if (!tctx->dd) { -list_for_each_entry (tmp, &sham.dev_list, list) { - dd = tmp; -break ; - } - tctx->dd = dd; - }else { - dd = tctx->dd; - } -spin_unlock_bh (&sham.lock); + ctx->dd =NULL ; - ctx->dd = dd; + dd =omap_sham_find_dev (ctx); +if (!dd) +return -ENODEV ; ctx->flags =0 ;
@@ -1185,8 +1191,7 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,static int omap_sham_enqueue (struct ahash_request *req,unsigned int op) {struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_ctx *tctx =crypto_tfm_ctx (req->base.tfm); -struct omap_sham_dev *dd = tctx->dd; +struct omap_sham_dev *dd = ctx->dd; ctx->op = op;
@@ -1196,7 +1201,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op)static int omap_sham_update (struct ahash_request *req) {struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_dev *dd = ctx->dd; +struct omap_sham_dev *dd =omap_sham_find_dev (ctx);if (!req->nbytes)return 0 ;
@@ -1301,21 +1306,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key,struct omap_sham_hmac_ctx *bctx = tctx->base;int bs =crypto_shash_blocksize (bctx->shash);int ds =crypto_shash_digestsize (bctx->shash); -struct omap_sham_dev *dd =NULL , *tmp;int err, i; -spin_lock_bh (&sham.lock); -if (!tctx->dd) { -list_for_each_entry (tmp, &sham.dev_list, list) { - dd = tmp; -break ; - } - tctx->dd = dd; - }else { - dd = tctx->dd; - } -spin_unlock_bh (&sham.lock); - err =crypto_shash_setkey (tctx->fallback, key, keylen);if (err)return err;
@@ -1333,7 +1325,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key,memset (bctx->ipad + keylen,0 , bs - keylen); -if (!test_bit (FLAGS_AUTO_XOR , &dd->flags)) { +if (!test_bit (FLAGS_AUTO_XOR , &sham.flags)) {memcpy (bctx->opad, bctx->ipad, bs);for (i =0 ; i < bs; i++) {
@@ -2072,6 +2064,7 @@ static int omap_sham_probe(struct platform_device *pdev) } dd->flags |= dd->pdata->flags; + sham.flags |= dd->pdata->flags;pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,DEFAULT_AUTOSUSPEND_DELAY );
@@ -2097,6 +2090,9 @@ static int omap_sham_probe(struct platform_device *pdev)spin_unlock (&sham.lock);for (i =0 ; i < dd->pdata->algs_info_size; i++) { +if (dd->pdata->algs_info[i].registered) +break ; +for (j =0 ; j < dd->pdata->algs_info[i].size; j++) {struct ahash_alg *alg;
@@ -2142,9 +2138,11 @@ static int omap_sham_remove(struct platform_device *pdev)list_del (&dd->list);spin_unlock (&sham.lock);for (i = dd->pdata->algs_info_size -1 ; i >=0 ; i--) -for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) +for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) {crypto_unregister_ahash ( &dd->pdata->algs_info[i].algs_list[j]); + dd->pdata->algs_info[i].registered--; + }tasklet_kill (&dd->done_task);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 69/191 lib/zlib: remove outdated and incorrect pre-increment optimization
In reply to Sasha LevinFrom: Jann Horn <[email protected]>
[ Upstream commit acaab7335bd6f0c0b54ce3a00bd7f18222ce0f5f ]
The zlib inflate code has an old micro-optimization based on the assumption that for pre-increment memory accesses, the compiler will generate code that fits better into the processor's pipeline than what would be generated for post-increment memory accesses.
This optimization was already removed in upstream zlib in 2016:
https://github.com/madler/zlib/commit/9aaec95e8211
This optimization causes UB according to C99, which says in section 6.5.6 "Additive operators": "If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined".
This UB is not only a theoretical concern, but can also cause trouble for future work on compiler-based sanitizers.
According to the zlib commit, this optimization also is not optimal anymore with modern compilers.
Replace uses of OFF, PUP and UP_UNALIGNED with their definitions in the POSTINC case, and remove the macro definitions, just like in the upstream patch.
--- lib/zlib_inflate/inffast.c | 91 +++++++++++++++----------------------- 1 file changed, 35 insertions(+), 56 deletions(-)
lib/zlib_inflate/inffast.c +35 -56
@@ -10,17 +10,6 @@ #ifndef ASMINF -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ union uu { unsigned short us; unsigned char b[2];
@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p)return mm.us; } -#ifdef POSTINC -# define OFF 0 -# define PUP (a) *(a)++ -# define UP_UNALIGNED (a) get_unaligned16((a)++) -#else -# define OFF 1 -# define PUP (a) *++(a) -# define UP_UNALIGNED (a) get_unaligned16(++(a)) -#endif -/* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is
@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start)/* copy state to local variables */ state = (struct inflate_state *)strm->state; - in = strm->next_in -OFF ; + in = strm->next_in; last = in + (strm->avail_in -5 ); - out = strm->next_out -OFF ; + out = strm->next_out; beg = out - (start - strm->avail_out); end = out + (strm->avail_out -257 );#ifdef INFLATE_STRICT
@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start)input data or output space */ do { if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } this = lcode[hold & lmask];
@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) bits -= op; op = (unsigned )(this.op);if (op ==0 ) {/* literal */ -PUP (out) = (unsigned char )(this.val); + *out++ = (unsigned char )(this.val); }else if (op &16 ) {/* length base */ len = (unsigned )(this.val); op &=15 ;/* number of extra bits */ if (op) {if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } len += (unsigned )hold & ((1U << op) -1 );
@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) bits -= op; }if (bits <15 ) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } this = dcode[hold & dmask];
@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) dist = (unsigned )(this.val); op &=15 ;/* number of extra bits */ if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ;if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } }
@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) state->mode =BAD ;break ; } - from = window -OFF ; + from = window;if (write ==0 ) {/* very common case */ from += wsize - op;if (op < len) {/* some from window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ }
@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start)if (op < len) {/* some from end of window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); - from = window -OFF ; + from = window;if (write < len) {/* some from start of window */ op = write; len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ }
@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start)if (op < len) {/* some from window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ } }while (len >2 ) { -PUP (out) =PUP (from); -PUP (out) =PUP (from); -PUP (out) =PUP (from); + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; len -=3 ; }if (len) { -PUP (out) =PUP (from); + *out++ = *from++;if (len >1 ) -PUP (out) =PUP (from); + *out++ = *from++; } }else {
@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) from = out - dist;/* copy direct from output */ /* minimum length is three */ /* Align out addr */ -if (!((long )(out -1 +OFF ) &1 )) { -PUP (out) =PUP (from); +if (!((long )(out -1 ) &1 )) { + *out++ = *from++; len--; } - sout = (unsigned short *)(out -OFF ); + sout = (unsigned short *)(out);if (dist >2 ) {unsigned short *sfrom; - sfrom = (unsigned short *)(from -OFF ); + sfrom = (unsigned short *)(from); loops = len >>1 ; do#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS -PUP (sout) =PUP (sfrom); + *sout++ = *sfrom++;#else -PUP (sout) =UP_UNALIGNED (sfrom); + *sout++ =get_unaligned16 (sfrom++);#endif while (--loops); - out = (unsigned char *)sout +OFF ; - from = (unsigned char *)sfrom +OFF ; + out = (unsigned char *)sout; + from = (unsigned char *)sfrom; }else {/* dist == 1 or dist == 2 */ unsigned short pat16; - pat16 = *(sout-1 +OFF ); + pat16 = *(sout-1 );if (dist ==1 ) {union uu mm;/* copy one char pattern to both bytes */
@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) } loops = len >>1 ;do -PUP (sout) = pat16; + *sout++ = pat16;while (--loops); - out = (unsigned char *)sout +OFF ; + out = (unsigned char *)sout; }if (len &1 ) -PUP (out) =PUP (from); + *out++ = *from++; } }else if ((op &64 ) ==0 ) {/* 2nd level distance code */
@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) hold &= (1U << bits) -1 ;/* update state and return */ - strm->next_in = in +OFF ; - strm->next_out = out +OFF ; + strm->next_in = in; + strm->next_out = out; strm->avail_in = (unsigned )(in < last ?5 + (last - in) :5 - (in - last)); strm->avail_out = (unsigned )(out < end ?257 + (end - out) :257 - (out - end));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 70/191 include/linux/bitops.h: avoid clang shift-count-overflow warnings
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bd93f003b7462ae39a43c531abca37fe7073b866 ]
Clang normally does not warn about certain issues in inline functions when it only happens in an eliminated code path. However if something else goes wrong, it does tend to complain about the definition of hweight_long() on 32-bit targets:
include/linux/bitops.h:75:41: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
^~~~~~~~~~~~
include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
^~~~~~~~~~~~~~~~~~~~
include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
^ ~~
include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
^
include/asm-generic/bitops/const_hweight.h:19:72: note: expanded from macro '__const_hweight16'
define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
^
include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
(!!((w) & (1ULL << 2))) + \Adding an explicit cast to __u64 avoids that warning and makes it easier to read other output.
--- include/linux/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bitops.h +1 -1
@@ -49,7 +49,7 @@ static inline int get_bitmask_order(unsigned int count)static __always_inline unsigned long hweight_long (unsigned long w) { -return sizeof (w) ==4 ?hweight32 (w) :hweight64 (w); +return sizeof (w) ==4 ?hweight32 (w) :hweight64 ((__u64 )w); }/**
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 71/191 elfnote: mark all .note sections SHF_ALLOC
In reply to Sasha LevinFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 51da9dfb7f20911ae4e79e9b412a9c2d4c373d4b ]
ELFNOTE_START allows callers to specify flags for .pushsection assembler directives. All callsites but ELF_NOTE use "a" for SHF_ALLOC. For vdso's that explicitly use ELF_NOTE_START and BUILD_SALT, the same section is specified twice after preprocessing, once with "a" flag, once without. Example:
.pushsection .note.Linux, "a", @note ;
.pushsection .note.Linux, "", @note ;
While GNU as allows this ordering, it warns for the opposite ordering, making these directives position dependent. We'd prefer not to precisely match this behavior in Clang's integrated assembler. Instead, the non __ASSEMBLY__ definition of ELF_NOTE uses __attribute__((section(".note.Linux"))) which is created with SHF_ALLOC, so let's make the __ASSEMBLY__ definition of ELF_NOTE consistent with C and just always use "a" flag.
This allows Clang to assemble a working mainline (5.6) kernel via:
$ make CC=clang AS=clang
--- include/linux/elfnote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/elfnote.h +1 -1
@@ -53,7 +53,7 @@ .popsection ;#define ELFNOTE (name, type, desc) \ - ELFNOTE_START(name, type, "") \ + ELFNOTE_START(name, type, "a") \ desc ; \ ELFNOTE_END
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 72/191 selftests/vm/pkeys: fix alloc_random_pkey() to make it really random
In reply to Sasha LevinFrom: Ram Pai <[email protected]>
[ Upstream commit 6e373263ce07eeaa6410843179535fbdf561fc31 ]
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. This fixes it.
--- tools/testing/selftests/x86/protection_keys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/protection_keys.c +2 -1
@@ -23,6 +23,7 @@#define _GNU_SOURCE#include <errno.h> #include <linux/futex.h> +#include <time.h> #include <sys/time.h> #include <sys/syscall.h> #include <string.h>
@@ -608,10 +609,10 @@ int alloc_random_pkey(void)int nr_alloced =0 ;int random_index;memset (alloced_pkeys,0 ,sizeof (alloced_pkeys)); +srand ((unsigned int )time (NULL ));/* allocate every possible key and make a note of which ones we got */ max_nr_pkey_allocs =NR_PKEYS ; - max_nr_pkey_allocs =1 ;for (i =0 ; i < max_nr_pkey_allocs; i++) {int new_pkey =alloc_pkey ();if (new_pkey <0 )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 73/191 selftests/net: in timestamping, strncpy needs to preserve null byte
In reply to Sasha LevinFrom: tannerlove <[email protected]>
[ Upstream commit 8027bc0307ce59759b90679fa5d8b22949586d20 ]
If user passed an interface option longer than 15 characters, then device.ifr_name and hwtstamp.ifr_name became non-null-terminated strings. The compiler warned about this:
timestamping.c:353:2: warning: ‘strncpy’ specified bound 16 equals \
destination size [-Wstringop-truncation]
353 | strncpy(device.ifr_name, interface, sizeof(device.ifr_name));
--- .../selftests/networking/timestamping/timestamping.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/testing/selftests/networking/timestamping/timestamping.c +8 -2
@@ -332,10 +332,16 @@ int main(int argc, char **argv)int val;socklen_t len;struct timeval next; +size_t if_len;if (argc <2 )usage (0 ); interface = argv[1 ]; + if_len =strlen (interface); +if (if_len >=IFNAMSIZ ) { +printf ("interface name exceeds IFNAMSIZ\n" ); +exit (1 ); + }for (i =2 ; i < argc; i++) {if (!strcasecmp (argv[i],"SO_TIMESTAMP" ))
@@ -369,12 +375,12 @@ int main(int argc, char **argv)bail ("socket" );memset (&device,0 ,sizeof (device)); -strncpy (device.ifr_name, interface,sizeof (device.ifr_name)); +memcpy (device.ifr_name, interface, if_len +1 );if (ioctl (sock,SIOCGIFADDR , &device) <0 )bail ("getting interface IP address" );memset (&hwtstamp,0 ,sizeof (hwtstamp)); -strncpy (hwtstamp.ifr_name, interface,sizeof (hwtstamp.ifr_name)); +memcpy (hwtstamp.ifr_name, interface, if_len +1 ); hwtstamp.ifr_data = (void *)&hwconfig;memset (&hwconfig,0 ,sizeof (hwconfig)); hwconfig.tx_type =
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 74/191 scsi: acornscsi: Fix an error handling path in acornscsi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 42c76c9848e13dbe0538d7ae0147a269dfa859cb ]
'ret' is known to be 0 at this point. Explicitly return -ENOMEM if one of the 'ecardm_iomap()' calls fail.
--- drivers/scsi/arm/acornscsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/arm/acornscsi.c +3 -1
@@ -2913,8 +2913,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ashost->base =ecardm_iomap (ec,ECARD_RES_MEMC ,0 ,0 ); ashost->fast =ecardm_iomap (ec,ECARD_RES_IOCFAST ,0 ,0 ); -if (!ashost->base || !ashost->fast) +if (!ashost->base || !ashost->fast) { + ret = -ENOMEM ; goto out_put; + } host->irq = ec->irq; ashost->host = host;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 75/191 usb/xhci-plat: Set PM runtime as active on resume
In reply to Sasha LevinFrom: Qais Yousef <[email protected]>
[ Upstream commit 79112cc3c29f4a8c73a21428fbcbcb0afb005e3e ]
Follow suit of ohci-platform.c and perform pm_runtime_set_active() on resume.
ohci-platform.c had a warning reported due to the missing pm_runtime_set_active() [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- drivers/usb/host/xhci-plat.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +10 -1
@@ -313,8 +313,17 @@ static int xhci_plat_resume(struct device *dev) {struct usb_hcd *hcd =dev_get_drvdata (dev);struct xhci_hcd *xhci =hcd_to_xhci (hcd); +int ret; + + ret =xhci_resume (xhci,0 ); +if (ret) +return ret; + +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); -return xhci_resume (xhci,0 ); +return 0 ; }static const struct dev_pm_ops xhci_plat_pm_ops = {
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 76/191 usb/ehci-platform: Set PM runtime as active on resume
In reply to Sasha LevinFrom: Qais Yousef <[email protected]>
[ Upstream commit 16bdc04cc98ab0c74392ceef2475ecc5e73fcf49 ]
Follow suit of ohci-platform.c and perform pm_runtime_set_active() on resume.
ohci-platform.c had a warning reported due to the missing pm_runtime_set_active() [1].
[1] https://lore.kernel.org/lkml/[email protected]/
--- drivers/usb/host/ehci-platform.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/ehci-platform.c +5 -0
@@ -378,6 +378,11 @@ static int ehci_platform_resume(struct device *dev) }ehci_resume (hcd, priv->reset_on_resume); + +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); +return 0 ; }#endif /* CONFIG_PM_SLEEP */
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 77/191 perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events()
In reply to Sasha LevinFrom: Gaurav Singh <[email protected]>
[ Upstream commit 11b6e5482e178055ec1f2444b55f2518713809d1 ]
The 'evname' variable can be NULL, as it is checked a few lines back, check it before using.
--- tools/perf/builtin-report.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/builtin-report.c +1 -2
@@ -341,8 +341,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct reportif (evname !=NULL ) ret +=fprintf (fp," of event '%s'" , evname); -if (symbol_conf.show_ref_callgraph && -strstr (evname,"call-graph=no" )) { +if (symbol_conf.show_ref_callgraph && evname &&strstr (evname,"call-graph=no" )) { ret +=fprintf (fp,", show reference callgraph" ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 78/191 bcache: fix potential deadlock problem in btree_gc_coalesce
In reply to Sasha LevinFrom: Zhiqiang Liu <[email protected]>
[ Upstream commit be23e837333a914df3f24bf0b32e87b0331ab8d1 ]
coccicheck reports:
drivers/md//bcache/btree.c:1538:1-7: preceding lock on line 1417
In btree_gc_coalesce func, if the coalescing process fails, we will goto to out_nocoalesce tag directly without releasing new_nodes[i]->write_lock. Then, it will cause a deadlock when trying to acquire new_nodes[i]-> write_lock for freeing new_nodes[i] before return.
btree_gc_coalesce func details as follows:
if alloc new_nodes[i] fails: goto out_nocoalesce; // obtain new_nodes[i]->write_lock mutex_lock(&new_nodes[i]->write_lock) // main coalescing process for (i = nodes - 1; i > 0; --i) [snipped] if coalescing process fails: // Here, directly goto out_nocoalesce // tag will cause a deadlock goto out_nocoalesce; [snipped] // release new_nodes[i]->write_lock mutex_unlock(&new_nodes[i]->write_lock) // coalesing succ, return return; out_nocoalesce: btree_node_free(new_nodes[i]) // free new_nodes[i] // obtain new_nodes[i]->write_lock mutex_lock(&new_nodes[i]->write_lock); // set flag for reuse clear_bit(BTREE_NODE_dirty, &ew_nodes[i]->flags); // release new_nodes[i]->write_lock mutex_unlock(&new_nodes[i]->write_lock);
To fix the problem, we add a new tag 'out_unlock_nocoalesce' for releasing new_nodes[i]->write_lock before out_nocoalesce tag. If coalescing process fails, we will go to out_unlock_nocoalesce tag for releasing new_nodes[i]->write_lock before free new_nodes[i] in out_nocoalesce tag.
(Coly Li helps to clean up commit log format.)
--- drivers/md/bcache/btree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/bcache/btree.c +6 -2
@@ -1370,7 +1370,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,if (__set_blocks (n1, n1->keys + n2->keys,block_bytes (b->c)) >btree_blocks (new_nodes[i])) - goto out_nocoalesce; + goto out_unlock_nocoalesce; keys = n2->keys;/* Take the key of the node we're getting rid of */
@@ -1399,7 +1399,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,if (__bch_keylist_realloc (&keylist,bkey_u64s (&new_nodes[i]->key))) - goto out_nocoalesce; + goto out_unlock_nocoalesce;bch_btree_node_write (new_nodes[i], &cl);bch_keylist_add (&keylist, &new_nodes[i]->key);
@@ -1445,6 +1445,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,/* Invalidated our iterator */ return -EINTR ; +out_unlock_nocoalesce: +for (i =0 ; i < nodes; i++) +mutex_unlock (&new_nodes[i]->write_lock); + out_nocoalesce:closure_sync (&cl);bch_keylist_free (&keylist);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 79/191 block: Fix use-after-free in blkdev_get()
In reply to Sasha LevinFrom: Jason Yan <[email protected]>
[ Upstream commit 2d3a8e2deddea6c89961c422ec0c5b851e648c14 ]
In blkdev_get() we call __blkdev_get() to do some internal jobs and if there is some errors in __blkdev_get(), the bdput() is called which means we have released the refcount of the bdev (actually the refcount of the bdev inode). This means we cannot access bdev after that point. But acctually bdev is still accessed in blkdev_get() after calling __blkdev_get(). This results in use-after-free if the refcount is the last one we released in __blkdev_get(). Let's take a look at the following scenerio:
CPU0 CPU1 CPU2blkdev_open blkdev_open Remove disk
bd_acquire
blkdev_get
__blkdev_get del_gendisk
bdev_unhash_inode
bd_acquire bdev_get_gendisk
bd_forget failed because of unhashed
bdput
bdput (the last one)
bdev_evict_inode
access bdev => use after free
[ 459.350216] BUG: KASAN: use-after-free in __lock_acquire+0x24c1/0x31b0
[ 459.351190] Read of size 8 at addr ffff88806c815a80 by task syz-executor.0/20132
[ 459.352347]
[ 459.352594] CPU: 0 PID: 20132 Comm: syz-executor.0 Not tainted 4.19.90 #2
[ 459.353628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 459.354947] Call Trace:
[ 459.355337] dump_stack+0x111/0x19e
[ 459.355879] ? __lock_acquire+0x24c1/0x31b0
[ 459.356523] print_address_description+0x60/0x223
[ 459.357248] ? __lock_acquire+0x24c1/0x31b0
[ 459.357887] kasan_report.cold+0xae/0x2d8
[ 459.358503] __lock_acquire+0x24c1/0x31b0
[ 459.359120] ? _raw_spin_unlock_irq+0x24/0x40
[ 459.359784] ? lockdep_hardirqs_on+0x37b/0x580
[ 459.360465] ? _raw_spin_unlock_irq+0x24/0x40
[ 459.361123] ? finish_task_switch+0x125/0x600
[ 459.361812] ? finish_task_switch+0xee/0x600
[ 459.362471] ? mark_held_locks+0xf0/0xf0
[ 459.363108] ? __schedule+0x96f/0x21d0
[ 459.363716] lock_acquire+0x111/0x320
[ 459.364285] ? blkdev_get+0xce/0xbe0
[ 459.364846] ? blkdev_get+0xce/0xbe0
[ 459.365390] __mutex_lock+0xf9/0x12a0
[ 459.365948] ? blkdev_get+0xce/0xbe0
[ 459.366493] ? bdev_evict_inode+0x1f0/0x1f0
[ 459.367130] ? blkdev_get+0xce/0xbe0
[ 459.367678] ? destroy_inode+0xbc/0x110
[ 459.368261] ? mutex_trylock+0x1a0/0x1a0
[ 459.368867] ? __blkdev_get+0x3e6/0x1280
[ 459.369463] ? bdev_disk_changed+0x1d0/0x1d0
[ 459.370114] ? blkdev_get+0xce/0xbe0
[ 459.370656] blkdev_get+0xce/0xbe0
[ 459.371178] ? find_held_lock+0x2c/0x110
[ 459.371774] ? __blkdev_get+0x1280/0x1280
[ 459.372383] ? lock_downgrade+0x680/0x680
[ 459.373002] ? lock_acquire+0x111/0x320
[ 459.373587] ? bd_acquire+0x21/0x2c0
[ 459.374134] ? do_raw_spin_unlock+0x4f/0x250
[ 459.374780] blkdev_open+0x202/0x290
[ 459.375325] do_dentry_open+0x49e/0x1050
[ 459.375924] ? blkdev_get_by_dev+0x70/0x70
[ 459.376543] ? __x64_sys_fchdir+0x1f0/0x1f0
[ 459.377192] ? inode_permission+0xbe/0x3a0
[ 459.377818] path_openat+0x148c/0x3f50
[ 459.378392] ? kmem_cache_alloc+0xd5/0x280
[ 459.379016] ? entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.379802] ? path_lookupat.isra.0+0x900/0x900
[ 459.380489] ? __lock_is_held+0xad/0x140
[ 459.381093] do_filp_open+0x1a1/0x280
[ 459.381654] ? may_open_dev+0xf0/0xf0
[ 459.382214] ? find_held_lock+0x2c/0x110
[ 459.382816] ? lock_downgrade+0x680/0x680
[ 459.383425] ? __lock_is_held+0xad/0x140
[ 459.384024] ? do_raw_spin_unlock+0x4f/0x250
[ 459.384668] ? _raw_spin_unlock+0x1f/0x30
[ 459.385280] ? __alloc_fd+0x448/0x560
[ 459.385841] do_sys_open+0x3c3/0x500
[ 459.386386] ? filp_open+0x70/0x70
[ 459.386911] ? trace_hardirqs_on_thunk+0x1a/0x1c
[ 459.387610] ? trace_hardirqs_off_caller+0x55/0x1c0
[ 459.388342] ? do_syscall_64+0x1a/0x520
[ 459.388930] do_syscall_64+0xc3/0x520
[ 459.389490] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.390248] RIP: 0033:0x416211
[ 459.390720] Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83
04 19 00 00 c3 48 83 ec 08 e8 0a fa ff ff 48 89 04 24 b8 02 00 00 00 0f
05 <48> 8b 3c 24 48 89 c2 e8 53 fa ff ff 48 89 d0 48 83 c4 08 48 3d
01
[ 459.393483] RSP: 002b:00007fe45dfe9a60 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
[ 459.394610] RAX: ffffffffffffffda RBX: 00007fe45dfea6d4 RCX: 0000000000416211
[ 459.395678] RDX: 00007fe45dfe9b0a RSI: 0000000000000002 RDI: 00007fe45dfe9b00
[ 459.396758] RBP: 000000000076bf20 R08: 0000000000000000 R09: 000000000000000a
[ 459.397930] R10: 0000000000000075 R11: 0000000000000293 R12: 00000000ffffffff
[ 459.399022] R13: 0000000000000bd9 R14: 00000000004cdb80 R15: 000000000076bf2c
[ 459.400168]
[ 459.400430] Allocated by task 20132:
[ 459.401038] kasan_kmalloc+0xbf/0xe0
[ 459.401652] kmem_cache_alloc+0xd5/0x280
[ 459.402330] bdev_alloc_inode+0x18/0x40
[ 459.402970] alloc_inode+0x5f/0x180
[ 459.403510] iget5_locked+0x57/0xd0
[ 459.404095] bdget+0x94/0x4e0
[ 459.404607] bd_acquire+0xfa/0x2c0
[ 459.405113] blkdev_open+0x110/0x290
[ 459.405702] do_dentry_open+0x49e/0x1050
[ 459.406340] path_openat+0x148c/0x3f50
[ 459.406926] do_filp_open+0x1a1/0x280
[ 459.407471] do_sys_open+0x3c3/0x500
[ 459.408010] do_syscall_64+0xc3/0x520
[ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.409415]
[ 459.409679] Freed by task 1262:
[ 459.410212] __kasan_slab_free+0x129/0x170
[ 459.410919] kmem_cache_free+0xb2/0x2a0
[ 459.411564] rcu_process_callbacks+0xbb2/0x2320
[ 459.412318] __do_softirq+0x225/0x8acFix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev.
--- fs/block_dev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/block_dev.c +7 -5
@@ -1255,10 +1255,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)*/ if (!for_part) { ret =devcgroup_inode_permission (bdev->bd_inode, perm); -if (ret !=0 ) { -bdput (bdev); +if (ret !=0 )return ret; - } } restart:
@@ -1330,8 +1328,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear;BUG_ON (for_part); ret =__blkdev_get (whole, mode,1 ); -if (ret) +if (ret) { +bdput (whole); goto out_clear; + } bdev->bd_contains = whole; bdev->bd_part =disk_get_part (disk, partno); if (!(disk->flags & GENHD_FL_UP) ||
@@ -1382,7 +1382,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)put_disk (disk);module_put (owner); out: -bdput (bdev);return ret; }
@@ -1468,6 +1467,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)bdput (whole); } +if (res) +bdput (bdev); +return res; }EXPORT_SYMBOL (blkdev_get);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 80/191 libata: Use per port sync for detach
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit b5292111de9bb70cba3489075970889765302136 ]
Commit 130f4caf145c ("libata: Ensure ata_port probe has completed before detach") may cause system freeze during suspend.
Using async_synchronize_full() in PM callbacks is wrong, since async callbacks that are already scheduled may wait for not-yet-scheduled callbacks, causes a circular dependency.
Instead of using big hammer like async_synchronize_full(), use async cookie to make sure port probe are synced, without affecting other scheduled PM callbacks.
--- drivers/ata/libata-core.c | 11 +++++------ include/linux/libata.h | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/ata/libata-core.c +5 -6
@@ -57,7 +57,6 @@#include <linux/workqueue.h> #include <linux/scatterlist.h> #include <linux/io.h> -#include <linux/async.h> #include <linux/log2.h> #include <linux/slab.h> #include <linux/glob.h>
@@ -6410,7 +6409,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)/* perform each probe asynchronously */ for (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i]; -async_schedule (async_port_probe, ap); + ap->cookie =async_schedule (async_port_probe, ap); }return 0 ;
@@ -6550,11 +6549,11 @@ void ata_host_detach(struct ata_host *host) {int i; -/* Ensure ata_port probe has completed */ -async_synchronize_full (); - -for (i =0 ; i < host->n_ports; i++) +for (i =0 ; i < host->n_ports; i++) { +/* Ensure ata_port probe has completed */ +async_synchronize_cookie (host->ports[i]->cookie +1 );ata_port_detach (host->ports[i]); + }/* the host is dead now, dissociate ACPI */ ata_acpi_dissociate (host);
include/linux/libata.h +3 -0
@@ -38,6 +38,7 @@#include <linux/acpi.h> #include <linux/cdrom.h> #include <linux/sched.h> +#include <linux/async.h> /* * Define if arch has non-standard setup. This is a _PCI_ standard
@@ -878,6 +879,8 @@ struct ata_port {struct timer_list fastdrain_timer;unsigned long fastdrain_cnt; +async_cookie_t cookie; +int em_message_type;void *private_data;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 81/191 drm: encoder_slave: fix refcouting error for modules
In reply to Sasha LevinFrom: Wolfram Sang <[email protected]>
[ Upstream commit f78d4032de60f50fd4afaa0fb68ea03b985f820a ]
module_put() balances try_module_get(), not request_module(). Fix the error path to match that.
--- drivers/gpu/drm/drm_encoder_slave.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_encoder_slave.c +3 -2
@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, err = encoder_drv->encoder_init (client, dev, encoder);if (err) - goto fail_unregister; + goto fail_module_put;if (info->platform_data) encoder->slave_funcs->set_config(&encoder->base,
@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,return 0 ; +fail_module_put: +module_put (module); fail_unregister:i2c_unregister_device (client); -module_put (module); fail:return err; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 82/191 drm/dp_mst: Reformat drm_dp_check_act_status() a bit
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
commit a5cb5fa6c3a5c2cf492db667b8670ee7b044b79f upstream.
Just add a bit more line wrapping, get rid of some extraneous whitespace, remove an unneeded goto label, and move around some variable declarations. No functional changes here.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +10 -12
@@ -2682,33 +2682,31 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,*/ int drm_dp_check_act_status (struct drm_dp_mst_topology_mgr *mgr) { +int count =0 , ret;u8 status; -int ret; -int count =0 ;do { - ret =drm_dp_dpcd_readb (mgr->aux,DP_PAYLOAD_TABLE_UPDATE_STATUS , &status); - + ret =drm_dp_dpcd_readb (mgr->aux, +DP_PAYLOAD_TABLE_UPDATE_STATUS , + &status);if (ret <0 ) { -DRM_DEBUG_KMS ("failed to read payload table status %d\n" , ret); - goto fail; +DRM_DEBUG_KMS ("failed to read payload table status %d\n" , + ret); +return ret; }if (status &DP_PAYLOAD_ACT_HANDLED )break ; count++;udelay (100 ); - }while (count <30 );if (!(status &DP_PAYLOAD_ACT_HANDLED )) { -DRM_DEBUG_KMS ("failed to get ACT bit %d after %d retries\n" , status, count); - ret = -EINVAL ; - goto fail; +DRM_DEBUG_KMS ("failed to get ACT bit %d after %d retries\n" , + status, count); +return -EINVAL ; }return 0 ; -fail: -return ret; }EXPORT_SYMBOL (drm_dp_check_act_status);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 83/191 drm/qxl: Use correct notify port address when creating cursor ring
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
commit 80e5f89da3ab949fbbf1cae01dfaea29f5483a75 upstream.
The command ring and cursor ring use different notify port addresses
definition: QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR. However, in qxl_device_init() we use QXL_IO_NOTIFY_CMD to create both command ring and cursor ring. This doesn't cause any problems now, because QEMU's behaviors on QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR are the same. However, QEMU's behavior may be change in future, so let's fix it.
P.S.: In the X.org QXL driver, the notify port address of cursor ring
is correct.
--- drivers/gpu/drm/qxl/qxl_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_kms.c +1 -1
@@ -199,7 +199,7 @@ static int qxl_device_init(struct qxl_device *qdev, &(qdev->ram_header->cursor_ring_hdr),sizeof (struct qxl_command ),QXL_CURSOR_RING_SIZE , - qdev->io_base +QXL_IO_NOTIFY_CMD , + qdev->io_base +QXL_IO_NOTIFY_CURSOR , false, &qdev->cursor_event);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 84/191 selinux: fix double free
In reply to Sasha LevinFrom: Tom Rix <[email protected]>
commit 65de50969a77509452ae590e9449b70a22b923bb upstream.
Clang's static analysis tool reports these double free memory errors.
security/selinux/ss/services.c:2987:4: warning: Attempt to free released memory [unix.Malloc]
kfree(bnames[i]);
^~~~~~~~~~~~~~~~
security/selinux/ss/services.c:2990:2: warning: Attempt to free released memory [unix.Malloc]
kfree(bvalues);
^~~~~~~~~~~~~~So improve the security_get_bools error handling by freeing these variables and setting their return pointers to NULL and the return len to 0
--- security/selinux/ss/services.c | 4 ++++ 1 file changed, 4 insertions(+)
security/selinux/ss/services.c +4 -0
@@ -2616,8 +2616,12 @@ int security_get_bools(int *len, char ***names, int **values)if (*names) {for (i =0 ; i < *len; i++)kfree ((*names)[i]); +kfree (*names); }kfree (*values); + *len =0 ; + *names =NULL ; + *values =NULL ; goto out; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 85/191 ext4: fix partial cluster initialization when splitting extent
In reply to Sasha LevinFrom: Jeffle Xu <[email protected]>
[ Upstream commit cfb3c85a600c6aa25a2581b3c1c4db3460f14e46 ]
Fix the bug when calculating the physical block number of the first block in the split extent.
This bug will cause xfstests shared/298 failure on ext4 with bigalloc enabled occasionally. Ext4 error messages indicate that previously freed blocks are being freed again, and the following fsck will fail due to the inconsistency of block bitmap and bg descriptor.
The following is an example case:
1. First, Initialize a ext4 filesystem with cluster size '16K', block size '4K', in which case, one cluster contains four blocks.
2. Create one file (e.g., xxx.img) on this ext4 filesystem. Now the extent tree of this file is like:
...
36864:[0]4:220160
36868:[0]14332:145408
51200:[0]2:231424
...
3. Then execute PUNCH_HOLE fallocate on this file. The hole range is like:
..ext4_ext_remove_space: dev 254,16 ino 12 since 49506 end 49506 depth 1ext4_ext_remove_space: dev 254,16 ino 12 since 49544 end 49546 depth 1ext4_ext_remove_space: dev 254,16 ino 12 since 49605 end 49607 depth 1
...
4. Then the extent tree of this file after punching is like
...
49507:[0]37:158047
49547:[0]58:158087
...
5. Detailed procedure of punching hole [49544, 49546]
5.1. The block address space:
``` lblk ~49505 49506 49507~49543 49544~49546 49547~ ---------+------+-------------+----------------+-------- extent | hole | extent | hole | extent ---------+------+-------------+----------------+-------- pblk ~158045 158046 158047~158083 158084~158086 158087~ ```
5.2. The detailed layout of cluster 39521:
``` cluster 39521 <-------------------------------> hole extent <----------------------><-------- lblk 49544 49545 49546 49547 +-------+-------+-------+-------+ | | | | | +-------+-------+-------+-------+ pblk 158084 1580845 158086 158087 ```
5.3. The ftrace output when punching hole [49544, 49546]:
- ext4_ext_remove_space (start 49544, end 49546)
- ext4_ext_rm_leaf (start 49544, end 49546, last_extent [49507(158047), 40], partial [pclu 39522 lblk 0 state 2])
- ext4_remove_blocks (extent [49507(158047), 40], from 49544 to 49546, partial [pclu 39522 lblk 0 state 2]
- ext4_free_blocks: (block 158084 count 4)
- ext4_mballoc_free (extent 1/6753/1)
5.4. Ext4 error message in dmesg:
EXT4-fs error (device vdb): mb_free_blocks:1457: group 1, block 158084:freeing already freed block (bit 6753); block bitmap corrupt. EXT4-fs error (device vdb): ext4_mb_generate_buddy:747: group 1, block bitmap and bg descriptor inconsistent: 19550 vs 19551 free clusters
In this case, the whole cluster 39521 is freed mistakenly when freeing pblock 158084~158086 (i.e., the first three blocks of this cluster), although pblock 158087 (the last remaining block of this cluster) has not been freed yet.
The root cause of this isuue is that, the pclu of the partial cluster is calculated mistakenly in ext4_ext_remove_space(). The correct partial_cluster.pclu (i.e., the cluster number of the first block in the next extent, that is, lblock 49597 (pblock 158086)) should be 39521 rather than 39522.
--- fs/ext4/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
@@ -2916,7 +2916,7 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,* in use to avoid freeing it when removing blocks. */ if (sbi->s_cluster_ratio >1 ) { - pblk =ext4_ext_pblock (ex) + end - ee_block +2 ; + pblk =ext4_ext_pblock (ex) + end - ee_block +1 ; partial_cluster = -(long long )EXT4_B2C (sbi, pblk); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 86/191 drm/dp_mst: Increase ACT retry timeout to 3s
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit 873a95e0d59ac06901ae261dda0b7165ffd002b8 ]
Currently we only poll for an ACT up to 30 times, with a busy-wait delay of 100µs between each attempt - giving us a timeout of 2900µs. While this might seem sensible, it would appear that in certain scenarios it can take dramatically longer then that for us to receive an ACT. On one of the EVGA MST hubs that I have available, I observed said hub sometimes taking longer then a second before signalling the ACT. These delays mostly seem to occur when previous sideband messages we've sent are NAKd by the hub, however it wouldn't be particularly surprising if it's possible to reproduce times like this simply by introducing branch devices with large LCTs since payload allocations have to take effect on every downstream device up to the payload's target.
So, instead of just retrying 30 times we poll for the ACT for up to 3ms, and additionally use usleep_range() to avoid a very long and rude busy-wait. Note that the previous retry count of 30 appears to have been arbitrarily chosen, as I can't find any mention of a recommended timeout or retry count for ACTs in the DisplayPort 2.0 specification. This also goes for the range we were previously using for udelay(), although I suspect that was just copied from the recommended delay for link training on SST devices.
Changes since v1:
* Use readx_poll_timeout() instead of open-coding timeout loop - Sean Paul
Changes since v2:
* Increase poll interval to 200us - Sean Paul
* Print status in hex when we timeout waiting for ACT - Sean Paul
--- drivers/gpu/drm/drm_dp_mst_topology.c | 54 ++++++++++++++++----------- 1 file changed, 32 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +32 -22
@@ -29,6 +29,7 @@#include <linux/i2c.h> #include <drm/drm_dp_mst_helper.h> #include <drm/drmP.h> +#include <linux/iopoll.h> #include <drm/drm_fixed.h>
@@ -2673,6 +2674,17 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,return ret; } +static int do_get_act_status (struct drm_dp_aux *aux) +{ +int ret; +u8 status; + + ret =drm_dp_dpcd_readb (aux,DP_PAYLOAD_TABLE_UPDATE_STATUS , &status); +if (ret <0 ) +return ret; + +return status; +}/** * drm_dp_check_act_status() - Check ACT handled status.
@@ -2682,30 +2694,28 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,*/ int drm_dp_check_act_status (struct drm_dp_mst_topology_mgr *mgr) { -int count =0 , ret; -u8 status; - -do { - ret =drm_dp_dpcd_readb (mgr->aux, -DP_PAYLOAD_TABLE_UPDATE_STATUS , - &status); -if (ret <0 ) { -DRM_DEBUG_KMS ("failed to read payload table status %d\n" , - ret); -return ret; - } - -if (status &DP_PAYLOAD_ACT_HANDLED ) -break ; - count++; -udelay (100 ); - }while (count <30 ); - -if (!(status &DP_PAYLOAD_ACT_HANDLED )) { -DRM_DEBUG_KMS ("failed to get ACT bit %d after %d retries\n" , - status, count); +/* +* There doesn't seem to be any recommended retry count or timeout in +* the MST specification. Since some hubs have been observed to take +* over 1 second to update their payload allocations under certain +* conditions, we use a rather large timeout value. +*/ +const int timeout_ms =3000 ; +int ret, status; + + ret =readx_poll_timeout (do_get_act_status, mgr->aux, status, + status &DP_PAYLOAD_ACT_HANDLED || status <0 , +200 , timeout_ms *USEC_PER_MSEC ); +if (ret <0 && status >=0 ) { +DRM_DEBUG_KMS ("Failed to get ACT after %dms, last status: %02x\n" , + timeout_ms, status);return -EINVAL ; + }else if (status <0 ) { +DRM_DEBUG_KMS ("Failed to read payload table status: %d\n" , + status); +return status; } +return 0 ; }EXPORT_SYMBOL (drm_dp_check_act_status);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 87/191 x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
commit bc310baf2ba381c648983c7f4748327f17324562 upstream.
The final build stage of the x86 kernel captures some symbol addresses from the decompressor binary and copies them into zoffset.h. It uses sed with a regular expression that matches the address, symbol type and symbol name, and mangles the captured addresses and the names of symbols of interest into #define directives that are added to zoffset.h
The symbol type is indicated by a single letter, which we match
strictly: only letters in the set 'ABCDGRSTVW' are matched, even though the actual symbol type is relevant and therefore ignored.
Commit bc7c9d620 ("efi/libstub/x86: Force 'hidden' visibility for extern declarations") made a change to the way external symbol references are classified, resulting in 'startup_32' now being emitted as a hidden symbol. This prevents the use of GOT entries to refer to this symbol via its absolute address, which recent toolchains (including Clang based ones) already avoid by default, making this change a no-op in the majority of cases.
However, as it turns out, the LLVM linker classifies such hidden symbols as symbols with static linkage in fully linked ELF binaries, causing tools such as NM to output a lowercase 't' rather than an upper case 'T' for the type of such symbols. Since our sed expression only matches upper case letters for the symbol type, the line describing startup_32 is disregarded, resulting in a build error like the following
arch/x86/boot/header.S:568:18: error: symbol 'ZO_startup_32' can not be
undefined in a subtraction expression
init_size: .long (0x00000000008fd000 - ZO_startup_32 +
(((0x0000000001f6361c + ((0x0000000001f6361c >> 8) + 65536)
- 0x00000000008c32e5) + 4095) & ~4095)) # kernel initialization size
Given that we are only interested in the value of the symbol, let's match any character in the set 'a-zA-Z' instead.
--- arch/x86/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/Makefile +1 -1
@@ -87,7 +87,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE SETUP_OBJS = $(addprefix $(obj)/,$(setup-y)) -sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' +sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p' quiet_cmd_zoffset = ZOFFSET $@ cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 88/191 block: nr_sects_write(): Disable preemption on seqcount write
In reply to Sasha LevinFrom: "Ahmed S. Darwish" <[email protected]>
[ Upstream commit 15b81ce5abdc4b502aa31dff2d415b79d2349d2f ]
For optimized block readers not holding a mutex, the "number of sectors" 64-bit value is protected from tearing on 32-bit architectures by a sequence counter.
Disable preemption before entering that sequence counter's write side critical section. Otherwise, the read side can preempt the write side section and spin for the entire scheduler tick. If the reader belongs to a real-time scheduling class, it can spin forever and the kernel will livelock.
--- include/linux/genhd.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/genhd.h +2 -0
@@ -716,9 +716,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part)static inline void part_nr_sects_write (struct hd_struct *part,sector_t size) {#if BITS_PER_LONG ==32 && defined(CONFIG_LBDAF ) && defined(CONFIG_SMP ) +preempt_disable ();write_seqcount_begin (&part->nr_sects_seq); part->nr_sects = size;write_seqcount_end (&part->nr_sects_seq); +preempt_enable ();#elif BITS_PER_LONG ==32 && defined(CONFIG_LBDAF ) && defined(CONFIG_PREEMPT )preempt_disable (); part->nr_sects = size;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 89/191 s390: fix syscall_get_error for compat processes
In reply to Sasha LevinFrom: "Dmitry V. Levin" <[email protected]>
commit b3583fca5fb654af2cfc1c08259abb9728272538 upstream.
If both the tracer and the tracee are compat processes, and gprs[2] is assigned a value by __poke_user_compat, then the higher 32 bits of gprs[2] are cleared, IS_ERR_VALUE() always returns false, and syscall_get_error() always returns 0.
Fix the implementation by sign-extending the value for compat processes the same way as x86 implementation does.
The bug was exposed to user space by commit 201766a20e30f ("ptrace: add PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.
This change fixes strace syscall tampering on s390.
--- arch/s390/include/asm/syscall.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/s390/include/asm/syscall.h +11 -1
@@ -41,7 +41,17 @@ static inline void syscall_rollback(struct task_struct *task,static inline long syscall_get_error (struct task_struct *task,struct pt_regs *regs) { -return IS_ERR_VALUE (regs->gprs[2 ]) ? regs->gprs[2 ] :0 ; +unsigned long error = regs->gprs[2 ]; +#ifdef CONFIG_COMPAT +if (test_tsk_thread_flag (task,TIF_31BIT )) { +/* +* Sign-extend the value so (int)-EFOO becomes (long)-EFOO +* and will match correctly in comparisons. +*/ + error = (long )(int )error; + } +#endif +return IS_ERR_VALUE (error) ? error :0 ; } static inline long syscall_get_return_value(struct task_struct *task,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 90/191 drm/i915: Whitelist context-local timestamp in the gen9 cmdparser
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
commit 273500ae71711c040d258a7b3f4b6f44c368fff2 upstream.
Allow batch buffers to read their own _local_ cumulative HW runtime of their logical context.
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_cmd_parser.c +4 -0
@@ -570,6 +570,9 @@ struct drm_i915_reg_descriptor {#define REG32 (_reg, ...) \ { .addr = (_reg), __VA_ARGS__ } +#define REG32_IDX (_reg, idx) \ + { .addr = _reg(idx) } +/* * Convenience macro for adding 64-bit registers. *
@@ -667,6 +670,7 @@ static const struct drm_i915_reg_descriptor gen9_blt_regs[] = {REG64_IDX (RING_TIMESTAMP ,BSD_RING_BASE ),REG32 (BCS_SWCTRL ),REG64_IDX (RING_TIMESTAMP ,BLT_RING_BASE ), +REG32_IDX (RING_CTX_TIMESTAMP ,BLT_RING_BASE ),REG64_IDX (BCS_GPR ,0 ),REG64_IDX (BCS_GPR ,1 ), REG64_IDX(BCS_GPR, 2),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 91/191 crypto: algboss - don't wait during notifier callback
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
commit 77251e41f89a813b4090f5199442f217bbf11297 upstream.
When a crypto template needs to be instantiated, CRYPTO_MSG_ALG_REQUEST is sent to crypto_chain. cryptomgr_schedule_probe() handles this by starting a thread to instantiate the template, then waiting for this thread to complete via crypto_larval::completion.
This can deadlock because instantiating the template may require loading modules, and this (apparently depending on userspace) may need to wait for the crc-t10dif module (lib/crc-t10dif.c) to be loaded. But crc-t10dif's module_init function uses crypto_register_notifier() and therefore takes crypto_chain.rwsem for write. That can't proceed until the notifier callback has finished, as it holds this semaphore for read.
Fix this by removing the wait on crypto_larval::completion from within cryptomgr_schedule_probe(). It's actually unnecessary because crypto_alg_mod_lookup() calls crypto_larval_wait() itself after sending CRYPTO_MSG_ALG_REQUEST.
This only actually became a problem in v4.20 due to commit b76377543b73 ("crc-t10dif: Pick better transform if one becomes available"), but the unnecessary wait was much older.
--- crypto/algboss.c | 2 -- 1 file changed, 2 deletions(-)
crypto/algboss.c +0 -2
@@ -194,8 +194,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)if (IS_ERR (thread)) goto err_put_larval; -wait_for_completion_interruptible (&larval->completion); -return NOTIFY_STOP ; err_put_larval:
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 92/191 kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 1a0aa991a6274161c95a844c58cfb801d681eb59 ]
In kprobe_optimizer() kick_kprobe_optimizer() is called without kprobe_mutex, but this can race with other caller which is protected by kprobe_mutex.
To fix that, expand kprobe_mutex protected area to protect kick_kprobe_optimizer() call.
--- kernel/kprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/kprobes.c +2 -1
@@ -561,11 +561,12 @@ static void kprobe_optimizer(struct work_struct *work)do_free_cleaned_kprobes ();mutex_unlock (&module_mutex); -mutex_unlock (&kprobe_mutex);/* Step 5: Kick optimizer again if needed */ if (!list_empty (&optimizing_list) || !list_empty (&unoptimizing_list))kick_kprobe_optimizer (); + +mutex_unlock (&kprobe_mutex); }/* Wait for completing optimization and unoptimization */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 93/191 powerpc/kprobes: Fixes for kprobe_lookup_name() on BE
In reply to Sasha LevinFrom: "Naveen N. Rao" <[email protected]>
[ Upstream commit 30176466e36aadba01e1a630cf42397a3438efa4 ]
Fix two issues with kprobes.h on BE which were exposed with the optprobes work:
- one, having to do with a missing include for linux/module.h for MODULE_NAME_LEN -- this didn't show up previously since the only users of kprobe_lookup_name were in kprobes.c, which included linux/module.h through other headers, and
- two, with a missing const qualifier for a local variable which ends up referring a string literal. Again, this is unique to how kprobe_lookup_name is being invoked in optprobes.c
--- arch/powerpc/include/asm/kprobes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/kprobes.h +2 -1
@@ -29,6 +29,7 @@#include <linux/types.h> #include <linux/ptrace.h> #include <linux/percpu.h> +#include <linux/module.h> #include <asm/probes.h> #include <asm/code-patching.h>
@@ -60,7 +61,7 @@ typedef ppc_opcode_t kprobe_opcode_t;#define kprobe_lookup_name (name, addr) \ { \ char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \ - char *modsym; \ + const char *modsym; \ bool dot_appended = false; \ if ((modsym = strchr(name, ':')) != NULL) { \ modsym++; \
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 94/191 x86/kprobes: Avoid kretprobe recursion bug
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit b191fa96ea6dc00d331dcc28c1f7db5e075693a0 ]
Avoid kretprobe recursion loop bg by setting a dummy kprobes to current_kprobe per-CPU variable.
This bug has been introduced with the asm-coded trampoline code, since previously it used another kprobe for hooking the function return placeholder (which only has a nop) and trampoline handler was called from that kprobe.
This revives the old lost kprobe again.
With this fix, we don't see deadlock anymore.
And you can see that all inner-called kretprobe are skipped.
event_1 235 0
event_2 19375 19612
The 1st column is recorded count and the 2nd is missed count. Above shows (event_1 rec) + (event_2 rec) ~= (event_2 missed) (some difference are here because the counter is racy)
--- arch/x86/kernel/kprobes/core.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
arch/x86/kernel/kprobes/core.c +20 -2
@@ -740,11 +740,16 @@ asm(NOKPROBE_SYMBOL (kretprobe_trampoline);STACK_FRAME_NON_STANDARD (kretprobe_trampoline); +static struct kprobe kretprobe_kprobe = { + .addr = (void *)kretprobe_trampoline, +}; +/* * Called from kretprobe_trampoline */ __visible __used void *trampoline_handler(struct pt_regs *regs) { +struct kprobe_ctlblk *kcb;struct kretprobe_instance *ri =NULL ;struct hlist_head *head, empty_rp;struct hlist_node *tmp;
@@ -754,6 +759,17 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)void *frame_pointer;bool skipped = false; +preempt_disable (); + +/* +* Set a dummy kprobe for avoiding kretprobe recursion. +* Since kretprobe never run in kprobe handler, kprobe must not +* be running at this point. +*/ + kcb =get_kprobe_ctlblk (); +__this_cpu_write (current_kprobe, &kretprobe_kprobe); + kcb->kprobe_status =KPROBE_HIT_ACTIVE ; +INIT_HLIST_HEAD (&empty_rp);kretprobe_hash_lock (current, &head, &flags);/* fixup registers */
@@ -829,10 +845,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs) orig_ret_address = (unsigned long )ri->ret_addr;if (ri->rp && ri->rp->handler) {__this_cpu_write (current_kprobe, &ri->rp->kp); -get_kprobe_ctlblk ()->kprobe_status =KPROBE_HIT_ACTIVE ; ri->ret_addr = correct_ret_addr; ri->rp->handler (ri, regs); -__this_cpu_write (current_kprobe,NULL ); +__this_cpu_write (current_kprobe, &kretprobe_kprobe); }recycle_rp_inst (ri, &empty_rp);
@@ -848,6 +863,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)kretprobe_hash_unlock (current, &flags); +__this_cpu_write (current_kprobe,NULL ); +preempt_enable (); +hlist_for_each_entry_safe (ri, tmp, &empty_rp, hlist) {hlist_del (&ri->hlist);kfree (ri);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 95/191 kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
In reply to Sasha LevinFrom: Jiri Olsa <[email protected]>
[ Upstream commit 9b38cc704e844e41d9cf74e647bff1d249512cb3 ]
Ziqian reported lockup when adding retprobe on _raw_spin_lock_irqsave. My test was also able to trigger lockdep output:
============================================
WARNING: possible recursive locking detected
5.6.0-rc6+ #6 Not tainted
--------------------------------------------
sched-messaging/2767 is trying to acquire lock:
ffffffff9a492798 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_hash_lock+0x52/0xa0
but task is already holding lock:
ffffffff9a491a18 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_trampoline+0x0/0x50
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(kretprobe_table_locks[i].lock));
lock(&(kretprobe_table_locks[i].lock));
*** DEADLOCK ***
May be due to missing lock nesting notation
1 lock held by sched-messaging/2767:
#0: ffffffff9a491a18 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_trampoline+0x0/0x50
stack backtrace: CPU: 3 PID: 2767 Comm: sched-messaging Not tainted 5.6.0-rc6+ #6 Call Trace: dump_stack+0x96/0xe0 __lock_acquire.cold.57+0x173/0x2b7 ? native_queued_spin_lock_slowpath+0x42b/0x9e0 ? lockdep_hardirqs_on+0x590/0x590 ? __lock_acquire+0xf63/0x4030 lock_acquire+0x15a/0x3d0 ? kretprobe_hash_lock+0x52/0xa0 _raw_spin_lock_irqsave+0x36/0x70 ? kretprobe_hash_lock+0x52/0xa0 kretprobe_hash_lock+0x52/0xa0 trampoline_handler+0xf8/0x940 ? kprobe_fault_handler+0x380/0x380 ? find_held_lock+0x3a/0x1c0 kretprobe_trampoline+0x25/0x50 ? lock_acquired+0x392/0xbc0 ? _raw_spin_lock_irqsave+0x50/0x70 ? __get_valid_kprobe+0x1f0/0x1f0 ? _raw_spin_unlock_irqrestore+0x3b/0x40 ? finish_task_switch+0x4b9/0x6d0 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70
The code within the kretprobe handler checks for probe reentrancy, so we won't trigger any _raw_spin_lock_irqsave probe in there.
The problem is in outside kprobe_flush_task, where we call:
kprobe_flush_task
kretprobe_table_lock
raw_spin_lock_irqsave
_raw_spin_lock_irqsave
where _raw_spin_lock_irqsave triggers the kretprobe and installs kretprobe_trampoline handler on _raw_spin_lock_irqsave return.
The kretprobe_trampoline handler is then executed with already locked kretprobe_table_locks, and first thing it does is to lock kretprobe_table_locks ;-) the whole lockup path like:
kprobe_flush_task
kretprobe_table_lock
raw_spin_lock_irqsave
_raw_spin_lock_irqsave ---> probe triggered, kretprobe_trampoline installed
---> kretprobe_table_locks locked
kretprobe_trampoline
trampoline_handler
kretprobe_hash_lock(current, &head, &flags); <--- deadlockAdding kprobe_busy_begin/end helpers that mark code with fake probe installed to prevent triggering of another kprobe within this code.
Using these helpers in kprobe_flush_task, so the probe recursion protection check is hit and the probe is never set to prevent above lockup.
--- arch/x86/kernel/kprobes/core.c | 16 +++------------- include/linux/kprobes.h | 4 ++++ kernel/kprobes.c | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 13 deletions(-)
arch/x86/kernel/kprobes/core.c +3 -13
@@ -740,16 +740,11 @@ asm(NOKPROBE_SYMBOL (kretprobe_trampoline);STACK_FRAME_NON_STANDARD (kretprobe_trampoline); -static struct kprobe kretprobe_kprobe = { - .addr = (void *)kretprobe_trampoline, -}; -/* * Called from kretprobe_trampoline */ __visible __used void *trampoline_handler(struct pt_regs *regs) { -struct kprobe_ctlblk *kcb;struct kretprobe_instance *ri =NULL ;struct hlist_head *head, empty_rp;struct hlist_node *tmp;
@@ -759,16 +754,12 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)void *frame_pointer;bool skipped = false; -preempt_disable (); -/* * Set a dummy kprobe for avoiding kretprobe recursion. * Since kretprobe never run in kprobe handler, kprobe must not * be running at this point. */ - kcb =get_kprobe_ctlblk (); -__this_cpu_write (current_kprobe, &kretprobe_kprobe); - kcb->kprobe_status =KPROBE_HIT_ACTIVE ; +kprobe_busy_begin ();INIT_HLIST_HEAD (&empty_rp);kretprobe_hash_lock (current, &head, &flags);
@@ -847,7 +838,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)__this_cpu_write (current_kprobe, &ri->rp->kp); ri->ret_addr = correct_ret_addr; ri->rp->handler (ri, regs); -__this_cpu_write (current_kprobe, &kretprobe_kprobe); +__this_cpu_write (current_kprobe, &kprobe_busy); }recycle_rp_inst (ri, &empty_rp);
@@ -863,8 +854,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)kretprobe_hash_unlock (current, &flags); -__this_cpu_write (current_kprobe,NULL ); -preempt_enable (); +kprobe_busy_end ();hlist_for_each_entry_safe (ri, tmp, &empty_rp, hlist) {hlist_del (&ri->hlist);
include/linux/kprobes.h +4 -0
@@ -366,6 +366,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)return this_cpu_ptr (&kprobe_ctlblk); } +extern struct kprobe kprobe_busy; +void kprobe_busy_begin (void ); +void kprobe_busy_end (void ); +int register_kprobe (struct kprobe *p);void unregister_kprobe (struct kprobe *p);int register_kprobes (struct kprobe **kps,int num);
kernel/kprobes.c +24 -0
@@ -1150,6 +1150,26 @@ __releases(hlist_lock) }NOKPROBE_SYMBOL (kretprobe_table_unlock); +struct kprobe kprobe_busy = { + .addr = (void *) get_kprobe, +}; + +void kprobe_busy_begin (void ) +{ +struct kprobe_ctlblk *kcb; + +preempt_disable (); +__this_cpu_write (current_kprobe, &kprobe_busy); + kcb =get_kprobe_ctlblk (); + kcb->kprobe_status =KPROBE_HIT_ACTIVE ; +} + +void kprobe_busy_end (void ) +{ +__this_cpu_write (current_kprobe,NULL ); +preempt_enable (); +} +/* * This function is called from finish_task_switch when task tk becomes dead, * so that we can recycle any function-return probe instances associated
@@ -1167,6 +1187,8 @@ void kprobe_flush_task(struct task_struct *tk)/* Early boot. kretprobe_table_locks not yet initialized. */ return ; +kprobe_busy_begin (); +INIT_HLIST_HEAD (&empty_rp); hash =hash_ptr (tk,KPROBE_HASH_BITS ); head = &kretprobe_inst_table[hash];
@@ -1180,6 +1202,8 @@ void kprobe_flush_task(struct task_struct *tk)hlist_del (&ri->hlist);kfree (ri); } + +kprobe_busy_end (); }NOKPROBE_SYMBOL (kprobe_flush_task);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 96/191 e1000e: Do not wake up the system via WOL if device wakeup is disabled
In reply to Sasha LevinFrom: Chen Yu <[email protected]>
[ Upstream commit 6bf6be1127f7e6d4bf39f84d56854e944d045d74 ]
Currently the system will be woken up via WOL(Wake On LAN) even if the device wakeup ability has been disabled via sysfs:
cat /sys/devices/pci0000:00/0000:00:1f.6/power/wakeup disabled
The system should not be woken up if the user has explicitly disabled the wake up ability for this device.
This patch clears the WOL ability of this network device if the user has disabled the wake up ability in sysfs.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +10 -4
@@ -6315,11 +6315,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)struct net_device *netdev =pci_get_drvdata (pdev);struct e1000_adapter *adapter =netdev_priv (netdev);struct e1000_hw *hw = &adapter->hw; -u32 ctrl, ctrl_ext, rctl, status; -/* Runtime suspend should only enable wakeup for link changes */ -u32 wufc = runtime ?E1000_WUFC_LNKC : adapter->wol; +u32 ctrl, ctrl_ext, rctl, status, wufc;int retval =0 ; +/* Runtime suspend should only enable wakeup for link changes */ +if (runtime) + wufc =E1000_WUFC_LNKC ; +else if (device_may_wakeup (&pdev->dev)) + wufc = adapter->wol; +else + wufc =0 ; + status =er32 (STATUS );if (status &E1000_STATUS_LU ) wufc &= ~E1000_WUFC_LNKC ;
@@ -6377,7 +6383,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)e1000e_igp3_phy_powerdown_workaround_ich8lan (&adapter->hw); }else if ((hw->mac.type == e1000_pch_lpt) || (hw->mac.type == e1000_pch_spt)) { -if (!(wufc & (E1000_WUFC_EX |E1000_WUFC_MC |E1000_WUFC_BC ))) +if (wufc && !(wufc & (E1000_WUFC_EX |E1000_WUFC_MC |E1000_WUFC_BC )))/* ULP does not support wake from unicast, multicast * or broadcast. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 97/191 sched/rt, net: Use CONFIG_PREEMPTION.patch
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 2da2b32fd9346009e9acdb68c570ca8d3966aba7 ]
CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT. Both PREEMPT and PREEMPT_RT require the same functionality which today depends on CONFIG_PREEMPT.
Update the comment to use CONFIG_PREEMPTION.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -869,7 +869,7 @@ EXPORT_SYMBOL(dev_get_by_index);* * The use of raw_seqcount_begin() and cond_resched() before * retrying is required as we want to give the writers a chance -* to complete when CONFIG_PREEMPT is not set. +* to complete when CONFIG_PREEMPTION is not set. */ int netdev_get_name (struct net *net,char *name,int ifindex) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 98/191 net: core: device_rename: Use rwsem instead of a seqcount
In reply to Sasha LevinFrom: "Ahmed S. Darwish" <[email protected]>
[ Upstream commit 11d6011c2cf29f7c8181ebde6c8bc0c4d83adcd7 ]
Sequence counters write paths are critical sections that must never be preempted, and blocking, even for CONFIG_PREEMPTION=n, is not allowed.
Commit 5dbe7c178d3f ("net: fix kernel deadlock with interface rename and netdev name retrieval.") handled a deadlock, observed with CONFIG_PREEMPTION=n, where the devnet_rename seqcount read side was infinitely spinning: it got scheduled after the seqcount write side blocked inside its own critical section.
To fix that deadlock, among other issues, the commit added a cond_resched() inside the read side section. While this will get the non-preemptible kernel eventually unstuck, the seqcount reader is fully exhausting its slice just spinning -- until TIF_NEED_RESCHED is set.
The fix is also still broken: if the seqcount reader belongs to a real-time scheduling policy, it can spin forever and the kernel will livelock.
Disabling preemption over the seqcount write side critical section will not work: inside it are a number of GFP_KERNEL allocations and mutex locking through the drivers/base/ :: device_rename() call chain.
Quoted 1 line
From all the above, replace the seqcount with a rwsem.
--- net/core/dev.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-)
net/core/dev.c +18 -22
@@ -82,6 +82,7 @@#include <linux/slab.h> #include <linux/sched.h> #include <linux/mutex.h> +#include <linux/rwsem.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/socket.h>
@@ -189,7 +190,7 @@ static DEFINE_SPINLOCK(napi_hash_lock);static unsigned int napi_gen_id =NR_CPUS ; static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); -static seqcount_t devnet_rename_seq; +static DECLARE_RWSEM (devnet_rename_sem);static inline void dev_base_seq_inc (struct net *net) {
@@ -866,33 +867,28 @@ EXPORT_SYMBOL(dev_get_by_index);* @net: network namespace * @name: a pointer to the buffer where the name will be stored. * @ifindex: the ifindex of the interface to get the name from. -* -* The use of raw_seqcount_begin() and cond_resched() before -* retrying is required as we want to give the writers a chance -* to complete when CONFIG_PREEMPTION is not set. */ int netdev_get_name (struct net *net,char *name,int ifindex) {struct net_device *dev; -unsigned int seq; +int ret; -retry: - seq =raw_seqcount_begin (&devnet_rename_seq); +down_read (&devnet_rename_sem);rcu_read_lock (); + dev =dev_get_by_index_rcu (net, ifindex);if (!dev) { -rcu_read_unlock (); -return -ENODEV ; + ret = -ENODEV ; + goto out; }strcpy (name, dev->name); -rcu_read_unlock (); -if (read_seqcount_retry (&devnet_rename_seq, seq)) { -cond_resched (); - goto retry; - } -return 0 ; + ret =0 ; +out: +rcu_read_unlock (); +up_read (&devnet_rename_sem); +return ret; }/**
@@ -1157,10 +1153,10 @@ int dev_change_name(struct net_device *dev, const char *newname)if (dev->flags &IFF_UP )return -EBUSY ; -write_seqcount_begin (&devnet_rename_seq); +down_write (&devnet_rename_sem);if (strncmp (newname, dev->name,IFNAMSIZ ) ==0 ) { -write_seqcount_end (&devnet_rename_seq); +up_write (&devnet_rename_sem);return 0 ; }
@@ -1168,7 +1164,7 @@ int dev_change_name(struct net_device *dev, const char *newname) err =dev_get_valid_name (net, dev, newname);if (err <0 ) { -write_seqcount_end (&devnet_rename_seq); +up_write (&devnet_rename_sem);return err; }
@@ -1183,11 +1179,11 @@ int dev_change_name(struct net_device *dev, const char *newname)if (ret) {memcpy (dev->name, oldname,IFNAMSIZ ); dev->name_assign_type = old_assign_type; -write_seqcount_end (&devnet_rename_seq); +up_write (&devnet_rename_sem);return ret; } -write_seqcount_end (&devnet_rename_seq); +up_write (&devnet_rename_sem);netdev_adjacent_rename_links (dev, oldname);
@@ -1208,7 +1204,7 @@ int dev_change_name(struct net_device *dev, const char *newname)/* err >= 0 after dev_alloc_name() or stores the first errno */ if (err >=0 ) { err = ret; -write_seqcount_begin (&devnet_rename_seq); +down_write (&devnet_rename_sem);memcpy (dev->name, oldname,IFNAMSIZ );memcpy (oldname, newname,IFNAMSIZ ); dev->name_assign_type = old_assign_type;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 99/191 media: dvb_frontend: initialize variable s with FE_NONE instead of 0
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
commit 450694c3b9f47b826a002089c463b9454b4bbe42 upstream.
GIT_AUTHOR_NAME=Colin King
[email protected]
In a previous commit, we added FE_NONE as an unknown fe_status. Initialize variable s to FE_NONE instead of the more opaque value 0.
--- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvb_frontend.c +1 -1
@@ -458,7 +458,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wrastatic void dvb_frontend_swzigzag (struct dvb_frontend *fe) { -enum fe_status s =0 ; +enum fe_status s =FE_NONE ;int retval =0 ;struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 100/191 media: dvb/frontend.h: move out a private internal structure
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit f35afa4f60c868d7c7811ba747133acbf39410ac upstream
struct dtv_cmds_h is just an ancillary struct used by the dvb_frontend.c to internally store frontend commands.
It doesn't belong to the userspace header, nor it is used anywhere, except inside the DVB core. So, remove it from the header.
--- drivers/media/dvb-core/dvb_frontend.c | 11 +++++++++++ include/uapi/linux/dvb/frontend.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +11 -0
@@ -998,6 +998,17 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) .buffer = b \ } +struct dtv_cmds_h { +char *name;/* A display name for debugging purposes */ + +__u32 cmd;/* A unique ID */ + +/* Flags */ +__u32 set:1 ;/* Either a set or get property */ +__u32 buffer:1 ;/* Does this property use the buffer? */ +__u32 reserved:30 ;/* Align */ +}; +static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND +1 ] = {_DTV_CMD (DTV_TUNE ,1 ,0 ),_DTV_CMD (DTV_CLEAR ,1 ,0 ),
include/uapi/linux/dvb/frontend.h +0 -11
@@ -384,17 +384,6 @@ enum atscmh_rs_code_mode {#define NO_STREAM_ID_FILTER (~0U)#define LNA_AUTO (~0U) -struct dtv_cmds_h { -char *name;/* A display name for debugging purposes */ - -__u32 cmd;/* A unique ID */ - -/* Flags */ -__u32 set:1 ;/* Either a set or get property */ -__u32 buffer:1 ;/* Does this property use the buffer? */ -__u32 reserved:30 ;/* Align */ -}; -/** * Scale types for the quality parameters. * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 101/191 media: dvb/frontend.h: document the uAPI file
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 8220ead805b6bab4ade2839857a198e9708b07de upstream
Most of the stuff at the Digital TV frontend header file are documented only at the Documentation. However, a few kernel-doc markups are there, several of them with parsing issues.
Add the missing documentation, copying definitions from the Documentation when it applies, fixing some bugs.
Please notice that DVBv3 stuff that were deprecated weren't commented by purpose. Instead, they were clearly tagged as such.
This patch prepares to move part of the documentation from Documentation/ to kernel-doc comments.
--- include/uapi/linux/dvb/frontend.h | 580 +++++++++++++++++++++++++----- 1 file changed, 498 insertions(+), 82 deletions(-)
include/uapi/linux/dvb/frontend.h +498 -82
@@ -28,13 +28,46 @@#include <linux/types.h> -enum fe_type { -FE_QPSK , -FE_QAM , -FE_OFDM , -FE_ATSC -}; - +/** +* enum fe_caps - Frontend capabilities +* +* @FE_IS_STUPID: There's something wrong at the +* frontend, and it can't report its +* capabilities. +* @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral +* band inversion +* @FE_CAN_FEC_1_2: Supports FEC 1/2 +* @FE_CAN_FEC_2_3: Supports FEC 2/3 +* @FE_CAN_FEC_3_4: Supports FEC 3/4 +* @FE_CAN_FEC_4_5: Supports FEC 4/5 +* @FE_CAN_FEC_5_6: Supports FEC 5/6 +* @FE_CAN_FEC_6_7: Supports FEC 6/7 +* @FE_CAN_FEC_7_8: Supports FEC 7/8 +* @FE_CAN_FEC_8_9: Supports FEC 8/9 +* @FE_CAN_FEC_AUTO: Can auto-detect FEC +* @FE_CAN_QPSK: Supports QPSK modulation +* @FE_CAN_QAM_16: Supports 16-QAM modulation +* @FE_CAN_QAM_32: Supports 32-QAM modulation +* @FE_CAN_QAM_64: Supports 64-QAM modulation +* @FE_CAN_QAM_128: Supports 128-QAM modulation +* @FE_CAN_QAM_256: Supports 256-QAM modulation +* @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation +* @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode +* @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth +* @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval +* @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy +* @FE_CAN_8VSB: Supports 8-VSB modulation +* @FE_CAN_16VSB: Supporta 16-VSB modulation +* @FE_HAS_EXTENDED_CAPS: Unused +* @FE_CAN_MULTISTREAM: Supports multistream filtering +* @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation +* @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, +* e. g. DVB-S2, DVB-T2, DVB-C2 +* @FE_NEEDS_BENDING: Unused +* @FE_CAN_RECOVER: Can recover from a cable unplug +* automatically +* @FE_CAN_MUTE_TS: Can stop spurious TS data output +*/ enum fe_caps {FE_IS_STUPID =0 ,FE_CAN_INVERSION_AUTO =0x1 ,
@@ -60,15 +93,55 @@ enum fe_caps {FE_CAN_HIERARCHY_AUTO =0x100000 ,FE_CAN_8VSB =0x200000 ,FE_CAN_16VSB =0x400000 , -FE_HAS_EXTENDED_CAPS =0x800000 ,/* We need more bitspace for newer APIs, indicate this. */ -FE_CAN_MULTISTREAM =0x4000000 ,/* frontend supports multistream filtering */ -FE_CAN_TURBO_FEC =0x8000000 ,/* frontend supports "turbo fec modulation" */ -FE_CAN_2G_MODULATION =0x10000000 ,/* frontend supports "2nd generation modulation" (DVB-S2) */ -FE_NEEDS_BENDING =0x20000000 ,/* not supported anymore, don't use (frontend requires frequency bending) */ -FE_CAN_RECOVER =0x40000000 ,/* frontend can recover from a cable unplug automatically */ -FE_CAN_MUTE_TS =0x80000000 /* frontend can stop spurious TS data output */ +FE_HAS_EXTENDED_CAPS =0x800000 , +FE_CAN_MULTISTREAM =0x4000000 , +FE_CAN_TURBO_FEC =0x8000000 , +FE_CAN_2G_MODULATION =0x10000000 , +FE_NEEDS_BENDING =0x20000000 , +FE_CAN_RECOVER =0x40000000 , +FE_CAN_MUTE_TS =0x80000000 +}; + +/* +* DEPRECATED: Should be kept just due to backward compatibility. +*/ +enum fe_type { +FE_QPSK , +FE_QAM , +FE_OFDM , +FE_ATSC }; +/** +* struct dvb_frontend_info - Frontend properties and capabilities +* +* @name: Name of the frontend +* @type: **DEPRECATED**. +* Should not be used on modern programs, +* as a frontend may have more than one type. +* In order to get the support types of a given +* frontend, use :c:type:`DTV_ENUM_DELSYS` +* instead. +* @frequency_min: Minimal frequency supported by the frontend. +* @frequency_max: Minimal frequency supported by the frontend. +* @frequency_stepsize: All frequencies are multiple of this value. +* @frequency_tolerance: Frequency tolerance. +* @symbol_rate_min: Minimal symbol rate, in bauds +* (for Cable/Satellite systems). +* @symbol_rate_max: Maximal symbol rate, in bauds +* (for Cable/Satellite systems). +* @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm +* (for Cable/Satellite systems). +* @notifier_delay: **DEPRECATED**. Not used by any driver. +* @caps: Capabilities supported by the frontend, +* as specified in &enum fe_caps. +* +* .. note: +* +* #. The frequencies are specified in Hz for Terrestrial and Cable +* systems. +* #. The frequencies are specified in kHz for Satellite systems. +*/ struct dvb_frontend_info { char name[128]; enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */
@@ -78,53 +151,102 @@ struct dvb_frontend_info {__u32 frequency_tolerance;__u32 symbol_rate_min;__u32 symbol_rate_max; -__u32 symbol_rate_tolerance;/* ppm */ +__u32 symbol_rate_tolerance;__u32 notifier_delay;/* DEPRECATED */ enum fe_caps caps; }; -/** -* Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for -* the meaning of this struct... +* struct dvb_diseqc_master_cmd - DiSEqC master command +* +* @msg: +* DiSEqC message to be sent. It contains a 3 bytes header with: +* framing + address + command, and an optional argument +* of up to 3 bytes of data. +* @msg_len: +* Length of the DiSEqC message. Valid values are 3 to 6. +* +* Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for +* the possible messages that can be used. */ struct dvb_diseqc_master_cmd { -__u8 msg [6 ];/* { framing, address, command, data [3] } */ -__u8 msg_len;/* valid values are 3...6 */ +__u8 msg[6 ]; +__u8 msg_len; }; +/** +* struct dvb_diseqc_slave_reply - DiSEqC received data +* +* @msg: +* DiSEqC message buffer to store a message received via DiSEqC. +* It contains one byte header with: framing and +* an optional argument of up to 3 bytes of data. +* @msg_len: +* Length of the DiSEqC message. Valid values are 0 to 4, +* where 0 means no message. +* @timeout: +* Return from ioctl after timeout ms with errorcode when +* no message was received. +* +* Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for +* the possible messages that can be used. +*/ struct dvb_diseqc_slave_reply { -__u8 msg [4 ];/* { framing, data [3] } */ -__u8 msg_len;/* valid values are 0...4, 0 means no msg */ -int timeout;/* return from ioctl after timeout ms with */ -};/* errorcode when no message was received */ +__u8 msg[4 ]; +__u8 msg_len; +int timeout; +}; +/** +* enum fe_sec_voltage - DC Voltage used to feed the LNBf +* +* @SEC_VOLTAGE_13: Output 13V to the LNBf +* @SEC_VOLTAGE_18: Output 18V to the LNBf +* @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage +*/ enum fe_sec_voltage {SEC_VOLTAGE_13 ,SEC_VOLTAGE_18 ,SEC_VOLTAGE_OFF }; +/** +* enum fe_sec_tone_mode - Type of tone to be send to the LNBf. +* @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna. +* @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except +* if the ``FE_DISEQC_*`` ioctls are called). +*/ enum fe_sec_tone_mode {SEC_TONE_ON ,SEC_TONE_OFF }; +/** +* enum fe_sec_mini_cmd - Type of mini burst to be sent +* +* @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select +* satellite-A +* @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select +* satellite-B +*/ enum fe_sec_mini_cmd {SEC_MINI_A ,SEC_MINI_B };/** -* enum fe_status - enumerates the possible frontend status -* @FE_HAS_SIGNAL: found something above the noise level -* @FE_HAS_CARRIER: found a DVB signal -* @FE_HAS_VITERBI: FEC is stable -* @FE_HAS_SYNC: found sync bytes -* @FE_HAS_LOCK: everything's working -* @FE_TIMEDOUT: no lock within the last ~2 seconds -* @FE_REINIT: frontend was reinitialized, application is recommended -* to reset DiSEqC, tone and parameters +* enum fe_status - Enumerates the possible frontend status. +* @FE_NONE: The frontend doesn't have any kind of lock. +* That's the initial frontend status +* @FE_HAS_SIGNAL: Has found something above the noise level. +* @FE_HAS_CARRIER: Has found a DVB signal. +* @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). +* is stable. +* @FE_HAS_SYNC: Synchronization bytes was found. +* @FE_HAS_LOCK: DVB were locked and everything is working. +* @FE_TIMEDOUT: Fo lock within the last about 2 seconds. +* @FE_REINIT: Frontend was reinitialized, application is recommended +* to reset DiSEqC, tone and parameters. */ enum fe_status {FE_NONE =0x00 ,
@@ -137,12 +259,45 @@ enum fe_status { FE_REINIT = 0x40, }; +/** +* enum fe_spectral_inversion - Type of inversion band +* +* @INVERSION_OFF: Don't do spectral band inversion. +* @INVERSION_ON: Do spectral band inversion. +* @INVERSION_AUTO: Autodetect spectral band inversion. +* +* This parameter indicates if spectral inversion should be presumed or +* not. In the automatic setting (``INVERSION_AUTO``) the hardware will try +* to figure out the correct setting by itself. If the hardware doesn't +* support, the DVB core will try to lock at the carrier first with +* inversion off. If it fails, it will try to enable inversion. +*/ enum fe_spectral_inversion {INVERSION_OFF ,INVERSION_ON ,INVERSION_AUTO }; +/** +* enum fe_code_rate - Type of Forward Error Correction (FEC) +* +* +* @FEC_NONE: No Forward Error Correction Code +* @FEC_1_2: Forward Error Correction Code 1/2 +* @FEC_2_3: Forward Error Correction Code 2/3 +* @FEC_3_4: Forward Error Correction Code 3/4 +* @FEC_4_5: Forward Error Correction Code 4/5 +* @FEC_5_6: Forward Error Correction Code 5/6 +* @FEC_6_7: Forward Error Correction Code 6/7 +* @FEC_7_8: Forward Error Correction Code 7/8 +* @FEC_8_9: Forward Error Correction Code 8/9 +* @FEC_AUTO: Autodetect Error Correction Code +* @FEC_3_5: Forward Error Correction Code 3/5 +* @FEC_9_10: Forward Error Correction Code 9/10 +* @FEC_2_5: Forward Error Correction Code 2/5 +* +* Please note that not all FEC types are supported by a given standard. +*/ enum fe_code_rate {FEC_NONE =0 ,FEC_1_2 ,
@@ -159,6 +314,26 @@ enum fe_code_rate { FEC_2_5, }; +/** +* enum fe_modulation - Type of modulation/constellation +* @QPSK: QPSK modulation +* @QAM_16: 16-QAM modulation +* @QAM_32: 32-QAM modulation +* @QAM_64: 64-QAM modulation +* @QAM_128: 128-QAM modulation +* @QAM_256: 256-QAM modulation +* @QAM_AUTO: Autodetect QAM modulation +* @VSB_8: 8-VSB modulation +* @VSB_16: 16-VSB modulation +* @PSK_8: 8-PSK modulation +* @APSK_16: 16-APSK modulation +* @APSK_32: 32-APSK modulation +* @DQPSK: DQPSK modulation +* @QAM_4_NR: 4-QAM-NR modulation +* +* Please note that not all modulations are supported by a given standard. +* +*/ enum fe_modulation {QPSK ,QAM_16 ,
@@ -176,6 +351,32 @@ enum fe_modulation { QAM_4_NR, }; +/** +* enum fe_transmit_mode - Transmission mode +* +* @TRANSMISSION_MODE_AUTO: +* Autodetect transmission mode. The hardware will try to find the +* correct FFT-size (if capable) to fill in the missing parameters. +* @TRANSMISSION_MODE_1K: +* Transmission mode 1K +* @TRANSMISSION_MODE_2K: +* Transmission mode 2K +* @TRANSMISSION_MODE_8K: +* Transmission mode 8K +* @TRANSMISSION_MODE_4K: +* Transmission mode 4K +* @TRANSMISSION_MODE_16K: +* Transmission mode 16K +* @TRANSMISSION_MODE_32K: +* Transmission mode 32K +* @TRANSMISSION_MODE_C1: +* Single Carrier (C=1) transmission mode (DTMB only) +* @TRANSMISSION_MODE_C3780: +* Multi Carrier (C=3780) transmission mode (DTMB only) +* +* Please note that not all transmission modes are supported by a given +* standard. +*/ enum fe_transmit_mode {TRANSMISSION_MODE_2K ,TRANSMISSION_MODE_8K ,
@@ -188,6 +389,23 @@ enum fe_transmit_mode { TRANSMISSION_MODE_C3780, }; +/** +* enum fe_guard_interval - Guard interval +* +* @GUARD_INTERVAL_AUTO: Autodetect the guard interval +* @GUARD_INTERVAL_1_128: Guard interval 1/128 +* @GUARD_INTERVAL_1_32: Guard interval 1/32 +* @GUARD_INTERVAL_1_16: Guard interval 1/16 +* @GUARD_INTERVAL_1_8: Guard interval 1/8 +* @GUARD_INTERVAL_1_4: Guard interval 1/4 +* @GUARD_INTERVAL_19_128: Guard interval 19/128 +* @GUARD_INTERVAL_19_256: Guard interval 19/256 +* @GUARD_INTERVAL_PN420: PN length 420 (1/4) +* @GUARD_INTERVAL_PN595: PN length 595 (1/6) +* @GUARD_INTERVAL_PN945: PN length 945 (1/9) +* +* Please note that not all guard intervals are supported by a given standard. +*/ enum fe_guard_interval {GUARD_INTERVAL_1_32 ,GUARD_INTERVAL_1_16 ,
@@ -202,6 +420,16 @@ enum fe_guard_interval { GUARD_INTERVAL_PN945, }; +/** +* enum fe_hierarchy - Hierarchy +* @HIERARCHY_NONE: No hierarchy +* @HIERARCHY_AUTO: Autodetect hierarchy (if supported) +* @HIERARCHY_1: Hierarchy 1 +* @HIERARCHY_2: Hierarchy 2 +* @HIERARCHY_4: Hierarchy 4 +* +* Please note that not all hierarchy types are supported by a given standard. +*/ enum fe_hierarchy {HIERARCHY_NONE ,HIERARCHY_1 ,
@@ -210,6 +438,15 @@ enum fe_hierarchy {HIERARCHY_AUTO }; +/** +* enum fe_interleaving - Interleaving +* @INTERLEAVING_NONE: No interleaving. +* @INTERLEAVING_AUTO: Auto-detect interleaving. +* @INTERLEAVING_240: Interleaving of 240 symbols. +* @INTERLEAVING_720: Interleaving of 720 symbols. +* +* Please note that, currently, only DTMB uses it. +*/ enum fe_interleaving {INTERLEAVING_NONE ,INTERLEAVING_AUTO ,
@@ -217,7 +454,8 @@ enum fe_interleaving { INTERLEAVING_720, }; -/* S2API Commands */ +/* DVBv5 property Commands */ +#define DTV_UNDEFINED 0#define DTV_TUNE 1#define DTV_CLEAR 2
@@ -310,19 +548,79 @@ enum fe_interleaving {#define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT +/** +* enum fe_pilot - Type of pilot tone +* +* @PILOT_ON: Pilot tones enabled +* @PILOT_OFF: Pilot tones disabled +* @PILOT_AUTO: Autodetect pilot tones +*/ enum fe_pilot {PILOT_ON ,PILOT_OFF ,PILOT_AUTO , }; +/** +* enum fe_rolloff - Rolloff factor (also known as alpha) +* @ROLLOFF_35: Roloff factor: 35% +* @ROLLOFF_20: Roloff factor: 20% +* @ROLLOFF_25: Roloff factor: 25% +* @ROLLOFF_AUTO: Auto-detect the roloff factor. +* +* .. note: +* +* Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default. +*/ enum fe_rolloff { -ROLLOFF_35 ,/* Implied value in DVB-S, default for DVB-S2 */ +ROLLOFF_35 ,ROLLOFF_20 ,ROLLOFF_25 ,ROLLOFF_AUTO , }; +/** +* enum fe_delivery_system - Type of the delivery system +* +* @SYS_UNDEFINED: +* Undefined standard. Generally, indicates an error +* @SYS_DVBC_ANNEX_A: +* Cable TV: DVB-C following ITU-T J.83 Annex A spec +* @SYS_DVBC_ANNEX_B: +* Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) +* @SYS_DVBC_ANNEX_C: +* Cable TV: DVB-C following ITU-T J.83 Annex C spec +* @SYS_ISDBC: +* Cable TV: ISDB-C (no drivers yet) +* @SYS_DVBT: +* Terrestrial TV: DVB-T +* @SYS_DVBT2: +* Terrestrial TV: DVB-T2 +* @SYS_ISDBT: +* Terrestrial TV: ISDB-T +* @SYS_ATSC: +* Terrestrial TV: ATSC +* @SYS_ATSCMH: +* Terrestrial TV (mobile): ATSC-M/H +* @SYS_DTMB: +* Terrestrial TV: DTMB +* @SYS_DVBS: +* Satellite TV: DVB-S +* @SYS_DVBS2: +* Satellite TV: DVB-S2 +* @SYS_TURBO: +* Satellite TV: DVB-S Turbo +* @SYS_ISDBS: +* Satellite TV: ISDB-S +* @SYS_DAB: +* Digital audio: DAB (not fully supported) +* @SYS_DSS: +* Satellite TV: DSS (not fully supported) +* @SYS_CMMB: +* Terrestrial TV (mobile): CMMB (not fully supported) +* @SYS_DVBH: +* Terrestrial TV (mobile): DVB-H (standard deprecated) +*/ enum fe_delivery_system {SYS_UNDEFINED ,SYS_DVBC_ANNEX_A ,
@@ -345,35 +643,85 @@ enum fe_delivery_system { SYS_DVBC_ANNEX_C, }; -/* backward compatibility */ +/* backward compatibility definitions for delivery systems */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A -#define SYS_DMBTH SYS_DTMB/* DMB-TH is legacy name, use DTMB instead */ +#define SYS_DMBTH SYS_DTMB/* DMB-TH is legacy name, use DTMB */ -/* ATSC-MH */ +/* ATSC-MH specific parameters */ +/** +* enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional +* Code Block Mode. +* +* @ATSCMH_SCCC_BLK_SEP: +* Separate SCCC: the SCCC outer code mode shall be set independently +* for each Group Region (A, B, C, D) +* @ATSCMH_SCCC_BLK_COMB: +* Combined SCCC: all four Regions shall have the same SCCC outer +* code mode. +* @ATSCMH_SCCC_BLK_RES: +* Reserved. Shouldn't be used. +*/ enum atscmh_sccc_block_mode {ATSCMH_SCCC_BLK_SEP =0 ,ATSCMH_SCCC_BLK_COMB =1 ,ATSCMH_SCCC_BLK_RES =2 , }; +/** +* enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional +* Code Rate. +* +* @ATSCMH_SCCC_CODE_HLF: +* The outer code rate of a SCCC Block is 1/2 rate. +* @ATSCMH_SCCC_CODE_QTR: +* The outer code rate of a SCCC Block is 1/4 rate. +* @ATSCMH_SCCC_CODE_RES: +* Reserved. Should not be used. +*/ enum atscmh_sccc_code_mode {ATSCMH_SCCC_CODE_HLF =0 ,ATSCMH_SCCC_CODE_QTR =1 ,ATSCMH_SCCC_CODE_RES =2 , }; +/** +* enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble. +* +* @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble. +* @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble. +*/ enum atscmh_rs_frame_ensemble {ATSCMH_RSFRAME_ENS_PRI =0 ,ATSCMH_RSFRAME_ENS_SEC =1 , }; +/** +* enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode. +* +* @ATSCMH_RSFRAME_PRI_ONLY: +* Single Frame: There is only a primary RS Frame for all Group +* Regions. +* @ATSCMH_RSFRAME_PRI_SEC: +* Dual Frame: There are two separate RS Frames: Primary RS Frame for +* Group Region A and B and Secondary RS Frame for Group Region C and +* D. +* @ATSCMH_RSFRAME_RES: +* Reserved. Shouldn't be used. +*/ enum atscmh_rs_frame_mode {ATSCMH_RSFRAME_PRI_ONLY =0 ,ATSCMH_RSFRAME_PRI_SEC =1 ,ATSCMH_RSFRAME_RES =2 , }; +/** +* enum atscmh_rs_code_mode +* @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). +* @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). +* @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). +* @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used. +*/ enum atscmh_rs_code_mode {ATSCMH_RSCODE_211_187 =0 ,ATSCMH_RSCODE_223_187 =1 ,
@@ -385,16 +733,17 @@ enum atscmh_rs_code_mode {#define LNA_AUTO (~0U)/** -* Scale types for the quality parameters. +* enum fecap_scale_params - scale types for the quality parameters. +* * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That * could indicate a temporary or a permanent * condition. * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically -* used on signal measures. +* used on signal measures. * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, -* ranging from 0 (0%) to 0xffff (100%). +* ranging from 0 (0%) to 0xffff (100%). * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like -* bit error, block error, lapsed time. +* bit error, block error, lapsed time. */ enum fecap_scale_params {FE_SCALE_NOT_AVAILABLE =0 ,
@@ -406,24 +755,38 @@ enum fecap_scale_params {/** * struct dtv_stats - Used for reading a DTV status property * -* @value: value of the measure. Should range from 0 to 0xffff; * @scale: Filled with enum fecap_scale_params - the scale * in usage for that parameter * +* The ``{unnamed_union}`` may have either one of the values below: +* +* %svalue +* integer value of the measure, for %FE_SCALE_DECIBEL, +* used for dB measures. The unit is 0.001 dB. +* +* %uvalue +* unsigned integer value of the measure, used when @scale is +* either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER. +* * For most delivery systems, this will return a single value for each * parameter. +* * It should be noticed, however, that new OFDM delivery systems like * ISDB can use different modulation types for each group of carriers. * On such standards, up to 8 groups of statistics can be provided, one * for each carrier group (called "layer" on ISDB). +* * In order to be consistent with other delivery systems, the first * value refers to the entire set of carriers ("global"). -* dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when +* +* @scale should use the value %FE_SCALE_NOT_AVAILABLE when * the value for the entire group of carriers or from one specific layer * is not provided by the hardware. -* st.len should be filled with the latest filled status + 1. * -* In other words, for ISDB, those values should be filled like: +* @len should be filled with the latest filled status + 1. +* +* In other words, for ISDB, those values should be filled like:: +* * u.st.stat.svalue[0] = global statistics; * u.st.stat.scale[0] = FE_SCALE_DECIBEL; * u.st.stat.value[1] = layer A statistics;
@@ -445,11 +808,39 @@ struct dtv_stats {#define MAX_DTV_STATS 4 +/** +* struct dtv_fe_stats - store Digital TV frontend statistics +* +* @len: length of the statistics - if zero, stats is disabled. +* @stat: array with digital TV statistics. +* +* On most standards, @len can either be 0 or 1. However, for ISDB, each +* layer is modulated in separate. So, each layer may have its own set +* of statistics. If so, stat[0] carries on a global value for the property. +* Indexes 1 to 3 means layer A to B. +*/ struct dtv_fe_stats {__u8 len;struct dtv_stats stat[MAX_DTV_STATS ]; } __attribute__ ((packed)); +/** +* struct dtv_property - store one of frontend command and its value +* +* @cmd: Digital TV command. +* @reserved: Not used. +* @u: Union with the values for the command. +* @result: Result of the command set (currently unused). +* +* The @u union may have either one of the values below: +* +* %data +* an unsigned 32-bits number. +* %st +* a &struct dtv_fe_stats array of statistics. +* %buffer +* a buffer of up to 32 characters (currently unused). +*/ struct dtv_property {__u32 cmd;__u32 reserved[3 ];
@@ -469,17 +860,70 @@ struct dtv_property {/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 +/** +* struct dtv_properties - a set of command/value pairs. +* +* @num: amount of commands stored at the struct. +* @props: a pointer to &struct dtv_property. +*/ struct dtv_properties {__u32 num;struct dtv_property *props; }; +/* +* When set, this flag will disable any zigzagging or other "normal" tuning +* behavior. Additionally, there will be no automatic monitoring of the lock +* status, and hence no frontend events will be generated. If a frontend device +* is closed, this flag will be automatically turned off when the device is +* reopened read-write. +*/ +#define FE_TUNE_MODE_ONESHOT 0x01 + +/* Digital TV Frontend API calls */ + +#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) + +#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) +#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) +#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) +#define FE_DISEQC_SEND_BURST _IO('o', 65)/* fe_sec_mini_cmd_t */ + +#define FE_SET_TONE _IO('o', 66)/* fe_sec_tone_mode_t */ +#define FE_SET_VOLTAGE _IO('o', 67)/* fe_sec_voltage_t */ +#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)/* int */ + +#define FE_READ_STATUS _IOR('o', 69, fe_status_t) +#define FE_READ_BER _IOR('o', 70, __u32) +#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) +#define FE_READ_SNR _IOR('o', 72, __u16) +#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) + +#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81)/* unsigned int */ +#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) + +#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80)/* unsigned int */ + +#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) +#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) +#if defined(__DVB_CORE__) || !defined (__KERNEL__)/* -* DEPRECATED: The DVBv3 ioctls, structs and enums should not be used on -* newer programs, as it doesn't support the second generation of digital -* TV standards, nor supports newer delivery systems. +* DEPRECATED: Everything below is deprecated in favor of DVBv5 API +* +* The DVBv3 only ioctls, structs and enums should not be used on +* newer programs, as it doesn't support the second generation of +* digital TV standards, nor supports newer delivery systems. +* They also don't support modern frontends with usually support multiple +* delivery systems. +* +* Drivers shouldn't use them. +* +* New applications should use DVBv5 delivery system instead +*/ + +/* */ enum fe_bandwidth {
@@ -492,7 +936,7 @@ enum fe_bandwidth { BANDWIDTH_1_712_MHZ, }; -/* This is needed for legacy userspace support */ +/* This is kept for legacy userspace support */ typedef enum fe_sec_voltage fe_sec_voltage_t ;typedef enum fe_caps fe_caps_t ;typedef enum fe_type fe_type_t ;
@@ -510,6 +954,8 @@ typedef enum fe_pilot fe_pilot_t;typedef enum fe_rolloff fe_rolloff_t ;typedef enum fe_delivery_system fe_delivery_system_t ; +/* DVBv3 structs */ +struct dvb_qpsk_parameters {__u32 symbol_rate;/* symbol rate in Symbols per second */ fe_code_rate_t fec_inner;/* forward error correction (see above) */
@@ -551,42 +997,12 @@ struct dvb_frontend_event {fe_status_t status;struct dvb_frontend_parameters parameters; }; -#endif - -#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) -#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) - -/** -* When set, this flag will disable any zigzagging or other "normal" tuning -* behaviour. Additionally, there will be no automatic monitoring of the lock -* status, and hence no frontend events will be generated. If a frontend device -* is closed, this flag will be automatically turned off when the device is -* reopened read-write. -*/ -#define FE_TUNE_MODE_ONESHOT 0x01 -#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) - -#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) -#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) -#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) -#define FE_DISEQC_SEND_BURST _IO('o', 65)/* fe_sec_mini_cmd_t */ - -#define FE_SET_TONE _IO('o', 66)/* fe_sec_tone_mode_t */ -#define FE_SET_VOLTAGE _IO('o', 67)/* fe_sec_voltage_t */ -#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)/* int */ - -#define FE_READ_STATUS _IOR('o', 69, fe_status_t) -#define FE_READ_BER _IOR('o', 70, __u32) -#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) -#define FE_READ_SNR _IOR('o', 72, __u16) -#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) +/* DVBv3 API calls */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) -#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81)/* unsigned int */ -#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) -#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80)/* unsigned int */ +#endif #endif /*_DVBFRONTEND_H_*/
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 102/191 media: dvb_frontend: get rid of get_property() callback
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 8f8a19fcc1a89b83d0ab6d7cf2bcdd272dbd4334 upstream
Only lg2160 implement gets_property, but there's no need for that, as no other driver calls this callback, as get_frontend() does the same, and set_frontend() also calls lg2160 get_frontend().
So, get rid of it.
--- drivers/media/dvb-core/dvb_frontend.c | 9 +-------- drivers/media/dvb-core/dvb_frontend.h | 3 --- drivers/media/dvb-frontends/lg2160.c | 14 -------------- 3 files changed, 1 insertion(+), 25 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +1 -8
@@ -1306,7 +1306,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe,struct dtv_property *tvp, struct file *file) { - int r, ncaps; + int ncaps;switch (tvp->cmd) {case DTV_ENUM_DELSYS :
@@ -1517,13 +1517,6 @@ static int dtv_property_process_get(struct dvb_frontend *fe,return -EINVAL ; } -/* Allow the frontend to override outgoing properties */ -if (fe->ops.get_property) { - r = fe->ops.get_property (fe, tvp); -if (r <0 ) -return r; - } -dtv_property_dump (fe, false, tvp);return 0 ;
drivers/media/dvb-core/dvb_frontend.h +0 -3
@@ -399,8 +399,6 @@ struct dtv_frontend_properties;* @analog_ops: pointer to struct analog_demod_ops * @set_property: callback function to allow the frontend to validade * incoming properties. Should not be used on new drivers. -* @get_property: callback function to allow the frontend to override -* outcoming properties. Should not be used on new drivers. */ struct dvb_frontend_ops {
@@ -463,7 +461,6 @@ struct dvb_frontend_ops {struct analog_demod_ops analog_ops;int (*set_property)(struct dvb_frontend * fe,struct dtv_property * tvp); -int (*get_property)(struct dvb_frontend * fe,struct dtv_property * tvp); };#ifdef __DVB_CORE__
drivers/media/dvb-frontends/lg2160.c +0 -14
@@ -1052,16 +1052,6 @@ static int lg216x_get_frontend(struct dvb_frontend *fe,return ret; } -static int lg216x_get_property (struct dvb_frontend *fe, -struct dtv_property *tvp) -{ -struct dtv_frontend_properties *c = &fe->dtv_property_cache; - -return (DTV_ATSCMH_FIC_VER == tvp->cmd) ? -lg216x_get_frontend (fe, c) :0 ; -} - -static int lg2160_set_frontend (struct dvb_frontend *fe) {struct lg216x_state *state = fe->demodulator_priv;
@@ -1372,8 +1362,6 @@ static struct dvb_frontend_ops lg2160_ops = { .init = lg216x_init, .sleep = lg216x_sleep, #endif - .get_property = lg216x_get_property, - .set_frontend = lg2160_set_frontend, .get_frontend = lg216x_get_frontend, .get_tune_settings = lg216x_get_tune_settings,
@@ -1400,8 +1388,6 @@ static struct dvb_frontend_ops lg2161_ops = { .init = lg216x_init, .sleep = lg216x_sleep, #endif - .get_property = lg216x_get_property, - .set_frontend = lg2160_set_frontend, .get_frontend = lg216x_get_frontend, .get_tune_settings = lg216x_get_tune_settings,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 103/191 media: stv0288: get rid of set_property boilerplate
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 473e4b4c1cf3046fc6b3437be9a9f3c89c2e61ef upstream
This driver doesn't implement support for set_property(). Yet, it implements a boilerplate for it. Get rid of it.
--- drivers/media/dvb-frontends/stv0288.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/dvb-frontends/stv0288.c +0 -7
@@ -447,12 +447,6 @@ static int stv0288_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)return 0 ; } -static int stv0288_set_property (struct dvb_frontend *fe,struct dtv_property *p) -{ -dprintk ("%s(..)\n" , __func__); -return 0 ; -} -static int stv0288_set_frontend (struct dvb_frontend *fe) {struct stv0288_state *state = fe->demodulator_priv;
@@ -568,7 +562,6 @@ static struct dvb_frontend_ops stv0288_ops = { .set_tone = stv0288_set_tone, .set_voltage = stv0288_set_voltage, - .set_property = stv0288_set_property, .set_frontend = stv0288_set_frontend, };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 104/191 media: stv6110: get rid of a srate dead code
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 282996925b4d78f9795d176f7fb409281c98d56d upstream
The stv6110 has a weird code that checks if get_property and set_property ioctls are defined. If they're, it initializes a "srate" var from properties cache. Otherwise, it sets to 15MBaud, with won't make any sense.
Thankfully, it seems that someone else discovered the issue in the past, as "srate" is currently not used anywhere!
So, get rid of that really weird dead code logic.
--- drivers/media/dvb-frontends/stv6110.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/media/dvb-frontends/stv6110.c +0 -9
@@ -263,11 +263,9 @@ static int stv6110_get_frequency(struct dvb_frontend *fe, u32 *frequency)static int stv6110_set_frequency (struct dvb_frontend *fe,u32 frequency) {struct stv6110_priv *priv = fe->tuner_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;u8 ret =0x04 ;u32 divider, ref, p, presc, i, result_freq, vco_freq;s32 p_calc, p_calc_opt =1000 , r_div, r_div_opt =0 , p_val; -s32 srate;dprintk ("%s, freq=%d kHz, mclk=%d Hz\n" , __func__, frequency, priv->mclk);
@@ -278,13 +276,6 @@ static int stv6110_set_frequency(struct dvb_frontend *fe, u32 frequency) ((((priv->mclk /1000000 ) -16 ) &0x1f ) <<3 );/* BB_GAIN = db/2 */ -if (fe->ops.set_property && fe->ops.get_property) { - srate = c->symbol_rate; -dprintk ("%s: Get Frontend parameters: srate=%d\n" , - __func__, srate); - }else - srate =15000000 ; - priv->regs[RSTV6110_CTRL2 ] &= ~0x0f ; priv->regs[RSTV6110_CTRL2 ] |= (priv->gain &0x0f );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 105/191 media: friio-fe: get rid of set_property()
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit b2c41ca9632e686e79f6c9db9c5f75666d37926e upstream
This callback is not actually doing anything but making it to return an error depending on the DTV frontend command. Well, that could break userspace for no good reason, and, if needed, should be implemented, instead, at set_frontend() callback.
So, get rid of it.
--- drivers/media/usb/dvb-usb/friio-fe.c | 24 ------------------------ 1 file changed, 24 deletions(-)
drivers/media/usb/dvb-usb/friio-fe.c +0 -24
@@ -261,28 +261,6 @@ static int jdvbt90502_read_signal_strength(struct dvb_frontend *fe,return 0 ; } - -/* filter out un-supported properties to notify users */ -static int jdvbt90502_set_property (struct dvb_frontend *fe, -struct dtv_property *tvp) -{ -int r =0 ; - -switch (tvp->cmd) { -case DTV_DELIVERY_SYSTEM : -if (tvp->u.data !=SYS_ISDBT ) - r = -EINVAL ; -break ; -case DTV_CLEAR : -case DTV_TUNE : -case DTV_FREQUENCY : -break ; -default : - r = -EINVAL ; - } -return r; -} -static int jdvbt90502_set_frontend (struct dvb_frontend *fe) {struct dtv_frontend_properties *p = &fe->dtv_property_cache;
@@ -457,8 +435,6 @@ static struct dvb_frontend_ops jdvbt90502_ops = { .init = jdvbt90502_init, .write = _jdvbt90502_write, - .set_property = jdvbt90502_set_property, - .set_frontend = jdvbt90502_set_frontend, .read_status = jdvbt90502_read_status,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 106/191 media: dvb_frontend: get rid of set_property() callback
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 6680e73b5226114992acfc11f9cf5730f706fb01 upstream
Now that all clients of set_property() were removed, get rid of this callback.
--- drivers/media/dvb-core/dvb_frontend.c | 7 ------- drivers/media/dvb-core/dvb_frontend.h | 5 ----- 2 files changed, 12 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +0 -7
@@ -1751,13 +1751,6 @@ static int dtv_property_process_set(struct dvb_frontend *fe,int r =0 ;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -/* Allow the frontend to validate incoming properties */ -if (fe->ops.set_property) { - r = fe->ops.set_property (fe, tvp); -if (r <0 ) -return r; - } -dtv_property_dump (fe, true, tvp);switch (tvp->cmd) {
drivers/media/dvb-core/dvb_frontend.h +0 -5
@@ -397,11 +397,8 @@ struct dtv_frontend_properties;* @search: callback function used on some custom algo search algos. * @tuner_ops: pointer to struct dvb_tuner_ops * @analog_ops: pointer to struct analog_demod_ops -* @set_property: callback function to allow the frontend to validade -* incoming properties. Should not be used on new drivers. */ struct dvb_frontend_ops { -struct dvb_frontend_info info;u8 delsys[MAX_DELSYS ];
@@ -459,8 +456,6 @@ struct dvb_frontend_ops {struct dvb_tuner_ops tuner_ops;struct analog_demod_ops analog_ops; - -int (*set_property)(struct dvb_frontend * fe,struct dtv_property * tvp); };#ifdef __DVB_CORE__
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 107/191 media: dvb_frontend: cleanup dvb_frontend_ioctl_properties()
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 2b5df42b8dec69fb926a242007fd462343db4408 upstream
Use a switch() on this function, just like on other ioctl handlers and handle parameters inside each part of the switch.
That makes it easier to integrate with the already existing ioctl handler function.
--- drivers/media/dvb-core/dvb_frontend.c | 83 ++++++++++++++++----------- 1 file changed, 51 insertions(+), 32 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +51 -32
@@ -1956,21 +1956,25 @@ static int dvb_frontend_ioctl_properties(struct file *file,struct dvb_frontend *fe = dvbdev->priv;struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int err =0 ; - -struct dtv_properties *tvps = parg; -struct dtv_property *tvp =NULL ; -int i; +int err, i;dev_dbg (fe->dvb->device,"%s:\n" , __func__); -if (cmd ==FE_SET_PROPERTY ) { -dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , __func__, tvps->num); -dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , __func__, tvps->props); +switch (cmd) { +case FE_SET_PROPERTY : { +struct dtv_properties *tvps = parg; +struct dtv_property *tvp =NULL ; + +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , + __func__, tvps->num); +dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , + __func__, tvps->props); -/* Put an arbitrary limit on the number of messages that can -* be sent at once */ -if ((tvps->num ==0 ) || (tvps->num >DTV_IOCTL_MAX_MSGS )) +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS ))return -EINVAL ; tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp));
@@ -1979,23 +1983,34 @@ static int dvb_frontend_ioctl_properties(struct file *file,for (i =0 ; i < tvps->num; i++) { err =dtv_property_process_set (fe, tvp + i, file); -if (err <0 ) - goto out; +if (err <0 ) { +kfree (tvp); +return err; + } (tvp + i)->result = err; }if (c->state ==DTV_TUNE )dev_dbg (fe->dvb->device,"%s: Property cache is full, tuning\n" , __func__); - }else if (cmd ==FE_GET_PROPERTY ) { +kfree (tvp); +break ; + } +case FE_GET_PROPERTY : { +struct dtv_properties *tvps = parg; +struct dtv_property *tvp =NULL ;struct dtv_frontend_properties getp = fe->dtv_property_cache; -dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , __func__, tvps->num); -dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , __func__, tvps->props); +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , + __func__, tvps->num); +dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , + __func__, tvps->props); -/* Put an arbitrary limit on the number of messages that can -* be sent at once */ -if ((tvps->num ==0 ) || (tvps->num >DTV_IOCTL_MAX_MSGS )) +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS ))return -EINVAL ; tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp));
@@ -2010,28 +2025,32 @@ static int dvb_frontend_ioctl_properties(struct file *file,*/ if (fepriv->state !=FESTATE_IDLE ) { err =dtv_get_frontend (fe, &getp,NULL ); -if (err <0 ) - goto out; +if (err <0 ) { +kfree (tvp); +return err; + } }for (i =0 ; i < tvps->num; i++) { err =dtv_property_process_get (fe, &getp, tvp + i, file); -if (err <0 ) - goto out; +if (err <0 ) { +kfree (tvp); +return err; + } (tvp + i)->result = err; }if (copy_to_user ((void __user *)tvps->props, tvp, tvps->num *sizeof (struct dtv_property ))) { - err = -EFAULT ; - goto out; +kfree (tvp); +return -EFAULT ; } - - }else - err = -EOPNOTSUPP ; - -out: -kfree (tvp); -return err; +kfree (tvp); +break ; + } +default : +return -ENOTSUPP ; + }/* switch */ +return 0 ; }static int dtv_set_frontend (struct dvb_frontend *fe)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 108/191 media: dvb_frontend: cleanup ioctl handling logic
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit d73dcf0cdb95a47f7e4e991ab63dd30f6eb67b4e upstream
Currently, there are two handlers for ioctls:
- dvb_frontend_ioctl_properties()
- dvb_frontend_ioctl_legacy()
Despite their names, both handles non-legacy DVB ioctls.
Besides that, there's no reason why to not handle all ioctls on a single handler function.
So, merge them into a single function (dvb_frontend_handle_ioctl) and reorganize the ioctl's to indicate what's the current DVB API and what's deprecated.
Despite the big diff, the handling logic for each ioctl is the same as before.
--- drivers/media/dvb-core/dvb_frontend.c | 328 +++++++++++++------------- 1 file changed, 158 insertions(+), 170 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +158 -170
@@ -1296,10 +1296,8 @@ static int dtv_get_frontend(struct dvb_frontend *fe,return 0 ; } -static int dvb_frontend_ioctl_legacy (struct file *file, -unsigned int cmd,void *parg); -static int dvb_frontend_ioctl_properties (struct file *file, -unsigned int cmd,void *parg); +static int dvb_frontend_handle_ioctl (struct file *file, +unsigned int cmd,void *parg); static int dtv_property_process_get(struct dvb_frontend *fe, const struct dtv_frontend_properties *c,
@@ -1801,12 +1799,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe,break ;case DTV_VOLTAGE : c->voltage = tvp->u.data; - r =dvb_frontend_ioctl_legacy (file,FE_SET_VOLTAGE , + r =dvb_frontend_handle_ioctl (file,FE_SET_VOLTAGE , (void *)c->voltage);break ;case DTV_TONE : c->sectone = tvp->u.data; - r =dvb_frontend_ioctl_legacy (file,FE_SET_TONE , + r =dvb_frontend_handle_ioctl (file,FE_SET_TONE , (void *)c->sectone);break ;case DTV_CODE_RATE_HP :
@@ -1913,14 +1911,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe,return r; } -static int dvb_frontend_ioctl (struct file *file, -unsigned int cmd,void *parg) +static int dvb_frontend_ioctl (struct file *file,unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;struct dvb_frontend *fe = dvbdev->priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct dvb_frontend_private *fepriv = fe->frontend_priv; -int err = -EOPNOTSUPP ; +int err;dev_dbg (fe->dvb->device,"%s: (%d)\n" , __func__,_IOC_NR (cmd));if (down_interruptible (&fepriv->sem))
@@ -1938,121 +1935,13 @@ static int dvb_frontend_ioctl(struct file *file,return -EPERM ; } -if ((cmd ==FE_SET_PROPERTY ) || (cmd ==FE_GET_PROPERTY )) - err =dvb_frontend_ioctl_properties (file, cmd, parg); -else { - c->state =DTV_UNDEFINED ; - err =dvb_frontend_ioctl_legacy (file, cmd, parg); - } + c->state =DTV_UNDEFINED ; + err =dvb_frontend_handle_ioctl (file, cmd, parg);up (&fepriv->sem);return err; } -static int dvb_frontend_ioctl_properties (struct file *file, -unsigned int cmd,void *parg) -{ -struct dvb_device *dvbdev = file->private_data; -struct dvb_frontend *fe = dvbdev->priv; -struct dvb_frontend_private *fepriv = fe->frontend_priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int err, i; - -dev_dbg (fe->dvb->device,"%s:\n" , __func__); - -switch (cmd) { -case FE_SET_PROPERTY : { -struct dtv_properties *tvps = parg; -struct dtv_property *tvp =NULL ; - -dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , - __func__, tvps->num); -dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , - __func__, tvps->props); - -/* -* Put an arbitrary limit on the number of messages that can -* be sent at once -*/ -if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) -return -EINVAL ; - - tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp)); -if (IS_ERR (tvp)) -return PTR_ERR (tvp); - -for (i =0 ; i < tvps->num; i++) { - err =dtv_property_process_set (fe, tvp + i, file); -if (err <0 ) { -kfree (tvp); -return err; - } - (tvp + i)->result = err; - } - -if (c->state ==DTV_TUNE ) -dev_dbg (fe->dvb->device,"%s: Property cache is full, tuning\n" , __func__); - -kfree (tvp); -break ; - } -case FE_GET_PROPERTY : { -struct dtv_properties *tvps = parg; -struct dtv_property *tvp =NULL ; -struct dtv_frontend_properties getp = fe->dtv_property_cache; - -dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , - __func__, tvps->num); -dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , - __func__, tvps->props); - -/* -* Put an arbitrary limit on the number of messages that can -* be sent at once -*/ -if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) -return -EINVAL ; - - tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp)); -if (IS_ERR (tvp)) -return PTR_ERR (tvp); - -/* -* Let's use our own copy of property cache, in order to -* avoid mangling with DTV zigzag logic, as drivers might -* return crap, if they don't check if the data is available -* before updating the properties cache. -*/ -if (fepriv->state !=FESTATE_IDLE ) { - err =dtv_get_frontend (fe, &getp,NULL ); -if (err <0 ) { -kfree (tvp); -return err; - } - } -for (i =0 ; i < tvps->num; i++) { - err =dtv_property_process_get (fe, &getp, tvp + i, file); -if (err <0 ) { -kfree (tvp); -return err; - } - (tvp + i)->result = err; - } - -if (copy_to_user ((void __user *)tvps->props, tvp, - tvps->num *sizeof (struct dtv_property ))) { -kfree (tvp); -return -EFAULT ; - } -kfree (tvp); -break ; - } -default : -return -ENOTSUPP ; - }/* switch */ -return 0 ; -} -static int dtv_set_frontend (struct dvb_frontend *fe) {struct dvb_frontend_private *fepriv = fe->frontend_priv;
@@ -2190,16 +2079,105 @@ static int dtv_set_frontend(struct dvb_frontend *fe) } -static int dvb_frontend_ioctl_legacy (struct file *file, -unsigned int cmd,void *parg) +static int dvb_frontend_handle_ioctl (struct file *file, +unsigned int cmd,void *parg) {struct dvb_device *dvbdev = file->private_data;struct dvb_frontend *fe = dvbdev->priv;struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int err = -EOPNOTSUPP ; +int i, err; + +dev_dbg (fe->dvb->device,"%s:\n" , __func__); + +switch (cmd) { +case FE_SET_PROPERTY : { +struct dtv_properties *tvps = parg; +struct dtv_property *tvp =NULL ; + +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , + __func__, tvps->num); +dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , + __func__, tvps->props); + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) +return -EINVAL ; + + tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp)); +if (IS_ERR (tvp)) +return PTR_ERR (tvp); + +for (i =0 ; i < tvps->num; i++) { + err =dtv_property_process_set (fe, tvp + i, file); +if (err <0 ) { +kfree (tvp); +return err; + } + (tvp + i)->result = err; + } + +if (c->state ==DTV_TUNE ) +dev_dbg (fe->dvb->device,"%s: Property cache is full, tuning\n" , __func__); + +kfree (tvp); +break ; + } +case FE_GET_PROPERTY : { +struct dtv_properties *tvps = parg; +struct dtv_property *tvp =NULL ; +struct dtv_frontend_properties getp = fe->dtv_property_cache; + +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , + __func__, tvps->num); +dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , + __func__, tvps->props); + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) +return -EINVAL ; + + tvp =memdup_user (tvps->props, tvps->num *sizeof (*tvp)); +if (IS_ERR (tvp)) +return PTR_ERR (tvp); + +/* +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. +*/ +if (fepriv->state !=FESTATE_IDLE ) { + err =dtv_get_frontend (fe, &getp,NULL ); +if (err <0 ) { +kfree (tvp); +return err; + } + } +for (i =0 ; i < tvps->num; i++) { + err =dtv_property_process_get (fe, &getp, tvp + i, file); +if (err <0 ) { +kfree (tvp); +return err; + } + (tvp + i)->result = err; + } + +if (copy_to_user ((void __user *)tvps->props, tvp, + tvps->num *sizeof (struct dtv_property ))) { +kfree (tvp); +return -EFAULT ; + } +kfree (tvp); +break ; + } -switch (cmd) {case FE_GET_INFO : {struct dvb_frontend_info * info = parg;
@@ -2263,42 +2241,6 @@ static int dvb_frontend_ioctl_legacy(struct file *file,break ; } -case FE_READ_BER : -if (fe->ops.read_ber) { -if (fepriv->thread) - err = fe->ops.read_ber (fe, (__u32 *) parg); -else - err = -EAGAIN ; - } -break ; - -case FE_READ_SIGNAL_STRENGTH : -if (fe->ops.read_signal_strength) { -if (fepriv->thread) - err = fe->ops.read_signal_strength (fe, (__u16 *) parg); -else - err = -EAGAIN ; - } -break ; - -case FE_READ_SNR : -if (fe->ops.read_snr) { -if (fepriv->thread) - err = fe->ops.read_snr (fe, (__u16 *) parg); -else - err = -EAGAIN ; - } -break ; - -case FE_READ_UNCORRECTED_BLOCKS : -if (fe->ops.read_ucblocks) { -if (fepriv->thread) - err = fe->ops.read_ucblocks (fe, (__u32 *) parg); -else - err = -EAGAIN ; - } -break ; -case FE_DISEQC_RESET_OVERLOAD :if (fe->ops.diseqc_reset_overload) { err = fe->ops.diseqc_reset_overload (fe);
@@ -2350,6 +2292,23 @@ static int dvb_frontend_ioctl_legacy(struct file *file, }break ; +case FE_DISEQC_RECV_SLAVE_REPLY : +if (fe->ops.diseqc_recv_slave_reply) + err = fe->ops.diseqc_recv_slave_reply (fe, (struct dvb_diseqc_slave_reply *) parg); +break ; + +case FE_ENABLE_HIGH_LNB_VOLTAGE : +if (fe->ops.enable_high_lnb_voltage) + err = fe->ops.enable_high_lnb_voltage (fe, (long ) parg); +break ; + +case FE_SET_FRONTEND_TUNE_MODE : + fepriv->tune_mode_flags = (unsigned long ) parg; + err =0 ; +break ; + +/* DEPRECATED dish control ioctls */ +case FE_DISHNETWORK_SEND_LEGACY_CMD :if (fe->ops.dishnetwork_send_legacy_command) { err = fe->ops.dishnetwork_send_legacy_command(fe,
@@ -2414,16 +2373,46 @@ static int dvb_frontend_ioctl_legacy(struct file *file, }break ; -case FE_DISEQC_RECV_SLAVE_REPLY : -if (fe->ops.diseqc_recv_slave_reply) - err = fe->ops.diseqc_recv_slave_reply (fe, (struct dvb_diseqc_slave_reply *) parg); +/* DEPRECATED statistics ioctls */ + +case FE_READ_BER : +if (fe->ops.read_ber) { +if (fepriv->thread) + err = fe->ops.read_ber (fe, (__u32 *) parg); +else + err = -EAGAIN ; + }break ; -case FE_ENABLE_HIGH_LNB_VOLTAGE : -if (fe->ops.enable_high_lnb_voltage) - err = fe->ops.enable_high_lnb_voltage (fe, (long ) parg); +case FE_READ_SIGNAL_STRENGTH : +if (fe->ops.read_signal_strength) { +if (fepriv->thread) + err = fe->ops.read_signal_strength (fe, (__u16 *) parg); +else + err = -EAGAIN ; + } +break ; + +case FE_READ_SNR : +if (fe->ops.read_snr) { +if (fepriv->thread) + err = fe->ops.read_snr (fe, (__u16 *) parg); +else + err = -EAGAIN ; + } +break ; + +case FE_READ_UNCORRECTED_BLOCKS : +if (fe->ops.read_ucblocks) { +if (fepriv->thread) + err = fe->ops.read_ucblocks (fe, (__u32 *) parg); +else + err = -EAGAIN ; + }break ; +/* DEPRECATED DVBv3 ioctls */ +case FE_SET_FRONTEND : err =dvbv3_set_delivery_system (fe);if (err)
@@ -2450,11 +2439,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, err =dtv_get_frontend (fe, &getp, parg);break ; } -case FE_SET_FRONTEND_TUNE_MODE : - fepriv->tune_mode_flags = (unsigned long ) parg; - err =0 ; -break ; - } + +default : +return -ENOTSUPP ; + }/* switch */ return err; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 109/191 media: dvb_frontend: get rid of property cache's state
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit ef2cc27cf860b79874e9fde1419dd67c3372e41c upstream
In the past, I guess the idea was to use state in order to allow an autofush logic. However, in the current code, it is used only for debug messages, on a poor man's solution, as there's already a debug message to indicate when the properties got flushed.
So, just get rid of it for good.
--- drivers/media/dvb-core/dvb_frontend.c | 20 ++++++-------------- drivers/media/dvb-core/dvb_frontend.h | 5 ----- 2 files changed, 6 insertions(+), 19 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +6 -14
@@ -932,8 +932,6 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)memset (c,0 , offsetof(struct dtv_frontend_properties , strength)); c->delivery_system = delsys; - c->state =DTV_CLEAR ; -dev_dbg (fe->dvb->device,"%s: Clearing cache for delivery system %d\n" , __func__, c->delivery_system);
@@ -1760,13 +1758,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe,dvb_frontend_clear_cache (fe);break ;case DTV_TUNE : -/* interpret the cache of data, build either a traditional frontend -* tunerequest so we can pass validation in the FE_SET_FRONTEND -* ioctl. +/* +* Use the cached Digital TV properties to tune the +* frontend */ - c->state = tvp->cmd; -dev_dbg (fe->dvb->device,"%s: Finalised property cache\n" , - __func__); +dev_dbg (fe->dvb->device, +"%s: Setting the frontend from property cache\n" , + __func__); r =dtv_set_frontend (fe);break ;
@@ -1915,7 +1913,6 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg) {struct dvb_device *dvbdev = file->private_data;struct dvb_frontend *fe = dvbdev->priv; -struct dtv_frontend_properties *c = &fe->dtv_property_cache;struct dvb_frontend_private *fepriv = fe->frontend_priv;int err;
@@ -1935,7 +1932,6 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg)return -EPERM ; } - c->state =DTV_UNDEFINED ; err =dvb_frontend_handle_ioctl (file, cmd, parg);up (&fepriv->sem);
@@ -2119,10 +2115,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, } (tvp + i)->result = err; } - -if (c->state ==DTV_TUNE ) -dev_dbg (fe->dvb->device,"%s: Property cache is full, tuning\n" , __func__); -kfree (tvp);break ; }
drivers/media/dvb-core/dvb_frontend.h +0 -5
@@ -615,11 +615,6 @@ struct dtv_frontend_properties {struct dtv_fe_stats post_bit_count;struct dtv_fe_stats block_error;struct dtv_fe_stats block_count; - -/* private: */ -/* Cache State */ -u32 state; - };#define DVB_FE_NO_EXIT 0
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 110/191 media: dvb_frontend: better document the -EPERM condition
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit da5516b5e81d45a96291823620f6c820178dc055 upstream
Two readonly ioctls can't be allowed if the frontend device is opened in read only mode. Explain why.
Reviewed by: Shuah Khan <[email protected]>
--- drivers/media/dvb-core/dvb_frontend.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +17 -3
@@ -1925,9 +1925,23 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg)return -ENODEV ; } -if ((file->f_flags &O_ACCMODE ) ==O_RDONLY && - (_IOC_DIR (cmd) != _IOC_READ || cmd ==FE_GET_EVENT || - cmd ==FE_DISEQC_RECV_SLAVE_REPLY )) { +/* +* If the frontend is opened in read-only mode, only the ioctls +* that don't interfere with the tune logic should be accepted. +* That allows an external application to monitor the DVB QoS and +* statistics parameters. +* +* That matches all _IOR() ioctls, except for two special cases: +* - FE_GET_EVENT is part of the tuning logic on a DVB application; +* - FE_DISEQC_RECV_SLAVE_REPLY is part of DiSEqC 2.0 +* setup +* So, those two ioctls should also return -EPERM, as otherwise +* reading from them would interfere with a DVB tune application +*/ +if ((file->f_flags &O_ACCMODE ) ==O_RDONLY + && (_IOC_DIR (cmd) != _IOC_READ + || cmd ==FE_GET_EVENT + || cmd ==FE_DISEQC_RECV_SLAVE_REPLY )) {up (&fepriv->sem);return -EPERM ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 111/191 media: dvb_frontend: fix return values for FE_SET_PROPERTY
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 259a41d9ae8f3689742267f340ad2b159d00b302 upstream
There are several problems with regards to the return of FE_SET_PROPERTY. The original idea were to return per-property return codes via tvp->result field, and to return an updated set of values.
However, that never worked. What's actually implemented is:
- the FE_SET_PROPERTY implementation doesn't call .get_frontend callback in order to get the actual parameters after return;
- the tvp->result field is only filled if there's no error. So, it is always filled with zero;
- FE_SET_PROPERTY doesn't call memdup_user() nor any other copy_to_user() function. So, any changes to the properties will be lost;
- FE_SET_PROPERTY is declared as a write-only ioctl (IOW).
While we could fix the above, it could cause regressions.
So, let's just assume what the code really does, updating the documentation accordingly and removing the logic that would update the discarded tvp->result.
--- Documentation/media/uapi/dvb/fe-get-property.rst | 7 +++++-- drivers/media/dvb-core/dvb_frontend.c | 2 -- include/uapi/linux/dvb/frontend.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
Documentation/media/uapi/dvb/fe-get-property.rst +5 -2
@@ -48,8 +48,11 @@ depends on the delivery system and on the device: - This call requires read/write access to the device. - - At return, the values are updated to reflect the actual parameters - used. +.. note:: + + At return, the values aren't updated to reflect the actual + parameters used. If the actual parameters are needed, an explicit + call to ``FE_GET_PROPERTY`` is needed. - ``FE_GET_PROPERTY:``
drivers/media/dvb-core/dvb_frontend.c +0 -2
@@ -2127,7 +2127,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,kfree (tvp);return err; } - (tvp + i)->result = err; }kfree (tvp);break ;
@@ -2172,7 +2171,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,kfree (tvp);return err; } - (tvp + i)->result = err; } if (copy_to_user((void __user *)tvps->props, tvp,
include/uapi/linux/dvb/frontend.h +1 -1
@@ -830,7 +830,7 @@ struct dtv_fe_stats {* @cmd: Digital TV command. * @reserved: Not used. * @u: Union with the values for the command. -* @result: Result of the command set (currently unused). +* @result: Unused * * The @u union may have either one of the values below: *
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 112/191 media: dvb_frontend: dtv_property_process_set() cleanups
In reply to Sasha LevinFrom: Satendra Singh Thakur <[email protected]>
commit media: dvb_frontend: dtv_property_process_set() cleanups upstream
Since all properties in the func dtv_property_process_set() use at most 4 bytes arguments, change the code to pass
u32 cmd and u32 data as function arguments, instead of passing a pointer to the entire struct dtv_property *tvp.
Instead of having a generic dtv_property_dump(), added its own properties debug logic in the dtv_property_process_set().
--- drivers/media/dvb-core/dvb_frontend.c | 125 +++++++++++++++----------- 1 file changed, 72 insertions(+), 53 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +72 -53
@@ -1088,22 +1088,19 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_STAT_TOTAL_BLOCK_COUNT, 0, 0), }; -static void dtv_property_dump (struct dvb_frontend *fe, -bool is_set, +static void dtv_get_property_dump (struct dvb_frontend *fe,struct dtv_property *tvp) {int i;if (tvp->cmd <=0 || tvp->cmd >DTV_MAX_COMMAND ) { -dev_warn (fe->dvb->device,"%s: %s tvp.cmd = 0x%08x undefined\n" , - __func__, - is_set ?"SET" :"GET" , +dev_warn (fe->dvb->device,"%s: GET tvp.cmd = 0x%08x undefined\n" + , __func__, tvp->cmd);return ; } -dev_dbg (fe->dvb->device,"%s: %s tvp.cmd = 0x%08x (%s)\n" , __func__, - is_set ?"SET" :"GET" , +dev_dbg (fe->dvb->device,"%s: GET tvp.cmd = 0x%08x (%s)\n" , __func__, tvp->cmd, dtv_cmds[tvp->cmd].name);
@@ -1513,7 +1510,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe,return -EINVAL ; } -dtv_property_dump (fe, false, tvp); +dtv_get_property_dump (fe, tvp);return 0 ; }
@@ -1740,16 +1737,36 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe)return emulate_delivery_system (fe, delsys); } +/** +* dtv_property_process_set - Sets a single DTV property +* @fe: Pointer to &struct dvb_frontend +* @file: Pointer to &struct file +* @cmd: Digital TV command +* @data: An unsigned 32-bits number +* +* This routine assigns the property +* value to the corresponding member of +* &struct dtv_frontend_properties +* +* Returns: +* Zero on success, negative errno on failure. +*/ static int dtv_property_process_set (struct dvb_frontend *fe, -struct dtv_property *tvp, -struct file *file) +struct file *file, +u32 cmd,u32 data) {int r =0 ;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -dtv_property_dump (fe, true, tvp); - -switch (tvp->cmd) { +/** Dump DTV command name and value*/ +if (!cmd || cmd >DTV_MAX_COMMAND ) +dev_warn (fe->dvb->device,"%s: SET cmd 0x%08x undefined\n" , + __func__, cmd); +else +dev_dbg (fe->dvb->device, +"%s: SET cmd 0x%08x (%s) to 0x%08x\n" , + __func__, cmd, dtv_cmds[cmd].name, data); +switch (cmd) {case DTV_CLEAR :/* * Reset a cache of data specific to the frontend here. This does
@@ -1769,133 +1786,133 @@ static int dtv_property_process_set(struct dvb_frontend *fe, r =dtv_set_frontend (fe);break ;case DTV_FREQUENCY : - c->frequency = tvp->u.data; + c->frequency = data;break ;case DTV_MODULATION : - c->modulation = tvp->u.data; + c->modulation = data;break ;case DTV_BANDWIDTH_HZ : - c->bandwidth_hz = tvp->u.data; + c->bandwidth_hz = data;break ;case DTV_INVERSION : - c->inversion = tvp->u.data; + c->inversion = data;break ;case DTV_SYMBOL_RATE : - c->symbol_rate = tvp->u.data; + c->symbol_rate = data;break ;case DTV_INNER_FEC : - c->fec_inner = tvp->u.data; + c->fec_inner = data;break ;case DTV_PILOT : - c->pilot = tvp->u.data; + c->pilot = data;break ;case DTV_ROLLOFF : - c->rolloff = tvp->u.data; + c->rolloff = data;break ;case DTV_DELIVERY_SYSTEM : - r =dvbv5_set_delivery_system (fe, tvp->u.data); + r =dvbv5_set_delivery_system (fe, data);break ;case DTV_VOLTAGE : - c->voltage = tvp->u.data; + c->voltage = data; r =dvb_frontend_handle_ioctl (file,FE_SET_VOLTAGE , (void *)c->voltage);break ;case DTV_TONE : - c->sectone = tvp->u.data; + c->sectone = data; r =dvb_frontend_handle_ioctl (file,FE_SET_TONE , (void *)c->sectone);break ;case DTV_CODE_RATE_HP : - c->code_rate_HP = tvp->u.data; + c->code_rate_HP = data;break ;case DTV_CODE_RATE_LP : - c->code_rate_LP = tvp->u.data; + c->code_rate_LP = data;break ;case DTV_GUARD_INTERVAL : - c->guard_interval = tvp->u.data; + c->guard_interval = data;break ;case DTV_TRANSMISSION_MODE : - c->transmission_mode = tvp->u.data; + c->transmission_mode = data;break ;case DTV_HIERARCHY : - c->hierarchy = tvp->u.data; + c->hierarchy = data;break ;case DTV_INTERLEAVING : - c->interleaving = tvp->u.data; + c->interleaving = data;break ;/* ISDB-T Support here */ case DTV_ISDBT_PARTIAL_RECEPTION : - c->isdbt_partial_reception = tvp->u.data; + c->isdbt_partial_reception = data;break ;case DTV_ISDBT_SOUND_BROADCASTING : - c->isdbt_sb_mode = tvp->u.data; + c->isdbt_sb_mode = data;break ;case DTV_ISDBT_SB_SUBCHANNEL_ID : - c->isdbt_sb_subchannel = tvp->u.data; + c->isdbt_sb_subchannel = data;break ;case DTV_ISDBT_SB_SEGMENT_IDX : - c->isdbt_sb_segment_idx = tvp->u.data; + c->isdbt_sb_segment_idx = data;break ;case DTV_ISDBT_SB_SEGMENT_COUNT : - c->isdbt_sb_segment_count = tvp->u.data; + c->isdbt_sb_segment_count = data;break ;case DTV_ISDBT_LAYER_ENABLED : - c->isdbt_layer_enabled = tvp->u.data; + c->isdbt_layer_enabled = data;break ;case DTV_ISDBT_LAYERA_FEC : - c->layer[0 ].fec = tvp->u.data; + c->layer[0 ].fec = data;break ;case DTV_ISDBT_LAYERA_MODULATION : - c->layer[0 ].modulation = tvp->u.data; + c->layer[0 ].modulation = data;break ;case DTV_ISDBT_LAYERA_SEGMENT_COUNT : - c->layer[0 ].segment_count = tvp->u.data; + c->layer[0 ].segment_count = data;break ;case DTV_ISDBT_LAYERA_TIME_INTERLEAVING : - c->layer[0 ].interleaving = tvp->u.data; + c->layer[0 ].interleaving = data;break ;case DTV_ISDBT_LAYERB_FEC : - c->layer[1 ].fec = tvp->u.data; + c->layer[1 ].fec = data;break ;case DTV_ISDBT_LAYERB_MODULATION : - c->layer[1 ].modulation = tvp->u.data; + c->layer[1 ].modulation = data;break ;case DTV_ISDBT_LAYERB_SEGMENT_COUNT : - c->layer[1 ].segment_count = tvp->u.data; + c->layer[1 ].segment_count = data;break ;case DTV_ISDBT_LAYERB_TIME_INTERLEAVING : - c->layer[1 ].interleaving = tvp->u.data; + c->layer[1 ].interleaving = data;break ;case DTV_ISDBT_LAYERC_FEC : - c->layer[2 ].fec = tvp->u.data; + c->layer[2 ].fec = data;break ;case DTV_ISDBT_LAYERC_MODULATION : - c->layer[2 ].modulation = tvp->u.data; + c->layer[2 ].modulation = data;break ;case DTV_ISDBT_LAYERC_SEGMENT_COUNT : - c->layer[2 ].segment_count = tvp->u.data; + c->layer[2 ].segment_count = data;break ;case DTV_ISDBT_LAYERC_TIME_INTERLEAVING : - c->layer[2 ].interleaving = tvp->u.data; + c->layer[2 ].interleaving = data;break ;/* Multistream support */ case DTV_STREAM_ID :case DTV_DVBT2_PLP_ID_LEGACY : - c->stream_id = tvp->u.data; + c->stream_id = data;break ;/* ATSC-MH */ case DTV_ATSCMH_PARADE_ID : - fe->dtv_property_cache.atscmh_parade_id = tvp->u.data; + fe->dtv_property_cache.atscmh_parade_id = data;break ;case DTV_ATSCMH_RS_FRAME_ENSEMBLE : - fe->dtv_property_cache.atscmh_rs_frame_ensemble = tvp->u.data; + fe->dtv_property_cache.atscmh_rs_frame_ensemble = data;break ;case DTV_LNA : - c->lna = tvp->u.data; + c->lna = data;if (fe->ops.set_lna) r = fe->ops.set_lna (fe);if (r <0 )
@@ -2122,7 +2139,9 @@ static int dvb_frontend_handle_ioctl(struct file *file,return PTR_ERR (tvp);for (i =0 ; i < tvps->num; i++) { - err =dtv_property_process_set (fe, tvp + i, file); + err =dtv_property_process_set (fe, file, + (tvp + i)->cmd, + (tvp + i)->u.data);if (err <0 ) {kfree (tvp);return err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 113/191 media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit a9cb97c3e628902e37583d8a40bb28cf76522cf1 upstream
As smatch warned:
drivers/media/dvb-core/dvb_frontend.c:2468 dvb_frontend_handle_ioctl() error: uninitialized symbol 'err'.
The ioctl handler actually got a regression here: before changeset d73dcf0cdb95 ("media: dvb_frontend: cleanup ioctl handling logic"), the code used to return -EOPNOTSUPP if an ioctl handler was not implemented on a driver. After the change, it may return a random value.
--- drivers/media/dvb-core/dvb_frontend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-core/dvb_frontend.c +3 -1
@@ -2113,7 +2113,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,struct dvb_frontend *fe = dvbdev->priv;struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int i, err; +int i, err = -EOPNOTSUPP ;dev_dbg (fe->dvb->device,"%s:\n" , __func__);
@@ -2148,6 +2148,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, } }kfree (tvp); + err =0 ;break ; }case FE_GET_PROPERTY : {
@@ -2198,6 +2199,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,return -EFAULT ; }kfree (tvp); + err =0 ;break ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 114/191 media: dvb_frontend: Add unlocked_ioctl in dvb_frontend.c
In reply to Sasha LevinFrom: Jaedon Shin <[email protected]>
commit a2282fd1fe2ebcda480426dbfaaa7c4e87e27399 upstream
Adds unlocked ioctl function directly in dvb_frontend.c instead of using dvb_generic_ioctl().
--- drivers/media/dvb-core/dvb_frontend.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +14 -3
@@ -1926,7 +1926,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe,return r; } -static int dvb_frontend_ioctl (struct file *file,unsigned int cmd,void *parg) +static int dvb_frontend_do_ioctl (struct file *file,unsigned int cmd, +void *parg) {struct dvb_device *dvbdev = file->private_data;struct dvb_frontend *fe = dvbdev->priv;
@@ -1969,6 +1970,17 @@ static int dvb_frontend_ioctl(struct file *file, unsigned int cmd, void *parg)return err; } +static long dvb_frontend_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +struct dvb_device *dvbdev = file->private_data; + +if (!dvbdev) +return -ENODEV ; + +return dvb_usercopy (file, cmd, arg, dvb_frontend_do_ioctl); +} +static int dtv_set_frontend (struct dvb_frontend *fe) {struct dvb_frontend_private *fepriv = fe->frontend_priv;
@@ -2638,7 +2650,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)static const struct file_operations dvb_frontend_fops = { .owner =THIS_MODULE , - .unlocked_ioctl = dvb_generic_ioctl, + .unlocked_ioctl = dvb_frontend_ioctl, .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release,
@@ -2706,7 +2718,6 @@ int dvb_register_frontend(struct dvb_adapter* dvb,#if defined(CONFIG_MEDIA_CONTROLLER_DVB ) .name = fe->ops.info.name,#endif - .kernel_ioctl = dvb_frontend_ioctl };dev_dbg (dvb->device,"%s:\n" , __func__);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 115/191 media: dvb_frontend: Add compat_ioctl callback
In reply to Sasha LevinFrom: Jaedon Shin <[email protected]>
commit c2dfd2276cec63a0c6f6ce18ed83800d96fde542 upstream
Adds compat_ioctl for 32-bit user space applications on a 64-bit system.
--- drivers/media/dvb-core/dvb_frontend.c | 12 ++++++++++++ fs/compat_ioctl.c | 17 ----------------- 2 files changed, 12 insertions(+), 17 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +12 -0
@@ -41,6 +41,7 @@#include <linux/jiffies.h> #include <linux/kthread.h> #include <linux/ktime.h> +#include <linux/compat.h> #include <asm/processor.h> #include "dvb_frontend.h"
@@ -1981,6 +1982,14 @@ static long dvb_frontend_ioctl(struct file *file, unsigned int cmd,return dvb_usercopy (file, cmd, arg, dvb_frontend_do_ioctl); } +#ifdef CONFIG_COMPAT +static long dvb_frontend_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +return dvb_frontend_ioctl (file, cmd, (unsigned long )compat_ptr (arg)); +} +#endif +static int dtv_set_frontend (struct dvb_frontend *fe) {struct dvb_frontend_private *fepriv = fe->frontend_priv;
@@ -2651,6 +2660,9 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)static const struct file_operations dvb_frontend_fops = { .owner =THIS_MODULE , .unlocked_ioctl = dvb_frontend_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = dvb_frontend_compat_ioctl, +#endif .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release,
fs/compat_ioctl.c +0 -17
@@ -1340,23 +1340,6 @@ COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) COMPATIBLE_IOCTL(DMX_GET_CAPS) COMPATIBLE_IOCTL(DMX_SET_SOURCE) COMPATIBLE_IOCTL(DMX_GET_STC) -COMPATIBLE_IOCTL(FE_GET_INFO) -COMPATIBLE_IOCTL(FE_DISEQC_RESET_OVERLOAD) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_MASTER_CMD) -COMPATIBLE_IOCTL(FE_DISEQC_RECV_SLAVE_REPLY) -COMPATIBLE_IOCTL(FE_DISEQC_SEND_BURST) -COMPATIBLE_IOCTL(FE_SET_TONE) -COMPATIBLE_IOCTL(FE_SET_VOLTAGE) -COMPATIBLE_IOCTL(FE_ENABLE_HIGH_LNB_VOLTAGE) -COMPATIBLE_IOCTL(FE_READ_STATUS) -COMPATIBLE_IOCTL(FE_READ_BER) -COMPATIBLE_IOCTL(FE_READ_SIGNAL_STRENGTH) -COMPATIBLE_IOCTL(FE_READ_SNR) -COMPATIBLE_IOCTL(FE_READ_UNCORRECTED_BLOCKS) -COMPATIBLE_IOCTL(FE_SET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_FRONTEND) -COMPATIBLE_IOCTL(FE_GET_EVENT) -COMPATIBLE_IOCTL(FE_DISHNETWORK_SEND_LEGACY_CMD) COMPATIBLE_IOCTL(VIDEO_STOP) COMPATIBLE_IOCTL(VIDEO_PLAY) COMPATIBLE_IOCTL(VIDEO_FREEZE)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 116/191 media: dvb_frontend: Add commands implementation for compat ioct
In reply to Sasha LevinFrom: Jaedon Shin <[email protected]>
commit 18192a77f0810933ab71a46c1b260d230d7352ee upstream
The dtv_properties structure and the dtv_property structure are different sizes in 32-bit and 64-bit system. This patch provides FE_SET_PROPERTY and FE_GET_PROPERTY ioctl commands implementation for 32-bit user space applications.
--- drivers/media/dvb-core/dvb_frontend.c | 131 ++++++++++++++++++++++++++ 1 file changed, 131 insertions(+)
drivers/media/dvb-core/dvb_frontend.c +131 -0
@@ -1983,9 +1983,140 @@ static long dvb_frontend_ioctl(struct file *file, unsigned int cmd, }#ifdef CONFIG_COMPAT +struct compat_dtv_property { +__u32 cmd; +__u32 reserved[3 ]; +union { +__u32 data; +struct dtv_fe_stats st; +struct { +__u8 data[32 ]; +__u32 len; +__u32 reserved1[3 ]; +compat_uptr_t reserved2; + } buffer; + } u; +int result; +} __attribute__ ((packed)); + +struct compat_dtv_properties { +__u32 num; +compat_uptr_t props; +}; + +#define COMPAT_FE_SET_PROPERTY _IOW('o', 82, struct compat_dtv_properties) +#define COMPAT_FE_GET_PROPERTY _IOR('o', 83, struct compat_dtv_properties) + +static int dvb_frontend_handle_compat_ioctl (struct file *file,unsigned int cmd, +unsigned long arg) +{ +struct dvb_device *dvbdev = file->private_data; +struct dvb_frontend *fe = dvbdev->priv; +struct dvb_frontend_private *fepriv = fe->frontend_priv; +int i, err =0 ; + +if (cmd ==COMPAT_FE_SET_PROPERTY ) { +struct compat_dtv_properties prop, *tvps =NULL ; +struct compat_dtv_property *tvp =NULL ; + +if (copy_from_user (&prop,compat_ptr (arg),sizeof (prop))) +return -EFAULT ; + + tvps = ∝ + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) +return -EINVAL ; + + tvp =memdup_user (compat_ptr (tvps->props), tvps->num *sizeof (*tvp)); +if (IS_ERR (tvp)) +return PTR_ERR (tvp); + +for (i =0 ; i < tvps->num; i++) { + err =dtv_property_process_set (fe, file, + (tvp + i)->cmd, + (tvp + i)->u.data); +if (err <0 ) { +kfree (tvp); +return err; + } + } +kfree (tvp); + }else if (cmd ==COMPAT_FE_GET_PROPERTY ) { +struct compat_dtv_properties prop, *tvps =NULL ; +struct compat_dtv_property *tvp =NULL ; +struct dtv_frontend_properties getp = fe->dtv_property_cache; + +if (copy_from_user (&prop,compat_ptr (arg),sizeof (prop))) +return -EFAULT ; + + tvps = ∝ + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) +return -EINVAL ; + + tvp =memdup_user (compat_ptr (tvps->props), tvps->num *sizeof (*tvp)); +if (IS_ERR (tvp)) +return PTR_ERR (tvp); + +/* +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. +*/ +if (fepriv->state !=FESTATE_IDLE ) { + err =dtv_get_frontend (fe, &getp,NULL ); +if (err <0 ) { +kfree (tvp); +return err; + } + } +for (i =0 ; i < tvps->num; i++) { + err =dtv_property_process_get ( + fe, &getp, (struct dtv_property *)tvp + i, file); +if (err <0 ) { +kfree (tvp); +return err; + } + } + +if (copy_to_user ((void __user *)compat_ptr (tvps->props), tvp, + tvps->num *sizeof (struct compat_dtv_property ))) { +kfree (tvp); +return -EFAULT ; + } +kfree (tvp); + } + +return err; +} +static long dvb_frontend_compat_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { +struct dvb_device *dvbdev = file->private_data; +struct dvb_frontend *fe = dvbdev->priv; +struct dvb_frontend_private *fepriv = fe->frontend_priv; +int err; + +if (cmd ==COMPAT_FE_SET_PROPERTY || cmd ==COMPAT_FE_GET_PROPERTY ) { +if (down_interruptible (&fepriv->sem)) +return -ERESTARTSYS ; + + err =dvb_frontend_handle_compat_ioctl (file, cmd, arg); + +up (&fepriv->sem); +return err; + } +return dvb_frontend_ioctl (file, cmd, (unsigned long )compat_ptr (arg)); }#endif
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 117/191 media: dvb_frontend: fix wrong cast in compat_ioctl
In reply to Sasha LevinFrom: Katsuhiro Suzuki <[email protected]>
commit 5c6c9c4830b76d851d38829611b3c3e4be0f5cdf upstream
FE_GET_PROPERTY has always failed as following situations:
- Use compatible ioctl
- The array of 'struct dtv_property' has 2 or more items
This patch fixes wrong cast to a pointer 'struct dtv_property' from a pointer of 2nd or after item of 'struct compat_dtv_property' array.
--- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvb_frontend.c +1 -1
@@ -2081,7 +2081,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, }for (i =0 ; i < tvps->num; i++) { err =dtv_property_process_get ( - fe, &getp, (struct dtv_property *)tvp + i, file); + fe, &getp, (struct dtv_property *)(tvp + i), file);if (err <0 ) {kfree (tvp);return err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 118/191 media: dvb_frontend: fix return error code
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
commit 330dada5957e3ca0c8811b14c45e3ac42c694651 upstream
The correct error code when a function is not defined is -ENOTSUPP. It was typoed wrong as -EOPNOTSUPP, with, unfortunately, exists, but it is not used by the DVB core.
Thanks-to: Geert Uytterhoeven <[email protected]>
Thanks-to: Arnd Bergmann <[email protected]>
To make me revisit this code.
--- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-core/dvb_frontend.c +1 -1
@@ -2265,7 +2265,7 @@ static int dvb_frontend_handle_ioctl(struct file *file,struct dvb_frontend *fe = dvbdev->priv;struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int i, err = -EOPNOTSUPP ; +int i, err = -ENOTSUPP ;dev_dbg (fe->dvb->device,"%s:\n" , __func__);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 119/191 mtd: rawnand: Pass a nand_chip object to nand_release()
In reply to Sasha LevinFrom: Boris Brezillon <[email protected]>
[ Upstream commit 59ac276f22270fb2094910f9a734c17f41c25e70 ]
Let's make the raw NAND API consistent by patching all helpers to take a nand_chip object instead of an mtd_info one.
Now is nand_release()'s turn.
--- drivers/mtd/nand/ams-delta.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/au1550nd.c | 2 +- drivers/mtd/nand/bcm47xxnflash/main.c | 2 +- drivers/mtd/nand/bf5xx_nand.c | 2 +- drivers/mtd/nand/brcmnand/brcmnand.c | 2 +- drivers/mtd/nand/cafe_nand.c | 2 +- drivers/mtd/nand/cmx270_nand.c | 2 +- drivers/mtd/nand/cs553x_nand.c | 2 +- drivers/mtd/nand/davinci_nand.c | 2 +- drivers/mtd/nand/denali.c | 2 +- drivers/mtd/nand/diskonchip.c | 4 ++-- drivers/mtd/nand/docg4.c | 4 ++-- drivers/mtd/nand/fsl_elbc_nand.c | 2 +- drivers/mtd/nand/fsl_ifc_nand.c | 2 +- drivers/mtd/nand/fsl_upm.c | 2 +- drivers/mtd/nand/fsmc_nand.c | 2 +- drivers/mtd/nand/gpio.c | 2 +- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 2 +- drivers/mtd/nand/hisi504_nand.c | 5 ++--- drivers/mtd/nand/jz4740_nand.c | 4 ++-- drivers/mtd/nand/jz4780_nand.c | 4 ++-- drivers/mtd/nand/lpc32xx_mlc.c | 5 ++--- drivers/mtd/nand/lpc32xx_slc.c | 5 ++--- drivers/mtd/nand/mpc5121_nfc.c | 2 +- drivers/mtd/nand/mtk_nand.c | 4 ++-- drivers/mtd/nand/mxc_nand.c | 2 +- drivers/mtd/nand/nand_base.c | 8 ++++---- drivers/mtd/nand/nandsim.c | 4 ++-- drivers/mtd/nand/ndfc.c | 2 +- drivers/mtd/nand/nuc900_nand.c | 2 +- drivers/mtd/nand/omap2.c | 2 +- drivers/mtd/nand/orion_nand.c | 5 ++--- drivers/mtd/nand/pasemi_nand.c | 2 +- drivers/mtd/nand/plat_nand.c | 4 ++-- drivers/mtd/nand/pxa3xx_nand.c | 2 +- drivers/mtd/nand/qcom_nandc.c | 4 ++-- drivers/mtd/nand/r852.c | 4 ++-- drivers/mtd/nand/s3c2410.c | 2 +- drivers/mtd/nand/sh_flctl.c | 2 +- drivers/mtd/nand/sharpsl.c | 4 ++-- drivers/mtd/nand/socrates_nand.c | 5 ++--- drivers/mtd/nand/sunxi_nand.c | 4 ++-- drivers/mtd/nand/tmio_nand.c | 4 ++-- drivers/mtd/nand/txx9ndfmc.c | 2 +- drivers/mtd/nand/vf610_nfc.c | 2 +- drivers/mtd/nand/xway_nand.c | 4 ++-- include/linux/mtd/nand.h | 6 ++---- 48 files changed, 70 insertions(+), 77 deletions(-)
drivers/mtd/nand/ams-delta.c +1 -1
@@ -264,7 +264,7 @@ static int ams_delta_cleanup(struct platform_device *pdev)void __iomem *io_base =platform_get_drvdata (pdev);/* Release resources, unregister device */ -nand_release (ams_delta_mtd); +nand_release (mtd_to_nand (ams_delta_mtd));gpio_free_array (_mandatory_gpio,ARRAY_SIZE (_mandatory_gpio));gpio_free (AMS_DELTA_GPIO_PIN_NAND_RB );
drivers/mtd/nand/atmel_nand.c +1 -1
@@ -2336,7 +2336,7 @@ static int atmel_nand_remove(struct platform_device *pdev)struct atmel_nand_host *host =platform_get_drvdata (pdev);struct mtd_info *mtd =nand_to_mtd (&host->nand_chip); -nand_release (mtd); +nand_release (&host->nand_chip);atmel_nand_disable (host);
drivers/mtd/nand/au1550nd.c +1 -1
@@ -496,7 +496,7 @@ static int au1550nd_remove(struct platform_device *pdev)struct au1550nd_ctx *ctx =platform_get_drvdata (pdev);struct resource *r =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -nand_release (nand_to_mtd (&ctx->chip)); +nand_release (&ctx->chip);iounmap (ctx->base);release_mem_region (r->start,0x1000 );kfree (ctx);
drivers/mtd/nand/bcm47xxnflash/main.c +1 -1
@@ -65,7 +65,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev) {struct bcm47xxnflash *nflash =platform_get_drvdata (pdev); -nand_release (nand_to_mtd (&nflash->nand_chip)); +nand_release (&nflash->nand_chip);return 0 ; }
drivers/mtd/nand/bf5xx_nand.c +1 -1
@@ -688,7 +688,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)* and their partitions, then go through freeing the * resources used */ -nand_release (nand_to_mtd (&info->chip)); +nand_release (&info->chip);peripheral_free_list (bfin_nfc_pin_req);bf5xx_nand_dma_remove (info);
drivers/mtd/nand/brcmnand/brcmnand.c +1 -1
@@ -2595,7 +2595,7 @@ int brcmnand_remove(struct platform_device *pdev)struct brcmnand_host *host;list_for_each_entry (host, &ctrl->host_list, node) -nand_release (nand_to_mtd (&host->chip)); +nand_release (&host->chip);clk_disable_unprepare (ctrl->clk);
drivers/mtd/nand/cafe_nand.c +1 -1
@@ -825,7 +825,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)/* Disable NAND IRQ in global IRQ mask register */ cafe_writel (cafe, ~1 &cafe_readl (cafe,GLOBAL_IRQ_MASK ),GLOBAL_IRQ_MASK );free_irq (pdev->irq, mtd); -nand_release (mtd); +nand_release (chip);free_rs (cafe->rs);pci_iounmap (pdev, cafe->mmio); dma_free_coherent(&cafe->pdev->dev,
drivers/mtd/nand/cmx270_nand.c +1 -1
@@ -230,7 +230,7 @@ module_init(cmx270_init); static void __exit cmx270_cleanup(void) {/* Release resources, unregister device */ -nand_release (cmx270_nand_mtd); +nand_release (mtd_to_nand (cmx270_nand_mtd));gpio_free (GPIO_NAND_RB );gpio_free (GPIO_NAND_CS );
drivers/mtd/nand/cs553x_nand.c +1 -1
@@ -339,7 +339,7 @@ static void __exit cs553x_cleanup(void) mmio_base = this->IO_ADDR_R;/* Release resources, unregister device */ -nand_release (mtd); +nand_release (this);kfree (mtd->name); cs553x_mtd[i] =NULL ;
drivers/mtd/nand/davinci_nand.c +1 -1
@@ -840,7 +840,7 @@ static int nand_davinci_remove(struct platform_device *pdev) ecc4_busy = false;spin_unlock_irq (&davinci_nand_lock); -nand_release (nand_to_mtd (&info->chip)); +nand_release (&info->chip);clk_disable_unprepare (info->clk);
drivers/mtd/nand/denali.c +1 -1
@@ -1655,7 +1655,7 @@ void denali_remove(struct denali_nand_info *denali)*/ int bufsize = mtd->writesize + mtd->oobsize; -nand_release (mtd); +nand_release (&denali->nand);denali_irq_cleanup (denali->irq, denali);dma_unmap_single (denali->dev, denali->buf.dma_buf, bufsize,DMA_BIDIRECTIONAL );
drivers/mtd/nand/diskonchip.c +2 -2
@@ -1611,7 +1611,7 @@ static int __init doc_probe(unsigned long physadr)/* nand_release will call mtd_device_unregister, but we haven't yet added it. This is handled without incident by mtd_device_unregister, as far as I can tell. */ -nand_release (mtd); +nand_release (nand);kfree (nand); goto fail; }
@@ -1644,7 +1644,7 @@ static void release_nanddoc(void) doc =nand_get_controller_data (nand); nextmtd = doc->nextdoc; -nand_release (mtd); +nand_release (nand);iounmap (doc->virtadr);release_mem_region (doc->physadr,DOC_IOREMAP_LEN );kfree (nand);
drivers/mtd/nand/docg4.c +2 -2
@@ -1374,7 +1374,7 @@ static int __init probe_docg4(struct platform_device *pdev)return 0 ; fail: -nand_release (mtd);/* deletes partitions and mtd devices */ +nand_release (nand);/* deletes partitions and mtd devices */ free_bch (doc->bch);kfree (nand);
@@ -1387,7 +1387,7 @@ static int __init probe_docg4(struct platform_device *pdev) static int __exit cleanup_docg4(struct platform_device *pdev) {struct docg4_priv *doc =platform_get_drvdata (pdev); -nand_release (doc->mtd); +nand_release (mtd_to_nand (doc->mtd));free_bch (doc->bch);kfree (mtd_to_nand (doc->mtd));iounmap (doc->virtadr);
drivers/mtd/nand/fsl_elbc_nand.c +1 -1
@@ -811,7 +811,7 @@ static int fsl_elbc_chip_remove(struct fsl_elbc_mtd *priv)struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;struct mtd_info *mtd =nand_to_mtd (&priv->chip); -nand_release (mtd); +nand_release (&priv->chip);kfree (mtd->name);
drivers/mtd/nand/fsl_ifc_nand.c +1 -1
@@ -918,7 +918,7 @@ static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv) {struct mtd_info *mtd =nand_to_mtd (&priv->chip); -nand_release (mtd); +nand_release (&priv->chip);kfree (mtd->name);
drivers/mtd/nand/fsl_upm.c +1 -1
@@ -326,7 +326,7 @@ static int fun_remove(struct platform_device *ofdev)struct mtd_info *mtd =nand_to_mtd (&fun->chip);int i; -nand_release (mtd); +nand_release (&fun->chip);kfree (mtd->name);for (i =0 ; i < fun->mchip_count; i++) {
drivers/mtd/nand/fsmc_nand.c +1 -1
@@ -1038,7 +1038,7 @@ static int fsmc_nand_remove(struct platform_device *pdev)struct fsmc_nand_data *host =platform_get_drvdata (pdev);if (host) { -nand_release (nand_to_mtd (&host->nand)); +nand_release (&host->nand);if (host->mode ==USE_DMA_ACCESS ) {dma_release_channel (host->write_dma_chan);
drivers/mtd/nand/gpio.c +1 -1
@@ -197,7 +197,7 @@ static int gpio_nand_remove(struct platform_device *pdev) {struct gpiomtd *gpiomtd =platform_get_drvdata (pdev); -nand_release (nand_to_mtd (&gpiomtd->nand_chip)); +nand_release (&gpiomtd->nand_chip);if (gpio_is_valid (gpiomtd->plat.gpio_nwp))gpio_set_value (gpiomtd->plat.gpio_nwp,0 );
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +1 -1
@@ -1930,7 +1930,7 @@ static int gpmi_set_geometry(struct gpmi_nand_data *this)static void gpmi_nand_exit (struct gpmi_nand_data *this) { -nand_release (nand_to_mtd (&this->nand)); +nand_release (&this->nand);gpmi_free_dma_buffer (this); }
drivers/mtd/nand/hisi504_nand.c +2 -3
@@ -823,7 +823,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)return 0 ; err_mtd: -nand_release (mtd); +nand_release (chip); err_res:return ret; }
@@ -831,9 +831,8 @@ static int hisi_nfc_probe(struct platform_device *pdev)static int hisi_nfc_remove (struct platform_device *pdev) {struct hinfc_host *host =platform_get_drvdata (pdev); -struct mtd_info *mtd =nand_to_mtd (&host->chip); -nand_release (mtd); +nand_release (&host->chip);return 0 ; }
drivers/mtd/nand/jz4740_nand.c +2 -2
@@ -499,7 +499,7 @@ static int jz_nand_probe(struct platform_device *pdev)return 0 ; err_nand_release: -nand_release (mtd); +nand_release (chip); err_unclaim_banks:while (chipnr--) {unsigned char bank = nand->banks[chipnr];
@@ -520,7 +520,7 @@ static int jz_nand_remove(struct platform_device *pdev)struct jz_nand *nand =platform_get_drvdata (pdev);size_t i; -nand_release (nand_to_mtd (&nand->chip)); +nand_release (&nand->chip);/* Deassert and disable all chips */ writel (0 , nand->base +JZ_REG_NAND_CTRL );
drivers/mtd/nand/jz4780_nand.c +2 -2
@@ -293,7 +293,7 @@ static int jz4780_nand_init_chip(struct platform_device *pdev, ret =mtd_device_register (mtd,NULL ,0 );if (ret) { -nand_release (mtd); +nand_release (chip);return ret; }
@@ -308,7 +308,7 @@ static void jz4780_nand_cleanup_chips(struct jz4780_nand_controller *nfc)while (!list_empty (&nfc->chips)) { chip = list_first_entry(&nfc->chips, struct jz4780_nand_chip, chip_list); -nand_release (nand_to_mtd (&chip->chip)); +nand_release (&chip->chip);list_del (&chip->chip_list); } }
drivers/mtd/nand/lpc32xx_mlc.c +2 -3
@@ -805,7 +805,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)if (!res)return res; -nand_release (mtd); +nand_release (nand_chip); err_exit4:free_irq (host->irq, host);
@@ -828,9 +828,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)static int lpc32xx_nand_remove (struct platform_device *pdev) {struct lpc32xx_nand_host *host =platform_get_drvdata (pdev); -struct mtd_info *mtd =nand_to_mtd (&host->nand_chip); -nand_release (mtd); +nand_release (&host->nand_chip);free_irq (host->irq, host);if (use_dma)dma_release_channel (host->dma_chan);
drivers/mtd/nand/lpc32xx_slc.c +2 -3
@@ -940,7 +940,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)if (!res)return res; -nand_release (mtd); +nand_release (chip); err_exit3:dma_release_channel (host->dma_chan);
@@ -959,9 +959,8 @@ static int lpc32xx_nand_remove(struct platform_device *pdev) {uint32_t tmp;struct lpc32xx_nand_host *host =platform_get_drvdata (pdev); -struct mtd_info *mtd =nand_to_mtd (&host->nand_chip); -nand_release (mtd); +nand_release (&host->nand_chip);dma_release_channel (host->dma_chan);/* Force CE high */
drivers/mtd/nand/mpc5121_nfc.c +1 -1
@@ -827,7 +827,7 @@ static int mpc5121_nfc_remove(struct platform_device *op)struct device *dev = &op->dev;struct mtd_info *mtd =dev_get_drvdata (dev); -nand_release (mtd); +nand_release (mtd_to_nand (mtd));mpc5121_nfc_free (dev, mtd);return 0 ;
drivers/mtd/nand/mtk_nand.c +2 -2
@@ -1327,7 +1327,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc, ret =mtd_device_parse_register (mtd,NULL ,NULL ,NULL ,0 );if (ret) {dev_err (dev,"mtd parse partition error\n" ); -nand_release (mtd); +nand_release (nand);return ret; }
@@ -1450,7 +1450,7 @@ static int mtk_nfc_remove(struct platform_device *pdev)while (!list_empty (&nfc->chips)) { chip = list_first_entry(&nfc->chips, struct mtk_nfc_nand_chip, node); -nand_release (nand_to_mtd (&chip->nand)); +nand_release (&chip->nand);list_del (&chip->node); }
drivers/mtd/nand/mxc_nand.c +1 -1
@@ -1838,7 +1838,7 @@ static int mxcnd_remove(struct platform_device *pdev) {struct mxc_nand_host *host =platform_get_drvdata (pdev); -nand_release (nand_to_mtd (&host->nand)); +nand_release (&host->nand);if (host->clk_act)clk_disable_unprepare (host->clk);
drivers/mtd/nand/nand_base.c +4 -4
@@ -4941,12 +4941,12 @@ EXPORT_SYMBOL_GPL(nand_cleanup);/** * nand_release - [NAND Interface] Unregister the MTD device and free resources * held by the NAND device -* @mtd: MTD device structure +* @chip: NAND chip object */ -void nand_release (struct mtd_info *mtd) +void nand_release (struct nand_chip *chip) { -mtd_device_unregister (mtd); -nand_cleanup (mtd_to_nand (mtd)); +mtd_device_unregister (nand_to_mtd (chip)); +nand_cleanup (chip); }EXPORT_SYMBOL_GPL (nand_release);
drivers/mtd/nand/nandsim.c +2 -2
@@ -2394,7 +2394,7 @@ static int __init ns_init_module(void) err_exit:free_nandsim (nand); -nand_release (nsmtd); +nand_release (chip);for (i =0 ;i <ARRAY_SIZE (nand->partitions); ++i)kfree (nand->partitions[i].name); error:
@@ -2417,7 +2417,7 @@ static void __exit ns_cleanup_module(void)nandsim_debugfs_remove (ns);free_nandsim (ns);/* Free nandsim private resources */ -nand_release (nsmtd);/* Unregister driver */ +nand_release (chip);/* Unregister driver */ for (i =0 ;i <ARRAY_SIZE (ns->partitions); ++i)kfree (ns->partitions[i].name);kfree (mtd_to_nand (nsmtd));/* Free other structures */
drivers/mtd/nand/ndfc.c +1 -1
@@ -258,7 +258,7 @@ static int ndfc_remove(struct platform_device *ofdev)struct ndfc_controller *ndfc =dev_get_drvdata (&ofdev->dev);struct mtd_info *mtd =nand_to_mtd (&ndfc->chip); -nand_release (mtd); +nand_release (&ndfc->chip);kfree (mtd->name);return 0 ;
drivers/mtd/nand/nuc900_nand.c +1 -1
@@ -284,7 +284,7 @@ static int nuc900_nand_remove(struct platform_device *pdev) {struct nuc900_nand *nuc900_nand =platform_get_drvdata (pdev); -nand_release (nand_to_mtd (&nuc900_nand->chip)); +nand_release (&nuc900_nand->chip);clk_disable (nuc900_nand->clk);return 0 ;
drivers/mtd/nand/omap2.c +1 -1
@@ -2307,7 +2307,7 @@ static int omap_nand_remove(struct platform_device *pdev) }if (info->dma)dma_release_channel (info->dma); -nand_release (mtd); +nand_release (nand_chip);return 0 ; }
drivers/mtd/nand/orion_nand.c +2 -3
@@ -167,7 +167,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) mtd->name ="orion_nand" ; ret =mtd_device_register (mtd, board->parts, board->nr_parts);if (ret) { -nand_release (mtd); +nand_release (nc); goto no_dev; }
@@ -184,9 +184,8 @@ static int orion_nand_remove(struct platform_device *pdev) {struct orion_nand_info *info =platform_get_drvdata (pdev);struct nand_chip *chip = &info->chip; -struct mtd_info *mtd =nand_to_mtd (chip); -nand_release (mtd); +nand_release (chip);if (!IS_ERR (info->clk))clk_disable_unprepare (info->clk);
drivers/mtd/nand/pasemi_nand.c +1 -1
@@ -194,7 +194,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev) chip =mtd_to_nand (pasemi_nand_mtd);/* Release resources, unregister device */ -nand_release (pasemi_nand_mtd); +nand_release (chip);release_region (lpcctl,4 );
drivers/mtd/nand/plat_nand.c +2 -2
@@ -100,7 +100,7 @@ static int plat_nand_probe(struct platform_device *pdev)if (!err)return err; -nand_release (mtd); +nand_release (&data->chip); out:if (pdata->ctrl.remove) pdata->ctrl.remove (pdev);
@@ -115,7 +115,7 @@ static int plat_nand_remove(struct platform_device *pdev)struct plat_nand_data *data =platform_get_drvdata (pdev);struct platform_nand_data *pdata =dev_get_platdata (&pdev->dev); -nand_release (nand_to_mtd (&data->chip)); +nand_release (&data->chip);if (pdata->ctrl.remove) pdata->ctrl.remove (pdev);
drivers/mtd/nand/pxa3xx_nand.c +1 -1
@@ -1907,7 +1907,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)clk_disable_unprepare (info->clk);for (cs =0 ; cs < pdata->num_cs; cs++) -nand_release (nand_to_mtd (&info->host[cs]->chip)); +nand_release (&info->host[cs]->chip);return 0 ; }
drivers/mtd/nand/qcom_nandc.c +2 -2
@@ -2163,7 +2163,7 @@ static int qcom_nandc_probe(struct platform_device *pdev) err_cs_init:list_for_each_entry (host, &nandc->host_list, node) -nand_release (nand_to_mtd (&host->chip)); +nand_release (&host->chip); err_setup:clk_disable_unprepare (nandc->aon_clk); err_aon_clk:
@@ -2180,7 +2180,7 @@ static int qcom_nandc_remove(struct platform_device *pdev)struct qcom_nand_host *host;list_for_each_entry (host, &nandc->host_list, node) -nand_release (nand_to_mtd (&host->chip)); +nand_release (&host->chip);qcom_nandc_unalloc (nandc);
drivers/mtd/nand/r852.c +2 -2
@@ -656,7 +656,7 @@ static int r852_register_nand_device(struct r852_device *dev) dev->card_registred =1 ;return 0 ; error3: -nand_release (mtd); +nand_release (dev->chip); error1:/* Force card redetect */ dev->card_detected =0 ;
@@ -675,7 +675,7 @@ static void r852_unregister_nand_device(struct r852_device *dev)return ;device_remove_file (&mtd->dev, &dev_attr_media_type); -nand_release (mtd); +nand_release (dev->chip);r852_engine_disable (dev); dev->card_registred =0 ; }
drivers/mtd/nand/s3c2410.c +1 -1
@@ -768,7 +768,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)for (mtdno =0 ; mtdno < info->mtd_count; mtdno++, ptr++) {pr_debug ("releasing mtd %d (%p)\n" , mtdno, ptr); -nand_release (nand_to_mtd (&ptr->chip)); +nand_release (&ptr->chip); } }
drivers/mtd/nand/sh_flctl.c +1 -1
@@ -1229,7 +1229,7 @@ static int flctl_remove(struct platform_device *pdev)struct sh_flctl *flctl =platform_get_drvdata (pdev);flctl_release_dma (flctl); -nand_release (nand_to_mtd (&flctl->chip)); +nand_release (&flctl->chip);pm_runtime_disable (&pdev->dev);return 0 ;
drivers/mtd/nand/sharpsl.c +2 -2
@@ -192,7 +192,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)return 0 ; err_add: -nand_release (mtd); +nand_release (this); err_scan:iounmap (sharpsl->io);
@@ -210,7 +210,7 @@ static int sharpsl_nand_remove(struct platform_device *pdev)struct sharpsl_nand *sharpsl =platform_get_drvdata (pdev);/* Release resources, unregister device */ -nand_release (nand_to_mtd (&sharpsl->chip)); +nand_release (&sharpsl->chip);iounmap (sharpsl->io);
drivers/mtd/nand/socrates_nand.c +2 -3
@@ -203,7 +203,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)if (!res)return res; -nand_release (mtd); +nand_release (nand_chip); out:iounmap (host->io_base);
@@ -216,9 +216,8 @@ static int socrates_nand_probe(struct platform_device *ofdev)static int socrates_nand_remove (struct platform_device *ofdev) {struct socrates_nand_host *host =dev_get_drvdata (&ofdev->dev); -struct mtd_info *mtd =nand_to_mtd (&host->nand_chip); -nand_release (mtd); +nand_release (&host->nand_chip);iounmap (host->io_base);
drivers/mtd/nand/sunxi_nand.c +2 -2
@@ -2108,7 +2108,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc, ret =mtd_device_register (mtd,NULL ,0 );if (ret) {dev_err (dev,"failed to register mtd device: %d\n" , ret); -nand_release (mtd); +nand_release (nand);return ret; }
@@ -2147,7 +2147,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)while (!list_empty (&nfc->chips)) { chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip, node); -nand_release (nand_to_mtd (&chip->nand)); +nand_release (&chip->nand);sunxi_nand_ecc_cleanup (&chip->nand.ecc);list_del (&chip->node); }
drivers/mtd/nand/tmio_nand.c +2 -2
@@ -446,7 +446,7 @@ static int tmio_probe(struct platform_device *dev)if (!retval)return retval; -nand_release (mtd); +nand_release (nand_chip); err_irq:tmio_hw_stop (dev, tmio);
@@ -457,7 +457,7 @@ static int tmio_remove(struct platform_device *dev) {struct tmio_nand *tmio =platform_get_drvdata (dev); -nand_release (nand_to_mtd (&tmio->chip)); +nand_release (&tmio->chip);tmio_hw_stop (dev, tmio);return 0 ; }
drivers/mtd/nand/txx9ndfmc.c +1 -1
@@ -390,7 +390,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) chip =mtd_to_nand (mtd); txx9_priv =nand_get_controller_data (chip); -nand_release (mtd); +nand_release (chip);kfree (txx9_priv->mtdname);kfree (txx9_priv); }
drivers/mtd/nand/vf610_nfc.c +1 -1
@@ -795,7 +795,7 @@ static int vf610_nfc_remove(struct platform_device *pdev)struct mtd_info *mtd =platform_get_drvdata (pdev);struct vf610_nfc *nfc =mtd_to_nfc (mtd); -nand_release (mtd); +nand_release (mtd_to_nand (mtd));clk_disable_unprepare (nfc->clk);return 0 ; }
drivers/mtd/nand/xway_nand.c +2 -2
@@ -211,7 +211,7 @@ static int xway_nand_probe(struct platform_device *pdev) err =mtd_device_register (mtd,NULL ,0 );if (err) -nand_release (mtd); +nand_release (&data->chip);return err; }
@@ -223,7 +223,7 @@ static int xway_nand_remove(struct platform_device *pdev) {struct xway_nand_data *data =platform_get_drvdata (pdev); -nand_release (nand_to_mtd (&data->chip)); +nand_release (&data->chip);return 0 ; }
include/linux/mtd/nand.h +2 -4
@@ -24,6 +24,7 @@#include <linux/mtd/flashchip.h> #include <linux/mtd/bbm.h> +struct nand_chip ;struct mtd_info ;struct nand_flash_dev ;struct device_node ;
@@ -39,7 +40,7 @@ int nand_scan_ident(struct mtd_info *mtd, int max_chips,int nand_scan_tail (struct mtd_info *mtd);/* Unregister the MTD device and free resources held by the NAND device */ -void nand_release (struct mtd_info *mtd); +void nand_release (struct nand_chip *chip);/* Internal helper for board drivers which need to override command function */ void nand_wait_ready (struct mtd_info *mtd);
@@ -219,9 +220,6 @@ enum nand_ecc_algo {#define NAND_CI_CELLTYPE_MSK 0x0C#define NAND_CI_CELLTYPE_SHIFT 2 -/* Keep gcc happy */ -struct nand_chip ; -/* ONFI features */ #define ONFI_FEATURE_16_BIT_BUS (1 << 0)#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 120/191 mtd: rawnand: diskonchip: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit c5be12e45940f1aa1b5dfa04db5d15ad24f7c896 ]
Not sure nand_cleanup() is the right function to call here but in any case it is not nand_release(). Indeed, even a comment says that calling nand_release() is a bit of a hack as there is no MTD device to unregister. So switch to nand_cleanup() for now and drop this comment.
There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if it did not intruce
any bug.
--- drivers/mtd/nand/diskonchip.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/nand/diskonchip.c +2 -5
@@ -1605,13 +1605,10 @@ static int __init doc_probe(unsigned long physadr) numchips =doc2001_init (mtd);if ((ret =nand_scan (mtd, numchips)) || (ret = doc->late_init (mtd))) { -/* DBB note: i believe nand_release is necessary here, as +/* DBB note: i believe nand_cleanup is necessary here, as buffers may have been allocated in nand_base. Check with Thomas. FIX ME! */ -/* nand_release will call mtd_device_unregister, but we -haven't yet added it. This is handled without incident by -mtd_device_unregister, as far as I can tell. */ -nand_release (nand); +nand_cleanup (nand);kfree (nand); goto fail; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 121/191 mtd: rawnand: sharpsl: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 0f44b3275b3798ccb97a2f51ac85871c30d6fbbc ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense.
--- drivers/mtd/nand/sharpsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/sharpsl.c +1 -1
@@ -192,7 +192,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)return 0 ; err_add: -nand_release (this); +nand_cleanup (this); err_scan:iounmap (sharpsl->io);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 122/191 mtd: rawnand: xway: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 34531be5e804a8e1abf314a6c3a19fe342e4a154 ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/xway_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/xway_nand.c +1 -1
@@ -211,7 +211,7 @@ static int xway_nand_probe(struct platform_device *pdev) err =mtd_device_register (mtd,NULL ,0 );if (err) -nand_release (&data->chip); +nand_cleanup (&data->chip);return err; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 123/191 mtd: rawnand: orion: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit be238fbf78e4c7c586dac235ab967d3e565a4d1a ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/orion_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/orion_nand.c +1 -1
@@ -167,7 +167,7 @@ static int __init orion_nand_probe(struct platform_device *pdev) mtd->name ="orion_nand" ; ret =mtd_device_register (mtd, board->parts, board->nr_parts);if (ret) { -nand_release (nc); +nand_cleanup (nc); goto no_dev; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 124/191 mtd: rawnand: socrates: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 9c6c2e5cc77119ce0dacb4f9feedb73ce0354421 ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/socrates_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/socrates_nand.c +1 -1
@@ -203,7 +203,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)if (!res)return res; -nand_release (nand_chip); +nand_cleanup (nand_chip); out:iounmap (host->io_base);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 125/191 mtd: rawnand: plat_nand: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 5284024b4dac5e94f7f374ca905c7580dbc455e9 ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.
--- drivers/mtd/nand/plat_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/plat_nand.c +1 -1
@@ -100,7 +100,7 @@ static int plat_nand_probe(struct platform_device *pdev)if (!err)return err; -nand_release (&data->chip); +nand_cleanup (&data->chip); out:if (pdata->ctrl.remove) pdata->ctrl.remove (pdev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 126/191 mtd: rawnand: mtk: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 8a82bbcadec877f5f938c54026278dfc1f05a332 ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/mtk_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/mtk_nand.c +1 -1
@@ -1327,7 +1327,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc, ret =mtd_device_parse_register (mtd,NULL ,NULL ,NULL ,0 );if (ret) {dev_err (dev,"mtd parse partition error\n" ); -nand_release (nand); +nand_cleanup (nand);return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 127/191 mtd: rawnand: tmio: Fix the probe error path
In reply to Sasha LevinFrom: Miquel Raynal <[email protected]>
[ Upstream commit 75e9a330a9bd48f97a55a08000236084fe3dae56 ]
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/tmio_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/tmio_nand.c +1 -1
@@ -446,7 +446,7 @@ static int tmio_probe(struct platform_device *dev)if (!retval)return retval; -nand_release (nand_chip); +nand_cleanup (nand_chip); err_irq:tmio_hw_stop (dev, tmio);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 128/191 scsi: scsi_devinfo: handle non-terminated strings
In reply to Sasha LevinFrom: Martin Wilck <[email protected]>
commit ba69ead9e9e9bb3cec5faf03526c36764ac8942a upstream.
devinfo->vendor and devinfo->model aren't necessarily zero-terminated.
--- drivers/scsi/scsi_devinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/scsi_devinfo.c +3 -2
@@ -451,7 +451,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,/* * vendor strings must be an exact match */ -if (vmax !=strlen (devinfo->vendor) || +if (vmax !=strnlen (devinfo->vendor, +sizeof (devinfo->vendor)) ||memcmp (devinfo->vendor, vskip, vmax))continue ;
@@ -459,7 +460,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,* @model specifies the full string, and * must be larger or equal to devinfo->model */ - mlen =strlen (devinfo->model); + mlen =strnlen (devinfo->model,sizeof (devinfo->model));if (mmax < mlen ||memcmp (devinfo->model, mskip, mlen))continue ;return devinfo;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 129/191 l2tp: Allow duplicate session creation with UDP
In reply to Sasha LevinFrom: Ridge Kennedy <[email protected]>
commit 0d0d9a388a858e271bb70e71e99e7fe2a6fd6f64 upstream.
In the past it was possible to create multiple L2TPv3 sessions with the same session id as long as the sessions belonged to different tunnels. The resulting sessions had issues when used with IP encapsulated tunnels, but worked fine with UDP encapsulated ones. Some applications began to rely on this behaviour to avoid having to negotiate unique session ids.
Some time ago a change was made to require session ids to be unique across all tunnels, breaking the applications making use of this "feature".
This change relaxes the duplicate session id check to allow duplicates if both of the colliding sessions belong to UDP encapsulated tunnels.
--- net/l2tp/l2tp_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/l2tp/l2tp_core.c +6 -1
@@ -351,8 +351,13 @@ int l2tp_session_register(struct l2tp_session *session,spin_lock_bh (&pn->l2tp_session_hlist_lock); +/* IP encap expects session IDs to be globally unique, while +* UDP encap doesn't. +*/ hlist_for_each_entry (session_walk, g_head, global_hlist) -if (session_walk->session_id == session->session_id) { +if (session_walk->session_id == session->session_id && + (session_walk->tunnel->encap ==L2TP_ENCAPTYPE_IP || + tunnel->encap ==L2TP_ENCAPTYPE_IP )) { err = -EEXIST ; goto err_tlock_pnlock; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 130/191 net: sched: export __netdev_watchdog_up()
In reply to Sasha LevinFrom: Valentin Longchamp <[email protected]>
[ Upstream commit 1a3db27ad9a72d033235b9673653962c02e3486e ]
Since the quiesce/activate rework, __netdev_watchdog_up() is directly called in the ucc_geth driver.
Unfortunately, this function is not available for modules and thus ucc_geth cannot be built as a module anymore. Fix it by exporting __netdev_watchdog_up().
Since the commit introducing the regression was backported to stable branches, this one should ideally be as well.
--- net/sched/sch_generic.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_generic.c +1 -0
@@ -337,6 +337,7 @@ void __netdev_watchdog_up(struct net_device *dev)dev_hold (dev); } } +EXPORT_SYMBOL_GPL (__netdev_watchdog_up);static void dev_watchdog_up (struct net_device *dev) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 131/191 fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()"
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 9d964e1b82d8182184153b70174f445ea616f053 ]
lost npc in PTRACE_SETREGSET, breaking PTRACE_SETREGS as well
--- arch/sparc/kernel/ptrace_32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/sparc/kernel/ptrace_32.c +7 -2
@@ -167,12 +167,17 @@ static int genregs32_set(struct task_struct *target,if (ret || !count)return ret; ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, - ®s->y, + ®s->npc,34 *sizeof (u32),35 *sizeof (u32));if (ret || !count)return ret; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->y, +35 *sizeof (u32),36 *sizeof (u32)); +if (ret || !count) +return ret;return user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, -35 *sizeof (u32),38 *sizeof (u32)); +36 *sizeof (u32),38 *sizeof (u32)); } static int fpregs32_get(struct task_struct *target,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 132/191 mld: fix memory leak in ipv6_mc_destroy_dev()
In reply to Sasha LevinFrom: Wang Hai <[email protected]>
[ Upstream commit ea2fce88d2fd678ed9d45354ff49b73f1d5615dd ]
Commit a84d01647989 ("mld: fix memory leak in mld_del_delrec()") fixed the memory leak of MLD, but missing the ipv6_mc_destroy_dev() path, in which mca_sources are leaked after ma_put().
Using ip6_mc_clear_src() to take care of the missing free.
BUG: memory leak
unreferenced object 0xffff8881113d3180 (size 64):
comm "syz-executor071", pid 389, jiffies 4294887985 (age 17.943s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002cbc483c>] kmalloc include/linux/slab.h:555 [inline]
[<000000002cbc483c>] kzalloc include/linux/slab.h:669 [inline]
[<000000002cbc483c>] ip6_mc_add1_src net/ipv6/mcast.c:2237 [inline]
[<000000002cbc483c>] ip6_mc_add_src+0x7f5/0xbb0 net/ipv6/mcast.c:2357
[<0000000058b8b1ff>] ip6_mc_source+0xe0c/0x1530 net/ipv6/mcast.c:449
[<000000000bfc4fb5>] do_ipv6_setsockopt.isra.12+0x1b2c/0x3b30 net/ipv6/ipv6_sockglue.c:754
[<00000000e4e7a722>] ipv6_setsockopt+0xda/0x150 net/ipv6/ipv6_sockglue.c:950
[<0000000029260d9a>] rawv6_setsockopt+0x45/0x100 net/ipv6/raw.c:1081
[<000000005c1b46f9>] __sys_setsockopt+0x131/0x210 net/socket.c:2132
[<000000008491f7db>] __do_sys_setsockopt net/socket.c:2148 [inline]
[<000000008491f7db>] __se_sys_setsockopt net/socket.c:2145 [inline]
[<000000008491f7db>] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2145
[<00000000c7bc11c5>] do_syscall_64+0xa1/0x530 arch/x86/entry/common.c:295
[<000000005fb7a3f3>] entry_SYSCALL_64_after_hwframe+0x49/0xb3--- net/ipv6/mcast.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/mcast.c +1 -0
@@ -2601,6 +2601,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev) idev->mc_list = i->next;write_unlock_bh (&idev->lock); +ip6_mc_clear_src (i);ma_put (i);write_lock_bh (&idev->lock); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 133/191 net: fix memleak in register_netdevice()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 814152a89ed52c722ab92e9fbabcac3cb8a39245 ]
I got a memleak report when doing some fuzz test:
unreferenced object 0xffff888112584000 (size 13599):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s) hex dump (first 32 bytes):
74 61 70 30 00 00 00 00 00 00 00 00 00 00 00 00 tap0............
00 ee d9 19 81 88 ff ff 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002f60ba65>] __kmalloc_node+0x309/0x3a0
[<0000000075b211ec>] kvmalloc_node+0x7f/0xc0
[<00000000d3a97396>] alloc_netdev_mqs+0x76/0xfc0
[<00000000609c3655>] __tun_chr_ioctl+0x1456/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888111845cc0 (size 8):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
hex dump (first 8 bytes):
74 61 70 30 00 88 ff ff tap0....
backtrace:
[<000000004c159777>] kstrdup+0x35/0x70
[<00000000d8b496ad>] kstrdup_const+0x3d/0x50
[<00000000494e884a>] kvasprintf_const+0xf1/0x180
[<0000000097880a2b>] kobject_set_name_vargs+0x56/0x140
[<000000008fbdfc7b>] dev_set_name+0xab/0xe0
[<000000005b99e3b4>] netdev_register_kobject+0xc0/0x390
[<00000000602704fe>] register_netdevice+0xb61/0x1250
[<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff88811886d800 (size 512):
comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
hex dump (first 32 bytes):
00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N..........
ff ff ff ff ff ff ff ff c0 66 3d a3 ff ff ff ff .........f=.....
backtrace:
[<0000000050315800>] device_add+0x61e/0x1950
[<0000000021008dfb>] netdev_register_kobject+0x17e/0x390
[<00000000602704fe>] register_netdevice+0xb61/0x1250
[<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
[<000000001127ca24>] ksys_ioctl+0xe5/0x130
[<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
[<00000000e1023498>] do_syscall_64+0x56/0xa0
[<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9If call_netdevice_notifiers() failed, then rollback_registered() calls netdev_unregister_kobject() which holds the kobject. The reference cannot be put because the netdev won't be add to todo list, so it will leads a memleak, we need put the reference to avoid memleak.
--- net/core/dev.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/dev.c +7 -0
@@ -7355,6 +7355,13 @@ int register_netdevice(struct net_device *dev)rcu_barrier (); dev->reg_state =NETREG_UNREGISTERED ; +/* We should put the kobject that hold in +* netdev_unregister_kobject(), otherwise +* the net device cannot be freed when +* driver calls free_netdev(), because the +* kobject is being hold. +*/ +kobject_put (&dev->dev.kobj); }/* * Prevent userspace races by waiting until the network
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 134/191 net: usb: ax88179_178a: fix packet alignment padding
In reply to Sasha LevinFrom: Jeremy Kerr <[email protected]>
[ Upstream commit e869e7a17798d85829fa7d4f9bbe1eebd4b2d3f6 ]
Using a AX88179 device (0b95:1790), I see two bytes of appended data on every RX packet. For example, this 48-byte ping, using 0xff as a payload byte:
04:20:22.528472 IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 2447, seq 1, length 64
0x0000: 000a cd35 ea50 000a cd35 ea4f 0800 4500 0x0010: 0054 c116 4000 4001 f63e c0a8 0101 c0a8 0x0020: 0102 0800 b633 098f 0001 87ea cd5e 0000 0x0030: 0000 dcf2 0600 0000 0000 ffff ffff ffff 0x0040: ffff ffff ffff ffff ffff ffff ffff ffff 0x0050: ffff ffff ffff ffff ffff ffff ffff ffff 0x0060: ffff 961f
Those last two bytes - 96 1f - aren't part of the original packet.
In the ax88179 RX path, the usbnet rx_fixup function trims a 2-byte 'alignment pseudo header' from the start of the packet, and sets the length from a per-packet field populated by hardware. It looks like that length field *includes* the 2-byte header; the current driver assumes that it's excluded.
This change trims the 2-byte alignment header after we've set the packet length, so the resulting packet length is correct. While we're moving the comment around, this also fixes the spelling of 'pseudo'.
--- drivers/net/usb/ax88179_178a.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/usb/ax88179_178a.c +6 -5
@@ -1396,10 +1396,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) }if (pkt_cnt ==0 ) { -/* Skip IP alignment psudo header */ -skb_pull (skb,2 ); skb->len = pkt_len; -skb_set_tail_pointer (skb, pkt_len); +/* Skip IP alignment pseudo header */ +skb_pull (skb,2 ); +skb_set_tail_pointer (skb, skb->len); skb->truesize = pkt_len +sizeof (struct sk_buff );ax88179_rx_checksum (skb, pkt_hdr);return 1 ;
@@ -1408,8 +1408,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ax_skb =skb_clone (skb,GFP_ATOMIC );if (ax_skb) { ax_skb->len = pkt_len; - ax_skb->data = skb->data +2 ; -skb_set_tail_pointer (ax_skb, pkt_len); +/* Skip IP alignment pseudo header */ +skb_pull (ax_skb,2 ); +skb_set_tail_pointer (ax_skb, ax_skb->len); ax_skb->truesize = pkt_len +sizeof (struct sk_buff );ax88179_rx_checksum (ax_skb, pkt_hdr);usbnet_skb_return (dev, ax_skb);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 135/191 rocker: fix incorrect error handling in dma_rings_init
In reply to Sasha LevinFrom: Aditya Pakki <[email protected]>
[ Upstream commit 58d0c864e1a759a15c9df78f50ea5a5c32b3989e ]
In rocker_dma_rings_init, the goto blocks in case of errors caused by the functions rocker_dma_cmd_ring_waits_alloc() and rocker_dma_ring_create() are incorrect. The patch fixes the order consistent with cleanup in rocker_dma_rings_fini().
--- drivers/net/ethernet/rocker/rocker_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/rocker/rocker_main.c +2 -2
@@ -648,10 +648,10 @@ static int rocker_dma_rings_init(struct rocker *rocker) err_dma_event_ring_bufs_alloc:rocker_dma_ring_destroy (rocker, &rocker->event_ring); err_dma_event_ring_create: +rocker_dma_cmd_ring_waits_free (rocker); +err_dma_cmd_ring_waits_alloc:rocker_dma_ring_bufs_free (rocker, &rocker->cmd_ring,PCI_DMA_BIDIRECTIONAL ); -err_dma_cmd_ring_waits_alloc: -rocker_dma_cmd_ring_waits_free (rocker); err_dma_cmd_ring_bufs_alloc:rocker_dma_ring_destroy (rocker, &rocker->cmd_ring);return err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 136/191 rxrpc: Fix notification call on completion of discarded calls
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 0041cd5a50442db6e456b145892a0eaf2dff061f ]
When preallocated service calls are being discarded, they're passed to ->discard_new_call() to have the caller clean up any attached higher-layer preallocated pieces before being marked completed. However, the act of marking them completed now invokes the call's notification function - which causes a problem because that function might assume that the previously freed pieces of memory are still there.
Fix this by setting a dummy notification function on the socket after calling ->discard_new_call().
This results in the following kasan message when the kafs module is removed.
==================================================================
BUG: KASAN: use-after-free in afs_wake_up_async_call+0x6aa/0x770 fs/afs/rxrpc.c:707
Write of size 1 at addr ffff8880946c39e4 by task kworker/u4:1/21
CPU: 0 PID: 21 Comm: kworker/u4:1 Not tainted 5.8.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x18f/0x20d lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:383
__kasan_report mm/kasan/report.c:513 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
afs_wake_up_async_call+0x6aa/0x770 fs/afs/rxrpc.c:707
rxrpc_notify_socket+0x1db/0x5d0 net/rxrpc/recvmsg.c:40
__rxrpc_set_call_completion.part.0+0x172/0x410 net/rxrpc/recvmsg.c:76
__rxrpc_call_completed net/rxrpc/recvmsg.c:112 [inline]
rxrpc_call_completed+0xca/0xf0 net/rxrpc/recvmsg.c:111
rxrpc_discard_prealloc+0x781/0xab0 net/rxrpc/call_accept.c:233
rxrpc_listen+0x147/0x360 net/rxrpc/af_rxrpc.c:245
afs_close_socket+0x95/0x320 fs/afs/rxrpc.c:110
afs_net_exit+0x1bc/0x310 fs/afs/main.c:155
ops_exit_list.isra.0+0xa8/0x150 net/core/net_namespace.c:186
cleanup_net+0x511/0xa50 net/core/net_namespace.c:603
process_one_work+0x965/0x1690 kernel/workqueue.c:2269
worker_thread+0x96/0xe10 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:291
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
Allocated by task 6820:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc mm/kasan/common.c:494 [inline]
__kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:467
kmem_cache_alloc_trace+0x153/0x7d0 mm/slab.c:3551
kmalloc include/linux/slab.h:555 [inline]
kzalloc include/linux/slab.h:669 [inline]
afs_alloc_call+0x55/0x630 fs/afs/rxrpc.c:141
afs_charge_preallocation+0xe9/0x2d0 fs/afs/rxrpc.c:757
afs_open_socket+0x292/0x360 fs/afs/rxrpc.c:92
afs_net_init+0xa6c/0xe30 fs/afs/main.c:125
ops_init+0xaf/0x420 net/core/net_namespace.c:151
setup_net+0x2de/0x860 net/core/net_namespace.c:341
copy_net_ns+0x293/0x590 net/core/net_namespace.c:482
create_new_namespaces+0x3fb/0xb30 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:231
ksys_unshare+0x43d/0x8e0 kernel/fork.c:2983
__do_sys_unshare kernel/fork.c:3051 [inline]
__se_sys_unshare kernel/fork.c:3049 [inline]
__x64_sys_unshare+0x2d/0x40 kernel/fork.c:3049
do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 21:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
kasan_set_free_info mm/kasan/common.c:316 [inline]
__kasan_slab_free+0xf7/0x140 mm/kasan/common.c:455
__cache_free mm/slab.c:3426 [inline]
kfree+0x109/0x2b0 mm/slab.c:3757
afs_put_call+0x585/0xa40 fs/afs/rxrpc.c:190
rxrpc_discard_prealloc+0x764/0xab0 net/rxrpc/call_accept.c:230
rxrpc_listen+0x147/0x360 net/rxrpc/af_rxrpc.c:245
afs_close_socket+0x95/0x320 fs/afs/rxrpc.c:110
afs_net_exit+0x1bc/0x310 fs/afs/main.c:155
ops_exit_list.isra.0+0xa8/0x150 net/core/net_namespace.c:186
cleanup_net+0x511/0xa50 net/core/net_namespace.c:603
process_one_work+0x965/0x1690 kernel/workqueue.c:2269
worker_thread+0x96/0xe10 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:291
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
The buggy address belongs to the object at ffff8880946c3800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 484 bytes inside of
1024-byte region [ffff8880946c3800, ffff8880946c3c00)
The buggy address belongs to the page:
page:ffffea000251b0c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002546508 ffffea00024fa248 ffff8880aa000c40
raw: 0000000000000000 ffff8880946c3000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880946c3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880946c3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880946c3980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880946c3a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880946c3a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================--- net/rxrpc/call_accept.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/rxrpc/call_accept.c +7 -0
@@ -26,6 +26,11 @@#include <net/ip.h> #include "ar-internal.h" +static void rxrpc_dummy_notify (struct sock *sk,struct rxrpc_call *call, +unsigned long user_call_ID) +{ +} +/* * Preallocate a single service call, connection and peer and, if possible, * give them a user ID and attach the user's side of the ID to them.
@@ -224,6 +229,8 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)if (rx->discard_new_call) {_debug ("discard %lx" , call->user_call_ID); rx->discard_new_call (call, call->user_call_ID); +if (call->notify_rx) + call->notify_rx = rxrpc_dummy_notify;rxrpc_put_call (call, rxrpc_call_put_kernel); }rxrpc_call_completed (call);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 137/191 tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
In reply to Sasha LevinFrom: David Christensen <[email protected]>
[ Upstream commit 3a2656a211caf35e56afc9425e6e518fa52f7fbc ]
The driver function tg3_io_error_detected() calls napi_disable twice, without an intervening napi_enable, when the number of EEH errors exceeds eeh_max_freezes, resulting in an indefinite sleep while holding rtnl_lock.
Add check for pcierr_recovery which skips code already executed for the "Frozen" state.
--- drivers/net/ethernet/broadcom/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -2
@@ -18174,8 +18174,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,rtnl_lock (); -/* We probably don't have netdev yet */ -if (!netdev || !netif_running (netdev)) +/* Could be second call or maybe we don't have netdev yet */ +if (!netdev || tp->pcierr_recovery || !netif_running (netdev)) goto done;/* We needn't recover from permanent error */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 138/191 ip_tunnel: fix use-after-free in ip_tunnel_lookup()
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit ba61539c6ae57f4146284a5cb4f7b7ed8d42bf45 ]
In the datapath, the ip_tunnel_lookup() is used and it internally uses fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted. But there is no routine to set fb_tunnel_dev pointer to NULL. So, this pointer will be still used after interface is deleted and it eventually results in the use-after-free problem.
Test commands:
ip netns add A
ip netns add B
ip link add eth0 type veth peer name eth1
ip link set eth0 netns A
ip link set eth1 netns B
ip netns exec A ip link set lo up
ip netns exec A ip link set eth0 up
ip netns exec A ip link add gre1 type gre local 10.0.0.1 \
remote 10.0.0.2
ip netns exec A ip link set gre1 up
ip netns exec A ip a a 10.0.100.1/24 dev gre1
ip netns exec A ip a a 10.0.0.1/24 dev eth0
ip netns exec B ip link set lo up
ip netns exec B ip link set eth1 up
ip netns exec B ip link add gre1 type gre local 10.0.0.2 \
remote 10.0.0.1
ip netns exec B ip link set gre1 up
ip netns exec B ip a a 10.0.100.2/24 dev gre1
ip netns exec B ip a a 10.0.0.2/24 dev eth1
ip netns exec A hping3 10.0.100.2 -2 --flood -d 60000 & ip netns del B
Splat looks like:
[ 77.793450][ C3] ================================================================== [ 77.794702][ C3] BUG: KASAN: use-after-free in ip_tunnel_lookup+0xcc4/0xf30 [ 77.795573][ C3] Read of size 4 at addr ffff888060bd9c84 by task hping3/2905 [ 77.796398][ C3] [ 77.796664][ C3] CPU: 3 PID: 2905 Comm: hping3 Not tainted 5.8.0-rc1+ #616 [ 77.797474][ C3] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 77.798453][ C3] Call Trace: [ 77.798815][ C3] <IRQ> [ 77.799142][ C3] dump_stack+0x9d/0xdb [ 77.799605][ C3] print_address_description.constprop.7+0x2cc/0x450 [ 77.800365][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.800908][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.801517][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.802145][ C3] kasan_report+0x154/0x190 [ 77.802821][ C3] ? ip_tunnel_lookup+0xcc4/0xf30 [ 77.803503][ C3] ip_tunnel_lookup+0xcc4/0xf30 [ 77.804165][ C3] __ipgre_rcv+0x1ab/0xaa0 [ip_gre] [ 77.804862][ C3] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 77.805621][ C3] gre_rcv+0x304/0x1910 [ip_gre] [ 77.806293][ C3] ? lock_acquire+0x1a9/0x870 [ 77.806925][ C3] ? gre_rcv+0xfe/0x354 [gre] [ 77.807559][ C3] ? erspan_xmit+0x2e60/0x2e60 [ip_gre] [ 77.808305][ C3] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 77.809032][ C3] ? rcu_read_lock_held+0x90/0xa0 [ 77.809713][ C3] gre_rcv+0x1b8/0x354 [gre]
[ ... ]
--- net/ipv4/ip_tunnel.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/ipv4/ip_tunnel.c +8 -6
@@ -98,9 +98,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, __be32 remote, __be32 local, __be32 key) { - unsigned int hash; struct ip_tunnel *t, *cand = NULL;struct hlist_head *head; +struct net_device *ndev; +unsigned int hash; hash =ip_tunnel_hash (key, remote); head = &itn->tunnels[hash];
@@ -175,8 +176,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,if (t)return t; -if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags &IFF_UP ) -return netdev_priv (itn->fb_tunnel_dev); + ndev =READ_ONCE (itn->fb_tunnel_dev); +if (ndev && ndev->flags &IFF_UP ) +return netdev_priv (ndev);return NULL ; }
@@ -1193,9 +1195,9 @@ void ip_tunnel_uninit(struct net_device *dev)struct ip_tunnel_net *itn; itn =net_generic (net, tunnel->ip_tnl_net_id); -/* fb_tunnel_dev will be unregisted in net-exit call. */ -if (itn->fb_tunnel_dev != dev) -ip_tunnel_del (itn,netdev_priv (dev)); +ip_tunnel_del (itn,netdev_priv (dev)); +if (itn->fb_tunnel_dev == dev) +WRITE_ONCE (itn->fb_tunnel_dev,NULL );dst_cache_reset (&tunnel->dst_cache); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 139/191 tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
In reply to Sasha LevinFrom: Neal Cardwell <[email protected]>
[ Upstream commit b344579ca8478598937215f7005d6c7b84d28aee ]
Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an ACK when the minimum rtt of a connection goes down. From inspection it is clear from the existing code that this could happen in an example like the following:
o The first 8 RTT samples in a round trip are 150ms, resulting in a curr_rtt of 150ms and a delay_min of 150ms.
o The 9th RTT sample is 100ms. The curr_rtt does not change after the first 8 samples, so curr_rtt remains 150ms. But delay_min can be lowered at any time, so delay_min falls to 100ms. The code executes the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min of 100ms, and the curr_rtt is declared far enough above delay_min to force a (spurious) exit of Slow start.
The fix here is simple: allow every RTT sample in a round trip to lower the curr_rtt.
--- net/ipv4/tcp_cubic.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/tcp_cubic.c +2 -0
@@ -414,6 +414,8 @@ static void hystart_update(struct sock *sk, u32 delay)if (hystart_detect &HYSTART_DELAY ) {/* obtain the minimum delay of more than sampling packets */ +if (ca->curr_rtt > delay) + ca->curr_rtt = delay;if (ca->sample_cnt <HYSTART_MIN_SAMPLES ) {if (ca->curr_rtt ==0 || ca->curr_rtt > delay) ca->curr_rtt = delay;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 140/191 ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
In reply to Sasha LevinFrom: Taehee Yoo <[email protected]>
[ Upstream commit dafabb6590cb15f300b77c095d50312e2c7c8e0f ]
In the datapath, the ip6gre_tunnel_lookup() is used and it internally uses fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted. But there is no routine to set fb_tunnel_dev pointer to NULL. So, this pointer will be still used after interface is deleted and it eventually results in the use-after-free problem.
Test commands:
ip netns add A
ip netns add B
ip link add eth0 type veth peer name eth1
ip link set eth0 netns A
ip link set eth1 netns B
ip netns exec A ip link set lo up
ip netns exec A ip link set eth0 up
ip netns exec A ip link add ip6gre1 type ip6gre local fc:0::1 \
remote fc:0::2
ip netns exec A ip -6 a a fc:100::1/64 dev ip6gre1 ip netns exec A ip link set ip6gre1 up
ip netns exec A ip -6 a a fc:0::1/64 dev eth0
ip netns exec A ip link set ip6gre0 up
ip netns exec B ip link set lo up
ip netns exec B ip link set eth1 up
ip netns exec B ip link add ip6gre1 type ip6gre local fc:0::2 \
remote fc:0::1
ip netns exec B ip -6 a a fc:100::2/64 dev ip6gre1 ip netns exec B ip link set ip6gre1 up
ip netns exec B ip -6 a a fc:0::2/64 dev eth1
ip netns exec B ip link set ip6gre0 up
ip netns exec A ping fc:100::2 -s 60000 &
ip netns del B
Splat looks like:
[ 73.087285][ C1] BUG: KASAN: use-after-free in ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.088361][ C1] Read of size 4 at addr ffff888040559218 by task ping/1429 [ 73.089317][ C1] [ 73.089638][ C1] CPU: 1 PID: 1429 Comm: ping Not tainted 5.7.0+ #602 [ 73.090531][ C1] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 73.091725][ C1] Call Trace: [ 73.092160][ C1] <IRQ> [ 73.092556][ C1] dump_stack+0x96/0xdb [ 73.093122][ C1] print_address_description.constprop.6+0x2cc/0x450 [ 73.094016][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.094894][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.095767][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.096619][ C1] kasan_report+0x154/0x190 [ 73.097209][ C1] ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.097989][ C1] ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre] [ 73.098750][ C1] ? gre_del_protocol+0x60/0x60 [gre] [ 73.099500][ C1] gre_rcv+0x1c5/0x1450 [ip6_gre] [ 73.100199][ C1] ? ip6gre_header+0xf00/0xf00 [ip6_gre] [ 73.100985][ C1] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 73.101830][ C1] ? ip6_input_finish+0x5/0xf0 [ 73.102483][ C1] ip6_protocol_deliver_rcu+0xcbb/0x1510 [ 73.103296][ C1] ip6_input_finish+0x5b/0xf0 [ 73.103920][ C1] ip6_input+0xcd/0x2c0 [ 73.104473][ C1] ? ip6_input_finish+0xf0/0xf0 [ 73.105115][ C1] ? rcu_read_lock_held+0x90/0xa0 [ 73.105783][ C1] ? rcu_read_lock_sched_held+0xc0/0xc0 [ 73.106548][ C1] ipv6_rcv+0x1f1/0x300
[ ... ]
--- net/ipv6/ip6_gre.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv6/ip6_gre.c +6 -3
@@ -124,6 +124,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,int dev_type = (gre_proto ==htons (ETH_P_TEB )) ?ARPHRD_ETHER :ARPHRD_IP6GRE ;int score, cand_score =4 ; +struct net_device *ndev;for_each_ip_tunnel_rcu (t, ign->tunnels_r_l[h0 ^ h1]) { if (!ipv6_addr_equal(local, &t->parms.laddr) ||
@@ -226,9 +227,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,if (cand)return cand; - dev = ign->fb_tunnel_dev; -if (dev->flags &IFF_UP ) -return netdev_priv (dev); + ndev =READ_ONCE (ign->fb_tunnel_dev); +if (ndev && ndev->flags &IFF_UP ) +return netdev_priv (ndev);return NULL ; }
@@ -364,6 +365,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)struct ip6gre_net *ign =net_generic (t->net, ip6gre_net_id);ip6gre_tunnel_unlink (ign, t); +if (ign->fb_tunnel_dev == dev) +WRITE_ONCE (ign->fb_tunnel_dev,NULL );dst_cache_reset (&t->dst_cache);dev_put (dev); }
Signature · 1 line
2.25.1