version 4.19.325-cip131
* tag 'v4.19.325-cip131' of https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip:
CIP: Bump version suffix to -cip131 after merge from cip/linux-4.19.y-st tree
Update localversion-st, tree is up-to-date with 5.10.252.
nfsd: fix return error code for nfsd_map_name_to_[ug]id
net: usb: pegasus: enable basic endpoint checking
Bluetooth: L2CAP: Fix not checking l2cap_chan security level
Bluetooth: Enforce key size of 16 bytes on FIPS level
xfrm6: fix uninitialized saddr in xfrm6_get_saddr()
netfilter: nf_conntrack: Add allow_clash to generic protocol handler
ext4: don't cache extent during splitting extent
NTB: ntb_transport: Fix too small buffer for debugfs_name
net: ethernet: ec_bhf: Fix dma_free_coherent() dma handle
fbdev: ffb: fix corrupted video output on Sun FFB1
fbdev: of: display_timing: fix refcount leak in of_get_display_timings()
atm: fore200e: fix use-after-free in tasklets during device removal
net: wan/fsl_ucc_hdlc: Fix dma_free_coherent() in uhdlc_memclean()
net: ethernet: marvell: skge: remove incorrect conflicting PCI ID
ceph: supply snapshot context in ceph_zero_partial_object()
MIPS: rb532: Fix MMIO UART resource registration
parisc: kernel: replace kfree() with put_device() in create_tree_node()
drm/amdkfd: Fix out-of-bounds write in kfd_event_page_set()
usb: dwc2: fix resume failure if dr_mode is host
btrfs: continue trimming remaining devices on failure
kexec: derive purgatory entry from symbol
ocfs2: fix reflink preserve cleanup issue
ocfs2: fix xattr array entry __counted_by error
rapidio: replace rio_free_net() with kfree() in rio_scan_alloc_net()
iio: gyro: itg3200: Fix unchecked return value in read_raw
dm mpath: make pg_init_delay_msecs settable
bus: fsl-mc: fix an error handling in fsl_mc_device_add()
md/bitmap: fix GPF in write_page caused by resize race
xfs: fix remote xattr valuelblk check
xfs: fix freemap adjustments when adding xattrs to leaf blocks
xfs: delete attr leaf freemap entries when empty
xfs: mark data structures corrupt on EIO and ENODATA
mm, page_alloc, thp: prevent reclaim for __GFP_THISNODE THP allocations
drm: of: drm_of_panel_bridge_remove(): fix device_node leak
dm-unstripe: fix mapping bug when there are multiple targets in a table
clk: tegra: tegra124-emc: Fix potential memory leak in tegra124_clk_register_emc()
dm: clear cloned request bio pointer when last clone bio completes
media: i2c/tw9906: Fix potential memory leak in tw9906_probe()
media: i2c/tw9903: Fix potential memory leak in tw9903_probe()
media: cx25821: Add missing unmap in snd_cx25821_hw_params()
media: cx23885: Add missing unmap in snd_cx23885_hw_params()
media: cx88: Add missing unmap in snd_cx88_hw_params()
media: radio-keene: fix memory leak in error path
HID: prodikeys: Check presence of pm->input_ep82
HID: magicmouse: Do not crash on missing msc->input
HID: hid-pl: handle probe errors
media: mtk-mdp: Fix a reference leak bug in mtk_mdp_remove()
dm-verity: correctly handle dm_bufio_client_create() failure
fpga: dfl: use subsys_initcall to allow built-in drivers to be added
rpmsg: core: fix race in driver_override_show() and use core helper
netfilter: nf_conntrack_h323: fix OOB read in decode_choice()
net: consume xmit errors of GSO frames
Bluetooth: L2CAP: Fix missing key size check for L2CAP_LE_CONN_REQ
Bluetooth: l2cap: Check encryption key size on incoming connection
wifi: cfg80211: wext: fix IGTK key ID off-by-one
net: usb: lan78xx: scan all MDIO addresses on LAN7801
lan78xx: Fix memory allocation bug
lan78xx: Fix race condition in disconnect handling
lan78xx: Remove unused pause frame queue
net: usb: kaweth: remove TX queue manipulation in kaweth_set_rx_mode
ntb: ntb_hw_switchtec: Fix shift-out-of-bounds for 0 mw lut
ntb: ntb_hw_switchtec: Fix array-index-out-of-bounds access
drm/radeon: Add HAINAN clock adjustment
drm/amdgpu: Add HAINAN clock adjustment
ARM: 9467/1: mm: Don't use %pK through printk
include: uapi: netfilter_bridge.h: Cover for musl libc
iio: magnetometer: Remove IRQF_ONESHOT
Revert "mfd: da9052-spi: Change read-mask to write-mask"
binder: don't use %pK through printk
serial: 8250_dw: handle clock enable errors in runtime_resume
m68k: nommu: fix memmove() with differently aligned src and dest for 68000
clk: microchip: core: correct return value on *_get_parent()
nfc: nxp-nci: remove interrupt trigger type
myri10ge: avoid uninitialized variable use
PCI: Mark Nvidia GB10 to avoid bus reset
PCI: Fix pci_slot_lock () device locking
PCI: Mark ASM1164 SATA controller to avoid bus reset
net/rds: Clear reconnect pending bit
vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
net: usb: sr9700: remove code to drive nonexistent multicast filter
Bluetooth: btusb: Add device ID for Realtek RTL8761BU
Bluetooth: hci_conn: use mod_delayed_work for active mode timeout
ipv4: fib: Annotate access to struct fib_alias.fa_state.
wifi: iwlegacy: add missing mutex protection in il3945_store_measurement()
wifi: iwlegacy: add missing mutex protection in il4965_store_tx_power()
net/rds: No shortcut out of RDS_CONN_ERROR
net: usb: r8152: fix transmit queue timeout
openrisc: define arch-specific version of nop()
netfilter: xt_tcpmss: check remaining length before reading optlen
wifi: libertas: fix WARNING in usb_tx_block
jfs: nlink overflow in jfs_rename
jfs: Add missing set_freezable() for freezable kthread
modpost: Amend ppc64 save/restfpr symnames for -Os build
ASoC: es8328: Add error unwind in resume
HID: multitouch: add eGalaxTouch EXC3188 support
drm/atmel-hlcdc: fix use-after-free of drm_crtc_commit after release
drm/atmel-hlcdc: fix memory leak from the atomic_destroy_state callback
virt: vbox: uapi: Mark inner unions in packed structs as packed
hyper-v: Mark inner union in hv_kvp_exchg_msg_value as packed
drm: Account property blob allocations to memcg
media: cx25821: Fix a resource leak in cx25821_dev_setup()
media: solo6x10: Check for out of bounds chip_id
media: pvrusb2: fix URB leak in pvr2_send_request_ex
media: adv7180: fix frame interval in progressive mode
ASoC: wm8962: Add WM8962_ADC_MONOMIX to "3D Coefficients" mask
media: omap3isp: set initial format
media: omap3isp: isppreview: always clamp in preview_try_format()
media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes
media: dvb-core: dmxdevfilter must always flush bufs
parisc: Prevent interrupts during reboot
arm64: tegra: smaug: Add usb-role-switch support
pstore: ram_core: fix incorrect success return when vmap() fails
mailbox: bcm-ferxrm-mailbox: Use default primary handler
clocksource/drivers/sh_tmu: Always leave device running after probe
sparc: don't reference obsolete termio struct for TC* constants
xenbus: Use .freeze/.thaw to handle xenbus devices
ACPICA: Abort AML bytecode execution when executing AML_FATAL_OP
EFI/CPER: don't go past the ARM processor CPER record buffer
x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set
s390/purgatory: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS
tools/power cpupower: Reset errno before strtoull()
minix: Add required sanity checking to minix_check_superblock()
hfsplus: pretend special inodes as regular files
audit: add missing syscalls to read class
hfsplus: fix volume corruption issue for generic/498
audit: add fchmodat2() to change attributes class
rtc: interface: Alarm race handling should not discard preceding error
SUNRPC: fix gss_auth kref leak in gss_alloc_msg error path
SUNRPC: auth_gss: fix memory leaks in XDR decoding error paths
ata: pata_ftide010: Fix some DMA timings
ext4: fix memory leak in ext4_ext_shift_extents()
MIPS: Work around LLVM bug when gp is used as global register variable
apparmor: fix invalid deref of rawdata when export_binary is unset
apparmor: fix rlimit for posix cpu timers
apparmor: fix NULL sock in aa_sock_file_perm
bonding: alb: fix UAF in rlb_arp_recv during bond up/down
macvlan: observe an RCU grace period in macvlan_common_newlink() error path
netfilter: nf_conntrack_h323: don't pass uninitialised l3num value
net/rds: rds_sendmsg should not discard payload_len
xen-netback: reject zero-queue configuration from guest
net: usb: catc: enable basic endpoint checking
usbb: catc: use correct API for MAC addresses
cpuidle: Skip governor when only one idle state is available
pinctrl: single: fix refcount leak in pcs_add_gpio_func()
iio: sca3000: Fix a resource leak in sca3000_probe()
ovl: Fix uninit-value in ovl_fill_real
drivers: iio: mpu3050: use dev_err_probe for regulator request
mfd: arizona: Fix regulator resource leak on wm5102_clear_write_sequencer() failure
Revert "mmc: rtsx_pci_sdmmc: increase power-on settling delay to 5ms"
mmc: rtsx_pci_sdmmc: increase power-on settling delay to 5ms
mmc: core: Initial support for SD express card/host
serial: SH_SCI: improve "DMA support" prompt
staging: greybus: lights: avoid NULL deref
fbdev: au1200fb: Fix a memory leak in au1200fb_drv_probe()
tracing: Remove duplicate ENABLE_EVENT_STR and DISABLE_EVENT_STR macros
scsi: csiostor: Fix dereference of null pointer rn
pNFS: fix a missing wake up while waiting on NFS_LAYOUT_DRAIN
svcrdma: Remove queue-shortening warnings
RDMA/core: Fix a couple of obvious typos in comments
power: supply: wm97xx_battery: Convert to GPIO descriptor
power: supply: bq27xxx: fix wrong errno when bus ops are unsupported
power: supply: sbs-battery: Fix use-after-free in power_supply_changed()
power: supply: rt9455: Fix use-after-free in power_supply_changed()
power: supply: act8945a: Fix use-after-free in power_supply_changed()
serial: caif: fix use-after-free in caif_serial ldisc_close()
net: atm: fix crash due to unvalidated vcc pointer in sigd_send()
procfs: fix missing RCU protection when reading real_parent in do_task_stat()
netfilter: nft_set_rbtree: check for partial overlaps in anonymous sets
netfilter: nft_set_hash: fix get operation on big endian
bonding: only set speed/duplex to unknown, if getting speed failed
ucount: check for CAP_SYS_RESOURCE using ns_capable_noaudit()
tcp: tcp_tx_timestamp() must look at the rtx queue
fat: avoid parent link count underflow in rmdir
PCI: Mark 3ware-9650SA Root Port Extended Tags as broken
netfilter: nf_conncount: fix tracking of connections from localhost
netfilter: nf_conncount: increase the connection clean up limit to 64
netfilter: nf_conncount: make nf_conncount_gc_list() to disable BH
wifi: cfg80211: stop NAN and P2P in cfg80211_leave
PCI/portdrv: Fix potential resource leak
PCI: Do not attempt to set ExtTag for VFs
PCI: mediatek: Fix IRQ domain leak when MSI allocation fails
Revert "hwmon: (ibmpex) fix use-after-free in high/low store"
spi: tools: Add include folder to .gitignore
regulator: Flag uncontrollable regulators as always_on
regulator: core: Respect off_on_delay at startup
smack: /smack/doi: accept previously used values
smack: /smack/doi must be > 0
arm64: dts: amlogic: gx: assign the MMC signal clocks
ARM: dts: allwinner: sun5i-a13-utoo-p66: delete "power-gpios" property
EDAC/i5400: Fix snprintf() limit calculation in calculate_dimm_size()
EDAC/i5000: Fix snprintf() size calculation in calculate_dimm_size()
pstore/ram: fix buffer overflow in persistent_ram_save_old()
sched/rt: Skip currently executing CPU in rto_next_cpu()
mfd: wm8350-core: Use IRQF_ONESHOT
EDAC/altera: Remove IRQF_ONESHOT
hrtimer: Fix trace oddity
crypto: cavium - fix dma_free_coherent() size
s390/cio: Fix device lifecycle handling in css_alloc_subchannel()
PM: sleep: wakeirq: harden dev_pm_clear_wake_irq() against races
md/raid10: fix any_working flag handling in raid10_sync_request
tpm: st33zp24: Fix missing cleanup on get_burstcount() error
tpm: tpm_i2c_infineon: Fix locality leak on get_burstcount() failure
gfs2: Add metapath_dibh helper
gfs2: Add wrapper for iomap_file_buffered_write
fs: add <linux/init_task.h> for 'init_fs'
hfsplus: return error when node already exists in hfs_bnode_create
auxdisplay: arm-charlcd: fix release_mem_region() size
RDMA/umad: Reject negative data_len in ib_umad_write
Change-Id: Ice1efa8b2faaaab14d1d1563e5aa6ae36549682b
[ Upstream commit 81be22cd4ace020045cc6d31255c6f7c071eb7c0 ]
Commit 795cda8338ea ("rtc: interface: Fix long-standing race when setting
alarm") should not discard any errors from the preceding validations.
Prior to that commit, if the alarm feature was disabled, or the
set_alarm failed, a meaningful error code would be returned to the
caller for further action.
After, more often than not, the __rtc_read_time will cause a success
return code instead, misleading the caller.
An example of this is when timer_enqueue is called for a rtc-abx080x
device. Since that driver does not clear the alarm feature bit, but
instead relies on the set_alarm operation to return invalid, the discard
of the return code causes very different behaviour; i.e.
hwclock: select() to /dev/rtc0 to wait for clock tick timed out
Fixes: 795cda8338ea ("rtc: interface: Fix long-standing race when setting alarm")
Signed-off-by: Anthony Pighin (Nokia) <anthony.pighin@nokia.com>
Reviewed-by: Esben Haabendal <esben@geanix.com>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Link: https://patch.msgid.link/BN0PR08MB6951415A751F236375A2945683D1A@BN0PR08MB6951.namprd08.prod.outlook.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
version 4.19.325-cip126
* tag 'v4.19.325-cip126' of https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip:
CIP: Bump version suffix to -cip126 after merge from cip/linux-4.19.y-st tree
net: ravb: Ensure memory write completes before ringing TX doorbell
Update localversion-st, tree is up-to-date with 5.4.301.
net: ravb: Ensure memory write completes before ringing TX doorbell
net/ip6_tunnel: Prevent perpetual tunnel growth
tracing: Fix race condition in kprobe initialization causing NULL pointer dereference
rtc: interface: Ensure alarm irq is enabled when UIE is enabled
tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
media: s5p-mfc: remove an unused/uninitialized variable
NFSD: Fix last write offset handling in layoutcommit
NFSD: Minor cleanup in layoutcommit processing
KEYS: trusted_tpm1: Compare HMAC values in constant time
NFSD: Define a proc_layoutcommit for the FlexFiles layout type
vfs: Don't leak disconnected dentries on umount
ext4: detect invalid INLINE_DATA + EXTENTS flag combination
drm/amdgpu: use atomic functions with memory barriers for vm fault info
ext4: avoid potential buffer over-read in parse_apply_sb_mount_options()
spi: cadence-quadspi: Flush posted register writes before DAC access
spi: cadence-quadspi: Flush posted register writes before INDAC access
memory: samsung: exynos-srom: Fix of_iomap leak in exynos_srom_probe
memory: samsung: exynos-srom: Correct alignment
arm64: cputype: Add Neoverse-V3AE definitions
comedi: fix divide-by-zero in comedi_buf_munge()
binder: remove "invalid inc weak" check
xhci: dbc: enable back DbC in resume if it was enabled before suspend
usb/core/quirks: Add Huawei ME906S to wakeup quirk
USB: serial: option: add Telit FN920C04 ECM compositions
USB: serial: option: add Quectel RG255C
USB: serial: option: add UNISOC UIS7720
net: usb: rtl8150: Fix frame padding
ocfs2: clear extent cache after moving/defragmenting extents
MIPS: Malta: Fix keyboard resource preventing i8042 driver from registering
Revert "cpuidle: menu: Avoid discarding useful information"
sctp: avoid NULL dereference when chunk data buffer is missing
arm64, mm: avoid always making PTE dirty in pte_mkwrite()
net: add ndo_fdb_del_bulk
net: netlink: add NLM_F_BULK delete request modifier
net: rtnetlink: use BIT for flag values
net: rtnetlink: add helper to extract msg type's kind
net: rtnetlink: add msg kind names
net: rtnetlink: remove redundant assignment to variable err
m68k: bitops: Fix find_*_bit() signatures
hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super()
hfs: fix KMSAN uninit-value issue in hfs_find_set_zero_bits()
dlm: check for defined force value in dlm_lockspace_release
hfsplus: fix KMSAN uninit-value issue in hfsplus_delete_cat()
hfs: validate record offset in hfsplus_bmap_alloc
hfsplus: fix KMSAN uninit-value issue in __hfsplus_ext_cache_extent()
hfs: make proper initalization of struct hfs_find_data
hfs: clear offset and space out of valid records in b-tree node
exec: Fix incorrect type for ret
hfsplus: fix slab-out-of-bounds read in hfsplus_strcasecmp()
tls: always set record_type in tls_process_cmsg
tg3: prevent use of uninitialized remote_adv and local_adv variables
amd-xgbe: Avoid spurious link down messages during interface toggle
net: dlink: handle dma_map_single() failure properly
net: dl2k: switch from 'pci_' to 'dma_' API
xen/events: Update virq_to_irq on migration
media: lirc: Fix error handling in lirc_register()
media: rc: Directly use ida_free()
drm/exynos: exynos7_drm_decon: remove ctx->suspended
btrfs: avoid potential out-of-bounds in btrfs_encode_fh()
pwm: berlin: Fix wrong register in suspend/resume
media: cx18: Add missing check after DMA map
xen/events: Cleanup find_virq() return codes
cramfs: Verify inode mode when loading from disk
pid: Add a judgment for ns null in pid_nr_ns
minixfs: Verify inode mode when loading from disk
mfd: intel_soc_pmic_chtdc_ti: Drop unneeded assignment for cache_type
mfd: intel_soc_pmic_chtdc_ti: Fix invalid regmap-config max_register value
Squashfs: reject negative file sizes in squashfs_read_inode()
Squashfs: add additional inode sanity checking
mfd: vexpress-sysreg: Check the return value of devm_gpiochip_add_data()
fs: udf: fix OOB read in lengthAllocDescs handling
KVM: x86: Don't (re)check L1 intercepts when completing userspace I/O
net/9p: fix double req put in p9_fd_cancelled
ext4: guard against EA inode refcount underflow in xattr update
ext4: correctly handle queries for metadata mappings
ext4: increase i_disksize to offset + len in ext4_update_disksize_before_punch()
nfsd: nfserr_jukebox in nlm_fopen should lead to a retry
x86/umip: Fix decoding of register forms of 0F 01 (SGDT and SIDT aliases)
x86/umip: Check that the instruction opcode is at least two bytes
PCI/AER: Fix missing uevent on recovery when a reset is requested
rtc: interface: Fix long-standing race when setting alarm
mmc: core: SPI mode remove cmd7
mtd: rawnand: fsmc: Default to autodetect buswidth
sparc64: fix hugetlb for sun4u
sctp: Fix MAC comparison to be constant-time
scsi: hpsa: Fix potential memory leak in hpsa_big_passthru_ioctl()
parisc: don't reference obsolete termio struct for TC* constants
lib/genalloc: fix device leak in of_gen_pool_get()
iio: frequency: adf4350: Fix prescaler usage.
iio: dac: ad5421: use int type to store negative error codes
iio: dac: ad5360: use int type to store negative error codes
crypto: atmel - Fix dma_unmap_sg() direction
drm/nouveau: fix bad ret code in nouveau_bo_move_prep
media: i2c: mt9v111: fix incorrect type for ret
ACPI: debug: fix signedness issues in read/write helpers
tools build: Align warning options with perf
net: fsl_pq_mdio: Fix device node reference leak in fsl_pq_mdio_probe
tcp: Don't call reqsk_fastopen_remove() in tcp_conn_request().
net/sctp: fix a null dereference in sctp_disposition sctp_sf_do_5_1D_ce()
net/mlx4: prevent potential use after free in mlx4_en_do_uc_filter()
scsi: mvsas: Fix use-after-free bugs in mvs_work_queue
clk: nxp: Fix pll0 rate check condition in LPC18xx CGU driver
clk: nxp: lpc18xx-cgu: convert from round_rate() to determine_rate()
perf session: Fix handling when buffer exceeds 2 GiB
perf util: Fix compression checks returning -1 as bool
iio: frequency: adf4350: Fix ADF4350_REG3_12BIT_CLKDIV_MODE
pinctrl: check the return value of pinmux_ops::get_function_name()
Input: uinput - zero-initialize uinput_ff_upload_compat to avoid info leak
mm: hugetlb: avoid soft lockup when mprotect to large memory area
Squashfs: fix uninit-value in squashfs_get_parent
net: ena: return 0 in ena_get_rxfh_key_size() when RSS hash key is not configurable
nfp: fix RSS hash key size when RSS is not supported
drivers/base/node: fix double free in register_one_node()
ocfs2: fix double free in user_cluster_connect()
net: usb: Remove disruptive netif_wake_queue in rtl8150_set_multicast
usb: vhci-hcd: Prevent suspending virtually attached devices
scsi: mpt3sas: Fix crash in transport port remove by using ioc_info()
ipvs: Defer ip_vs_ftp unregister during netns cleanup
NFSv4.1: fix backchannel max_resp_sz verification check
remoteproc: qcom: q6v5: Avoid disabling handover IRQ twice
sparc: fix accurate exception reporting in copy_{from,to}_user for M7
sparc: fix accurate exception reporting in copy_to_user for Niagara 4
sparc: fix accurate exception reporting in copy_{from_to}_user for Niagara
sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC III
sparc: fix accurate exception reporting in copy_{from_to}_user for UltraSPARC
IB/sa: Fix sa_local_svc_timeout_ms read race
drivers/base/node: handle error properly in register_one_node()
watchdog: mpc8xxx_wdt: Reload the watchdog timer when enabling the watchdog
iio: consumers: Fix offset handling in iio_convert_raw_to_processed()
ASoC: Intel: bytcr_rt5651: Fix invalid quirk input mapping
ASoC: Intel: bytcr_rt5640: Fix invalid quirk input mapping
pps: fix warning in pps_register_cdev when register device fail
misc: genwqe: Fix incorrect cmd field being reported in error
usb: gadget: configfs: Correctly set use_os_string at bind
usb: phy: twl6030: Fix incorrect type for ret
tcp: fix __tcp_close() to only send RST when required
PCI: tegra: Fix devm_kcalloc() argument order for port->phys allocation
wifi: mwifiex: send world regulatory domain to driver
ALSA: lx_core: use int type to store negative error codes
media: rj54n1cb0c: Fix memleak in rj54n1_probe()
scsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod
usb: host: max3421-hcd: Fix error pointer dereference in probe cleanup
drm/radeon/r600_cs: clean up of dead code in r600_cs
i2c: designware: Add disabling clocks when probe fails
i2c: mediatek: fix potential incorrect use of I2C_MASTER_WRRD
pwm: tiehrpwm: Fix corner case in clock divisor calculation
block: use int to store blk_stack_limits() return value
blk-mq: check kobject state_in_sysfs before deleting in blk_mq_unregister_hctx
pinctrl: meson-gxl: add missing i2c_d pinmux
soc: qcom: rpmh-rsc: Unconditionally clear _TRIGGER bit for TCS
ACPI: processor: idle: Fix memory leak when register cpuidle device failed
perf: arm_spe: Prevent overflow in PERF_IDX2OFF()
staging: axis-fifo: fix maximum TX packet length check
perf subcmd: avoid crash in exclude_cmds when excludes is empty
dm-integrity: limit MAX_TAG_SIZE to 255
wifi: rtlwifi: rtl8192cu: Don't claim USB ID 07b8:8188
USB: serial: option: add SIMCom 8230C compositions
media: rc: fix races with imon_disconnect()
media: imon: grab lock earlier in imon_ir_change_protocol()
media: imon: reorganize serialization
media: rc: Add support for another iMON 0xffdc device
media: i2c: tc358743: Fix use-after-free bugs caused by orphan timer in probe
media: tuner: xc5000: Fix use-after-free in xc5000_release
media: tunner: xc5000: Refactor firmware load
udp: Fix memory accounting leak.
media: b2c2: Fix use-after-free causing by irq_check_work in flexcop_pci_remove
scsi: target: target_core_configfs: Add length check to avoid buffer overflow
Change-Id: If7e75950e2cad63499e2cfffecac3dc9b432d06c
commit 9db26d5855d0374d4652487bfb5aacf40821c469 upstream.
When setting a normal alarm, user-space is responsible for using
RTC_AIE_ON/RTC_AIE_OFF to control if alarm irq should be enabled.
But when RTC_UIE_ON is used, interrupts must be enabled so that the
requested irq events are generated.
When RTC_UIE_OFF is used, alarm irq is disabled if there are no other
alarms queued, so this commit brings symmetry to that.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250516-rtc-uie-irq-fixes-v2-5-3de8e530a39e@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[uli: backport to 4.19]
Signed-off-by: Ulrich Hecht <uli@kernel.org>
commit 795cda8338eab036013314dbc0b04aae728880ab upstream.
As described in the old comment dating back to
commit 6610e0893b ("RTC: Rework RTC code to use timerqueue for events")
from 2010, we have been living with a race window when setting alarm
with an expiry in the near future (i.e. next second).
With 1 second resolution, it can happen that the second ticks after the
check for the timer having expired, but before the alarm is actually set.
When this happen, no alarm IRQ is generated, at least not with some RTC
chips (isl12022 is an example of this).
With UIE RTC timer being implemented on top of alarm irq, being re-armed
every second, UIE will occasionally fail to work, as an alarm irq lost
due to this race will stop the re-arming loop.
For now, I have limited the additional expiry check to only be done for
alarms set to next seconds. I expect it should be good enough, although I
don't know if we can now for sure that systems with loads could end up
causing the same problems for alarms set 2 seconds or even longer in the
future.
I haven't been able to reproduce the problem with this check in place.
Cc: stable@vger.kernel.org
Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20250516-rtc-uie-irq-fixes-v2-1-3de8e530a39e@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
https://source.android.com/docs/security/bulletin/2025-01-01
* tag 'ASB-2025-01-05_4.19-stable' of https://android.googlesource.com/kernel/common: (132 commits)
Revert "UPSTREAM: unicode: Don't special case ignorable code points"
Reapply "UPSTREAM: unicode: Don't special case ignorable code points"
Revert "UPSTREAM: unicode: Don't special case ignorable code points"
Linux 4.19.325
sh: intc: Fix use-after-free bug in register_intc_controller()
modpost: remove incorrect code in do_eisa_entry()
9p/xen: fix release of IRQ
9p/xen: fix init sequence
block: return unsigned int from bdev_io_min
jffs2: fix use of uninitialized variable
ubi: fastmap: Fix duplicate slab cache names while attaching
ubifs: Correct the total block count by deducting journal reservation
rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
NFSv4.0: Fix a use-after-free problem in the asynchronous open()
um: Fix the return value of elf_core_copy_task_fpregs
rpmsg: glink: Propagate TX failures in intentless mode as well
NFSD: Prevent a potential integer overflow
lib: string_helpers: silence snprintf() output truncation warning
usb: dwc3: gadget: Fix checking for number of TRBs left
media: wl128x: Fix atomicity violation in fmc_send_cmd()
...
Conflicts:
arch/arm64/boot/dts/vendor/bindings/clock/adi,axi-clkgen.yaml
arch/arm64/boot/dts/vendor/bindings/clock/axi-clkgen.txt
drivers/rpmsg/qcom_glink_native.c
Change-Id: Iea6ddf20dfaa4419f6e0b2efcee1890bfa8e2554
[ Upstream commit e8ba8a2bc4f60a1065f23d6a0e7cbea945a0f40d ]
If the __rtc_read_time call fails,, the struct rtc_time tm; may contain
uninitialized data, or an illegal date/time read from the RTC hardware.
When calling rtc_tm_to_ktime later, the result may be a very large value
(possibly KTIME_MAX). If there are periodic timers in rtc->timerqueue,
they will continually expire, may causing kernel softlockup.
Fixes: 6610e0893b ("RTC: Rework RTC code to use timerqueue for events")
Signed-off-by: Yongliang Gao <leonylgao@tencent.com>
Acked-by: Jingqun Li <jingqunli@tencent.com>
Link: https://lore.kernel.org/r/20241011043153.3788112-1-leonylgao@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
If device is boot up by rtc alarm, the alarm irq will still be
enabled and the alarm time is smaller than current rtc time before
any alarm is set or canceled. If device is powered off now, it will
boot up automatically as the alarm irq is enabled.
So disable alarm irq if alarm is enabled and alarm time is in the
past.
Change-Id: I53dc7cdb1fa7c56eea07ed01d1f6cb63f0bb8a8d
Signed-off-by: Guixiong Wei <guixiong@codeaurora.org>
commit 7e7c005b4b1f1f169bcc4b2c3a40085ecc663df2 upstream.
When setting the time in the future with the uie timer enabled,
rtc_timer_do_work will loop for a while because the expiration of the uie
timer was way before the current RTC time and a new timer will be enqueued
until the current rtc time is reached.
If the uie timer is enabled, disable it before setting the time and enable
it after expiring current timers (which may actually be an alarm).
This is the safest thing to do to ensure the uie timer is still
synchronized with the RTC, especially in the UIE emulation case.
Reported-by: syzbot+08116743f8ad6f9a6de7@syzkaller.appspotmail.com
Fixes: 6610e0893b ("RTC: Rework RTC code to use timerqueue for events")
Link: https://lore.kernel.org/r/20191020231320.8191-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Pull RTC updates from Alexandre Belloni:
"It is now possible to add custom sysfs attributes while avoiding a
possible race condition. Unused code has been removed resulting in a
nice reduction of the code base. And more drivers have been switched
to SPDX by their maintainers.
Summary:
Subsystem:
- new helpers to add custom sysfs attributes
- struct rtc_task removal along with rtc_irq_[un]register()
- rtc_irq_set_state and rtc_irq_set_freq are not exported anymore
Drivers:
- armada38x: reset after rtc power loss
- ds1307: now supports m41t11
- isl1208: now supports isl1219 and tamper detection
- pcf2127: internal SRAM support"
* tag 'rtc-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (34 commits)
rtc: ds1307: simplify hwmon config
rtc: s5m: Add SPDX license identifier
rtc: maxim: Add SPDX license identifiers
rtc: isl1219: add device tree documentation
rtc: isl1208: set ev-evienb bit from device tree
rtc: isl1208: Add "evdet" interrupt source for isl1219
rtc: isl1208: add support for isl1219 with tamper detection
rtc: sysfs: facilitate attribute add to rtc device
rtc: remove struct rtc_task
char: rtc: remove task handling
rtc: pcf85063: preserve control register value between stop and start
rtc: sh: remove unused variable rtc_dev
rtc: unexport rtc_irq_set_*
rtc: simplify rtc_irq_set_state/rtc_irq_set_freq
rtc: remove irq_task and irq_task_lock
rtc: remove rtc_irq_register/rtc_irq_unregister
rtc: sh: remove dead code
rtc: sa1100: don't set PIE frequency
rtc: ds1307: support m41t11 variant
rtc: ds1307: fix data pointer to m41t0
...
The offset needs to be added after reading the alarm value.
It also needs to be subtracted after the now < alarm test.
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
When using RTC_ALM_SET or RTC_WKALM_SET with rtc_wkalrm.enabled not set,
rtc_timer_enqueue() is not called and rtc_set_alarm() may succeed but the
subsequent RTC_AIE_ON ioctl will fail. RTC_ALM_READ would also fail in that
case.
Ensure rtc_set_alarm() fails when alarms are not supported to avoid letting
programs think the alarms are working for a particular RTC when they are
not.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
From our investigation for all RTC drivers, 1 driver will be expired before
year 2017, 7 drivers will be expired before year 2038, 23 drivers will be
expired before year 2069, 72 drivers will be expired before 2100 and 104
drivers will be expired before 2106. Especially for these early expired
drivers, we need to expand the RTC range to make the RTC can still work
after the expired year.
So we can expand the RTC range by adding one offset to the time when reading
from hardware, and subtracting it when writing back. For example, if you have
an RTC that can do 100 years, and currently is configured to be based in
Jan 1 1970, so it can represents times from 1970 to 2069. Then if you change
the start year from 1970 to 2000, which means it can represents times from
2000 to 2099. By adding or subtracting the offset produced by moving the wrap
point, all times between 1970 and 1999 from RTC hardware could get interpreted
as times from 2070 to 2099, but the interpretation of dates between 2000 and
2069 would not change.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
The RTC range validation code can be factored into rtc_valid_range()
function to avoid duplicate code.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Add a way for drivers to inform the core of the supported date/time range.
The core can then check whether the date/time or alarm is in the range
before calling ->set_time, ->set_mmss or ->set_alarm. It returns -ERANGE
when the time is out of range.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
It will be more helpful to add some tracepoints to track RTC actions when
debugging RTC driver. Below sample is that we set/read the RTC time, then
set 2 alarms, so we can see the trace logs:
set/read RTC time:
kworker/0:1-67 [000] 21.814245: rtc_set_time: UTC (1510301580) (0)
kworker/0:1-67 [000] 21.814312: rtc_read_time: UTC (1510301580) (0)
set the first alarm timer:
kworker/0:1-67 [000] 21.829238: rtc_timer_enqueue: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 22.018279: rtc_set_alarm: UTC (1510301700) (0)
set the second alarm timer:
kworker/0:1-67 [000] 22.230284: rtc_timer_enqueue: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0
the first alarm timer was expired:
kworker/0:1-67 [000] 145.155584: rtc_timer_dequeue: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 145.155593: rtc_timer_fired: RTC timer:(ffffffc15eb49bc8) expires:1510301700000000000 period:0
kworker/0:1-67 [000] 145.172504: rtc_set_alarm: UTC (1510301820) (0)
the second alarm timer was expired:
kworker/0:1-67 [000] 269.102353: rtc_timer_dequeue: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0
kworker/0:1-67 [000] 269.102360: rtc_timer_fired: RTC timer:(ffffff80088e6430) expires:1510301820000000000 period:0
disable alarm irq:
kworker/0:1-67 [000] 269.102469: rtc_alarm_irq_enable: disable RTC alarm IRQ (0)
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
The RTC offset correction documentation is not very clear about the
exact relationship between "offset" and the effect it has on the RTC.
Supplement the documentation with an equation giving the relationship.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
If there is any non expired timer in the queue, the RTC alarm is never set.
This is an issue when adding a timer that expires before the next non
expired timer.
Ensure the RTC alarm is set in that case.
Fixes: 2b2f5ff00f ("rtc: interface: ignore expired timers when enqueuing new timers")
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
In function __rtc_read_alarm() its possible for an alarm time-stamp to
be invalid even after replacing missing components with current
time-stamp. The condition 'alarm->time.tm_year < 70' will trigger this
case and will cause the call to 'rtc_tm_to_time64(&alarm->time)'
return a negative value for variable t_alm.
While handling alarm rollover this negative t_alm (assumed to seconds
offset from '1970-01-01 00:00:00') is converted back to rtc_time via
rtc_time64_to_tm() which results in this error log with seemingly
garbage values:
"rtc rtc0: invalid alarm value: -2-1--1041528741
2005511117:71582844:32"
This error was generated when the rtc driver (rtc-opal in this case)
returned an alarm time-stamp of '00-00-00 00:00:00' to indicate that
the alarm is disabled. Though I have submitted a separate fix for the
rtc-opal driver, this issue may potentially impact other
existing/future rtc drivers.
To fix this issue the patch validates the alarm time-stamp just after
filling up the missing datetime components and if rtc_valid_tm() still
reports it to be invalid then bails out of the function without
handling the rollover.
Reported-by: Steve Best <sbest@redhat.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
ktime is a union because the initial implementation stored the time in
scalar nanoseconds on 64 bit machine and in a endianess optimized timespec
variant for 32bit machines. The Y2038 cleanup removed the timespec variant
and switched everything to scalar nanoseconds. The union remained, but
become completely pointless.
Get rid of the union and just keep ktime_t as simple typedef of type s64.
The conversion was done with coccinelle and some manual mopping up.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
This patch fixes a RTC wakealarm issue, namely, the event fires during
hibernate and is not cleared from the list, causing hwclock to block.
The current enqueuing does not trigger an alarm if any expired timers
already exist on the timerqueue. This can occur when a RTC wake alarm
is used to wake a machine out of hibernate and the resumed state has
old expired timers that have not been removed from the timer queue.
This fix skips over any expired timers and triggers an alarm if there
are no pending timers on the timerqueue. Note that the skipped expired
timer will get reaped later on, so there is no need to clean it up
immediately.
The issue can be reproduced by putting a machine into hibernate and
waking it with the RTC wakealarm. Running the example RTC test program
from tools/testing/selftests/timers/rtctest.c after the hibernate will
block indefinitely. With the fix, it no longer blocks after the
hibernate resume.
BugLink: http://bugs.launchpad.net/bugs/1333569
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
rtc drivers are supposed to set values they don't support to -1. To
simplify this for drivers and also make it harder for them to get it
wrong initialize the values to -1.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
A number of rtc devices, such as the NXP pcf2123 include a facility
to adjust the clock in order to compensate for temperature or a
crystal, capacitor, etc, that results in the rtc clock not running
at exactly 32.768 kHz.
Data sheets I have seen refer to this as a clock offset, and measure it
in parts per million, however they often reference ppm to 2 digits of
precision, which makes integer ppm less than ideal.
We use parts per billion, which more than covers the precision needed
and works nicely within 32 bits
Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there
is no need to do that again from its callers. Drop it.
gemini driver was using likely() for a failure case while the rtc driver
is getting registered. That looks wrong and it should really be
unlikely. But because we are killing all the unlikely() flags, lets kill
that too.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
__rtc_read_time logs should be debug logs instead of error logs.
For example, when the RTC clock is not set, it's not really useful
to print a kernel error log every time someone tries to read the clock:
~ # hwclock -r
[ 604.508263] rtc rtc0: read_time: fail to read
hwclock: RTC_RD_TIME: Invalid argument
If there's a real error, it's likely that lower level or higher level
code will tell it anyway. Make these logs debug logs, and also print
the error code for the read failure.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc_timer_do_work() only judges -ETIME failure of__rtc_set_alarm(), but
doesn't handle other failures like -EIO, -EBUSY, etc.
If there is a failure other than -ETIME, the next rtc_timer will stay in
the timerqueue. Then later rtc_timers will be enqueued directly because
they have a later expires time, so the alarm irq will never be programmed.
When such failures happen, this patch will retry __rtc_set_alarm(), if
still can't program the alarm time, it will remove current rtc_timer from
timerqueue and fetch next one, thus preventing it from affecting other rtc
timers.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Arnd Bergmann <arnd.bergmann@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Some rtc devices always return '0' when rtc_class_ops.read_time is
called. So if rtc_time isn't verified in callback, rtc interface cannot
know whether rtc_time is valid.
Check rtc_time by using 'rtc_valid_tm' in '__rtc_read_time'. And add
the message for debugging.
Signed-off-by: Hyogi Gim <hyogi.gim@lge.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
In __rtc_set_alarm(), the error after __rtc_read_time() is not checked.
If rtc device fail to read time, we cannot guarantee the following
process.
Add the verification code for returned __rtc_read_time() error.
Signed-off-by: Hyogi Gim <hyogi.gim@lge.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
In __rtc_read_alarm(), if the alarm time retrieved by
rtc_read_alarm_internal() from the device contains invalid values (e.g.
month=2,mday=31) and the year not set (=-1), the initialization will
loop infinitely because the year-fixing loop expects the time being
invalid due to leap year.
Fix reduces the loop to the leap years and adds final validity check.
Signed-off-by: Ales Novak <alnovak@suse.cz>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Current implementation of RTC interface allows for system suspend to
occur in the following cases:
(a) if a timer is set in the past and rtc_timer_do_work() is scheduled
to handle it, and
(b) if rtc_timer_do_work() is called to handle expired timers whose
handlers implement a preemption point.
A pending suspend request may be honoured in the above cases causing
timer handling to be delayed until after the next resume. This is
undesirable since timer handlers may have time-critical code to execute.
This patch makes sure that the system stays awake until all expired
timers are handled.
Note that all calls to pm_stay_awake() are eventually paired with
the single pm_relax() call in rtc_timer_do_work(), which is launched
using schedule_work().
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Arve Hjonnevag <arve@android.com>
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
If rtc->irq_task is non-NULL and task is NULL, they always
rtc_irq_set_freq(), whenever err is set to -EBUSY it will then immediately
be set to -EACCES, misleading the caller as to the underlying problem.
Signed-off-by: Chris Brand <chris.brand@broadcom.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fixes the following types of errors:
ERROR: "foo* bar" should be "foo *bar"
ERROR: else should follow close brace '}'
WARNING: braces {} are not necessary for single statement blocks
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
All in-kernel users of class_find_device() don't really need mutable
data for match callback.
In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c)
this patch changes match callbacks to use const search data.
The const is propagated to rtc_class_open() and power_supply_get_by_name()
parameters.
Note that there's a dev reference leak in suspend_test.c that's not
touched in this patch.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If an RTC alarm fires just as suspend is happening, it is possible for
suspend to complete and the alarm to be missed.
To avoid the race, we must register the event with the PM core.
As the event is made visible to userspace through a thread which is
only scheduled by the interrupt, we need a pm_stay_awake/pm_relax
pair preventing suspend from the interrupt until the thread completes
its work.
This makes the pm_wakeup_event() call in cmos_interrupt unnecessary as
it provides suspend protection for all RTCs that use rtc_update_irq.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Richard Weinberger noticed that on some RTC hardware that
doesn't support UIE mode, due to coarse granular alarms
(like 1minute resolution), the current virtualized RTC
support doesn't properly error out when UIE is enabled.
Instead the current code queues an alarm for the next second,
but it won't fire until up to a miniute later.
This patch provides a generic way to flag this sort of hardware
and fixes the issue on the mpc5121 where Richard noticed the
problem.
CC: stable@vger.kernel.org
Reported-by: Richard Weinberger <richard@nod.at>
Tested-by: Richard Weinberger <richard@nod.at>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Currently, the RTC code does not disable the alarm in the hardware.
This means that after a sequence such as the one below (the files are in the
RTC sysfs), the box will boot up after 2 minutes even though we've
asked for the alarm to be turned off.
# echo $((`cat since_epoch`)+120) > wakealarm
# echo 0 > wakealarm
# poweroff
Fix this by disabling the alarm when there are no timers to run.
The original version of this patch was reverted. This version
disables the irq directly instead of setting a disabled timer
in the future.
Cc: stable@kernel.org
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
[Merged in the second revision from Rabin]
Signed-off-by: John Stultz <john.stultz@linaro.org>
If the alarm time programming in the rtc is ever in the past, it won't fire,
and any other alarm will be queued after it so they won't fire either.
So any time that the alarm might be in the past, we need to trigger
the irq handler to ensure the old alarm is cleared and the timer queue
is fully in the future.
This is done whenever the RTC clock is set.
This is the second revision of this patch, which was earlier reverted.
This version avoids the initialization problem, which is handled by
a different patch.
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: NeilBrown <neilb@suse.de>
[Remove problematic initialization change, update commit log, also
catch set_mmss case -jstultz]
Signed-off-by: John Stultz <john.stultz@linaro.org>
In some cases at boot up, the RTC alarm may be set in the past,
but still have the enabled flag on. This was causing problems,
because we would then enqueue the alarm into the timerqueue,
but it would never fire. This would clog up the timerqueue
and keep other alarms from working.
The fix is to check the alarm against the current rtc time at
boot and avoid enqueueing the alarm if it is in the past.
Reported-by: NeilBrown <neilb@suse.de>
Tested-by: NeilBrown <neilb@suse.de>
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: John Stultz <john.stultz@linaro.org>