4.14.163-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 4.14.163-stable review
This is the start of the stable review cycle for the 4.14.163 release. There are 74 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 Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.163-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.163-rc1
Alexander Shishkin <[email protected]>
perf/x86/intel/bts: Fix the use of page_private()
SeongJae Park <[email protected]>
xen/blkback: Avoid unmapping unmapped grant pages
Heiko Carstens <[email protected]>
s390/smp: fix physical to logical CPU map for SMT
Eric Dumazet <[email protected]>
net: add annotations on hh->hh_len lockless accesses
Anand Moon <[email protected]>
arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning
Masashi Honma <[email protected]>
ath9k_htc: Discard undersized packets
Masashi Honma <[email protected]>
ath9k_htc: Modify byte order for an error message
David Howells <[email protected]>
rxrpc: Fix possible NULL pointer access in ICMP handling
Suzuki K Poulose <[email protected]>
coresight: etb10: Do not call smp_processor_id from preemptible
Suzuki K Poulose <[email protected]>
coresight: tmc-etf: Do not call smp_processor_id from preemptible
Florian Westphal <[email protected]>
selftests: rtnetlink: add addresses with fixed life time
Daniel Axtens <[email protected]>
powerpc/pseries/hvconsole: Fix stack overread via udbg
Imre Deak <[email protected]>
drm/mst: Fix MST sideband up-reply failure handling
Chad Dupuis <[email protected]>
scsi: qedf: Do not retry ELS request if qedf_alloc_cmd fails
Al Viro <[email protected]>
fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
Leo Yan <[email protected]>
tty: serial: msm_serial: Fix lockup for sysrq and oops
Geert Uytterhoeven <[email protected]>
dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example
Navid Emamdoost <[email protected]>
media: usb: fix memory leak in af9005_identify_state
Stephan Gerhold <[email protected]>
regulator: ab8500: Remove AB8505 USB regulator
Colin Ian King <[email protected]>
media: flexcop-usb: ensure -EIO is returned on error condition
Navid Emamdoost <[email protected]>
Bluetooth: Fix memory leak in hci_connect_le_scan
Dan Carpenter <[email protected]>
Bluetooth: delete a stray unlock
Oliver Neukum <[email protected]>
Bluetooth: btusb: fix PM leak in error case of setup
Michael Haener <[email protected]>
platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
Omar Sandoval <[email protected]>
xfs: don't check for AG deadlock for realtime files in bunmapi
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
Scott Mayhew <[email protected]>
nfsd4: fix up replay_matches_cache()
Leonard Crestez <[email protected]>
PM / devfreq: Check NULL governor in available_governors_show
Catalin Marinas <[email protected]>
arm64: Revert support for execute-only user mappings
Wen Yang <[email protected]>
ftrace: Avoid potential division by zero in function profiler
chenqiwu <[email protected]>
exit: panic before exit_mm() on global init exit
Takashi Iwai <[email protected]>
ALSA: firewire-motu: Correct a typo in the clock proc string
Colin Ian King <[email protected]>
ALSA: cs4236: fix error return comparison of an unsigned integer
Steven Rostedt (VMware) <[email protected]>
tracing: Have the histogram compare functions convert to u64 first
Prateek Sood <[email protected]>
tracing: Fix lock inversion in trace_event_enable_tgid_record()
Russell King <[email protected]>
gpiolib: fix up emulated open drain outputs
Florian Fainelli <[email protected]>
ata: ahci_brcm: Fix AHCI resources management
Florian Fainelli <[email protected]>
ata: ahci_brcm: Allow optional reset controller to be used
Florian Fainelli <[email protected]>
ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
Arnd Bergmann <[email protected]>
compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
Arnd Bergmann <[email protected]>
compat_ioctl: block: handle Persistent Reservations
Lukas Wunner <[email protected]>
dmaengine: Fix access to uninitialized dma_slave_caps
Amir Goldstein <[email protected]>
locks: print unsigned ino in /proc/locks
Aleksandr Yashkin <[email protected]>
pstore/ram: Write new dumps to start of recycled zones
Shakeel Butt <[email protected]>
memcg: account security cred as well to kmemcg
Chanho Min <[email protected]>
mm/zsmalloc.c: fix the migrated zspage statistics.
Hans Verkuil <[email protected]>
media: cec: avoid decrementing transmit_queue_sz if it is 0
Hans Verkuil <[email protected]>
media: cec: CEC 2.0-only bcast messages were ignored
Hans Verkuil <[email protected]>
media: pulse8-cec: fix lost cec_transmit_attempt_done() call
Paul Burton <[email protected]>
MIPS: Avoid VDSO ABI breakage due to global register variable
Stefan Mavrodiev <[email protected]>
drm/sun4i: hdmi: Remove duplicate cleanup calls
Takashi Iwai <[email protected]>
ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
Daniel Vetter <[email protected]>
drm: limit to INT_MAX in create_blob ioctl
Christian Brauner <[email protected]>
taskstats: fix data-race
Brian Foster <[email protected]>
xfs: fix mount failure crash on invalid iclog memory access
Andy Whitcroft <[email protected]>
PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
Juergen Gross <[email protected]>
xen/balloon: fix ballooned page accounting without hotplug enabled
Paul Durrant <[email protected]>
xen-blkback: prevent premature module unload
Parav Pandit <[email protected]>
IB/mlx4: Follow mirror sequence of device add during device removal
Thomas Richter <[email protected]>
s390/cpum_sf: Avoid SBD overflow condition in irq handler
Thomas Richter <[email protected]>
s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
Zhiqiang Liu <[email protected]>
md: raid1: check rdev before reference in raid1_sync_request func
Jens Axboe <[email protected]>
net: make socket read/write_iter() honor IOCB_NOWAIT
EJ Hsu <[email protected]>
usb: gadget: fix wrong endpoint desc
Hans de Goede <[email protected]>
drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
Jason Yan <[email protected]>
scsi: libsas: stop discovering if oob mode is disconnected
Dan Carpenter <[email protected]>
scsi: iscsi: qla4xxx: fix double free in probe
Roman Bolshakov <[email protected]>
scsi: qla2xxx: Don't call qlt_async_event twice
Bo Wu <[email protected]>
scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
Steve Wise <[email protected]>
rxe: correctly calculate iCRC for unaligned payloads
Chuhong Yuan <[email protected]>
RDMA/cma: add missed unregister_pernet_subsys in init failure
Leonard Crestez <[email protected]>
PM / devfreq: Don't fail devfreq_dev_release if not in list
Geert Uytterhoeven <[email protected]>
iio: adc: max9611: Fix too short conversion time delay
James Smart <[email protected]>
nvme_fc: add module to ops template to allow module references
-------------
Diffstat:
.../bindings/clock/renesas,rcar-usb2-clock-sel.txt | 2 +- Makefile | 4 +- .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 4 +- arch/arm64/include/asm/pgtable-prot.h | 5 +- arch/arm64/include/asm/pgtable.h | 10 +- arch/arm64/mm/fault.c | 2 +- arch/mips/include/asm/thread_info.h | 20 +++- arch/powerpc/platforms/pseries/hvconsole.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 22 ++-- arch/s390/kernel/smp.c | 80 ++++++++++----- arch/x86/events/intel/bts.c | 16 ++- block/compat_ioctl.c | 11 ++ drivers/ata/ahci_brcm.c | 112 +++++++++++++++------ drivers/ata/libahci_platform.c | 6 +- drivers/block/xen-blkback/blkback.c | 2 + drivers/block/xen-blkback/xenbus.c | 10 ++ drivers/bluetooth/btusb.c | 3 +- drivers/devfreq/devfreq.c | 8 +- drivers/firewire/net.c | 6 +- drivers/gpio/gpiolib.c | 8 ++ drivers/gpu/drm/drm_dp_mst_topology.c | 6 +- drivers/gpu/drm/drm_property.c | 2 +- drivers/gpu/drm/nouveau/nouveau_connector.h | 110 ++++++++++---------- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 - drivers/hwtracing/coresight/coresight-etb10.c | 4 +- drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +- drivers/iio/adc/max9611.c | 16 +-- drivers/infiniband/core/cma.c | 1 + drivers/infiniband/hw/mlx4/main.c | 9 +- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 ++ drivers/infiniband/sw/rxe/rxe_resp.c | 7 ++ drivers/md/raid1.c | 2 +- drivers/media/cec/cec-adap.c | 20 +++- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- drivers/media/usb/dvb-usb/af9005.c | 5 +- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 +++- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 23 ++++- drivers/nvme/host/fc.c | 14 ++- drivers/nvme/target/fcloop.c | 1 + drivers/platform/x86/pmc_atom.c | 8 ++ drivers/regulator/ab8500.c | 17 ---- drivers/scsi/libsas/sas_discover.c | 11 +- drivers/scsi/lpfc/lpfc_bsg.c | 15 +-- drivers/scsi/lpfc/lpfc_nvme.c | 2 + drivers/scsi/qedf/qedf_els.c | 16 +-- drivers/scsi/qla2xxx/qla_isr.c | 4 - drivers/scsi/qla2xxx/qla_nvme.c | 1 + drivers/scsi/qla2xxx/qla_target.c | 1 - drivers/scsi/qla4xxx/ql4_os.c | 1 - drivers/tty/hvc/hvc_vio.c | 16 ++- drivers/tty/serial/msm_serial.c | 13 ++- drivers/usb/gadget/function/f_ecm.c | 6 +- drivers/usb/gadget/function/f_rndis.c | 1 + drivers/xen/balloon.c | 3 +- fs/compat_ioctl.c | 3 +- fs/locks.c | 2 +- fs/nfsd/nfs4state.c | 15 ++- fs/pstore/ram.c | 11 ++ fs/xfs/libxfs/xfs_bmap.c | 2 +- fs/xfs/xfs_log.c | 2 + include/linux/ahci_platform.h | 2 + include/linux/dmaengine.h | 5 +- include/linux/nvme-fc-driver.h | 4 + include/linux/regulator/ab8500.h | 1 - include/net/neighbour.h | 2 +- kernel/cred.c | 6 +- kernel/exit.c | 12 ++- kernel/power/snapshot.c | 9 +- kernel/taskstats.c | 30 ++++-- kernel/trace/ftrace.c | 6 +- kernel/trace/trace.c | 8 ++ kernel/trace/trace_events.c | 8 +- kernel/trace/tracing_map.c | 4 +- mm/mmap.c | 6 -- mm/zsmalloc.c | 5 + net/bluetooth/hci_conn.c | 4 +- net/bluetooth/l2cap_core.c | 4 +- net/core/neighbour.c | 4 +- net/ethernet/eth.c | 7 +- net/rxrpc/peer_event.c | 3 + net/socket.c | 4 +- sound/firewire/motu/motu-proc.c | 2 +- sound/isa/cs423x/cs4236.c | 3 +- sound/pci/ice1712/ice1724.c | 9 +- tools/testing/selftests/net/rtnetlink.sh | 21 ++++ 86 files changed, 610 insertions(+), 295 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/74 nvme_fc: add module to ops template to allow module references
From: James Smart <[email protected]>
[ Upstream commit 863fbae929c7a5b64e96b8a3ffb34a29eefb9f8f ]
In nvme-fc: it's possible to have connected active controllers and as no references are taken on the LLDD, the LLDD can be unloaded. The controller would enter a reconnect state and as long as the LLDD resumed within the reconnect timeout, the controller would resume. But if a namespace on the controller is the root device, allowing the driver to unload can be problematic. To reload the driver, it may require new io to the boot device, and as it's no longer connected we get into a catch-22 that eventually fails, and the system locks up.
Fix this issue by taking a module reference for every connected controller (which is what the core layer did to the transport module). Reference is cleared when the controller is removed.
--- drivers/nvme/host/fc.c | 14 ++++++++++++-- drivers/nvme/target/fcloop.c | 1 + drivers/scsi/lpfc/lpfc_nvme.c | 2 ++ drivers/scsi/qla2xxx/qla_nvme.c | 1 + include/linux/nvme-fc-driver.h | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +12 -2
@@ -337,7 +337,8 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary) { + !template->max_dif_sgl_segments || !template->dma_boundary || + !template->module) { ret = -EINVAL; goto out_reghost_failed; }
@@ -1762,6 +1763,7 @@ nvme_fc_ctrl_free(struct kref *ref) {struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); +struct nvme_fc_lport *lport = ctrl->lport;unsigned long flags;if (ctrl->ctrl.tagset) {
@@ -1787,6 +1789,7 @@ nvme_fc_ctrl_free(struct kref *ref)if (ctrl->ctrl.opts)nvmf_free_options (ctrl->ctrl.opts);kfree (ctrl); +module_put (lport->ops->module); } static void
@@ -2765,10 +2768,15 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_fail; } +if (!try_module_get (lport->ops->module)) { + ret = -EUNATCH ; + goto out_free_ctrl; + } + idx =ida_simple_get (&nvme_fc_ctrl_cnt,0 ,0 ,GFP_KERNEL );if (idx <0 ) { ret = -ENOSPC ; - goto out_free_ctrl; + goto out_mod_put; } ctrl->ctrl.opts = opts;
@@ -2915,6 +2923,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, out_free_ida:put_device (ctrl->dev);ida_simple_remove (&nvme_fc_ctrl_cnt, ctrl->cnum); +out_mod_put: +module_put (lport->ops->module); out_free_ctrl:kfree (ctrl); out_fail:
drivers/nvme/target/fcloop.c +1 -0
@@ -693,6 +693,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_DMABOUND_4G 0xFFFFFFFFstatic struct nvme_fc_port_template fctemplate = { + .module =THIS_MODULE , .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,
drivers/scsi/lpfc/lpfc_nvme.c +2 -0
@@ -1591,6 +1591,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,/* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { + .module =THIS_MODULE , +/* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete,
drivers/scsi/qla2xxx/qla_nvme.c +1 -0
@@ -578,6 +578,7 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) }static struct nvme_fc_port_template qla_nvme_fc_transport = { + .module =THIS_MODULE , .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,
include/linux/nvme-fc-driver.h +4 -0
@@ -279,6 +279,8 @@ struct nvme_fc_remote_port {* * Host/Initiator Transport Entrypoints/Parameters: * +* @module: The LLDD module using the interface +* * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the
@@ -392,6 +394,8 @@ struct nvme_fc_remote_port {* Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { +struct module *module; +/* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *);void (*remoteport_delete)(struct nvme_fc_remote_port *);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/74 iio: adc: max9611: Fix too short conversion time delay
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9fd229c478fbf77c41c8528aa757ef14210365f6 ]
As of commit b9ddd5091160793e ("iio: adc: max9611: Fix temperature reading in probe"), max9611 initialization sometimes fails on the Salvator-X(S) development board with:
max9611 4-007f: Invalid value received from ADC 0x8000: aborting
max9611: probe of 4-007f failed with error -5The max9611 driver tests communications with the chip by reading the die temperature during the probe function, which returns an invalid value.
According to the datasheet, the typical ADC conversion time is 2 ms, but no minimum or maximum values are provided. Maxim Technical Support confirmed this was tested with temperature Ta=25 degreeC, and promised to inform me if a maximum/minimum value is available (they didn't get back to me, so I assume it is not).
However, the driver assumes a 1 ms conversion time. Usually the usleep_range() call returns after more than 1.8 ms, hence it succeeds. When it returns earlier, the data register may be read too early, and the previous measurement value will be returned. After boot, this is the temperature POR (power-on reset) value, causing the failure above.
Fix this by increasing the delay from 1000-2000 µs to 3000-3300 µs.
Note that this issue has always been present, but it was exposed by the aformentioned commit.
--- drivers/iio/adc/max9611.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/iio/adc/max9611.c +10 -6
@@ -92,6 +92,12 @@#define MAX9611_TEMP_SCALE_NUM 1000000#define MAX9611_TEMP_SCALE_DIV 2083 +/* +* Conversion time is 2 ms (typically) at Ta=25 degreeC +* No maximum value is known, so play it safe. +*/ +#define MAX9611_CONV_TIME_US_RANGE 3000, 3300 +struct max9611_dev {struct device *dev;struct i2c_client *i2c_client;
@@ -239,11 +245,9 @@ static int max9611_read_single(struct max9611_dev *max9611,return ret; } -/* -* need a delay here to make register configuration -* stabilize. 1 msec at least, from empirical testing. -*/ -usleep_range (1000 ,2000 ); +/* need a delay here to make register configuration stabilize. */ + +usleep_range (MAX9611_CONV_TIME_US_RANGE ); ret =i2c_smbus_read_word_swapped (max9611->i2c_client, reg_addr);if (ret <0 ) {
@@ -511,7 +515,7 @@ static int max9611_init(struct max9611_dev *max9611) MAX9611_REG_CTRL2, 0);return ret; } -usleep_range (1000 ,2000 ); +usleep_range (MAX9611_CONV_TIME_US_RANGE );return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 3/74 PM / devfreq: Dont fail devfreq_dev_release if not in list
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]
Right now devfreq_dev_release will print a warning and abort the rest of the cleanup if the devfreq instance is not part of the global devfreq_list. But this is a valid scenario, for example it can happen if the governor can't be found or on any other init error that happens after device_register.
Initialize devfreq->node to an empty list head in devfreq_add_device so that list_del becomes a safe noop inside devfreq_dev_release and we can continue the rest of the cleanup.
--- drivers/devfreq/devfreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/devfreq/devfreq.c +1 -5
@@ -484,11 +484,6 @@ static void devfreq_dev_release(struct device *dev)struct devfreq *devfreq =to_devfreq (dev);mutex_lock (&devfreq_list_lock); -if (IS_ERR (find_device_devfreq (devfreq->dev.parent))) { -mutex_unlock (&devfreq_list_lock); -dev_warn (&devfreq->dev,"releasing devfreq which doesn't exist\n" ); -return ; - }list_del (&devfreq->node);mutex_unlock (&devfreq_list_lock);
@@ -547,6 +542,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->dev.parent = dev; devfreq->dev.class = devfreq_class; devfreq->dev.release = devfreq_dev_release; +INIT_LIST_HEAD (&devfreq->node); devfreq->profile = profile;strncpy (devfreq->governor_name, governor_name,DEVFREQ_NAME_LEN ); devfreq->previous_freq = profile->initial_freq;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/74 RDMA/cma: add missed unregister_pernet_subsys in init failure
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 44a7b6759000ac51b92715579a7bba9e3f9245c2 ]
The driver forgets to call unregister_pernet_subsys() in the error path of cma_init().
Add the missed call to fix it.
--- drivers/infiniband/core/cma.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/cma.c +1 -0
@@ -4568,6 +4568,7 @@ static int __init cma_init(void)unregister_netdevice_notifier (&cma_nb);rdma_addr_unregister_client (&addr_client);ib_sa_unregister_client (&sa_client); +unregister_pernet_subsys (&cma_pernet_operations); err_wq:destroy_workqueue (cma_wq);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/74 rxe: correctly calculate iCRC for unaligned payloads
In reply to Greg Kroah-HartmanFrom: Steve Wise <[email protected]>
[ Upstream commit 2030abddec6884aaf5892f5724c48fc340e6826f ]
If RoCE PDUs being sent or received contain pad bytes, then the iCRC is miscalculated, resulting in PDUs being emitted by RXE with an incorrect iCRC, as well as ingress PDUs being dropped due to erroneously detecting a bad iCRC in the PDU. The fix is to include the pad bytes, if any, in iCRC computations.
Note: This bug has caused broken on-the-wire compatibility with actual hardware RoCE devices since the soft-RoCE driver was first put into the mainstream kernel. Fixing it will create an incompatibility with the original soft-RoCE devices, but is necessary to be compatible with real hardware devices.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 2 +- drivers/infiniband/sw/rxe/rxe_req.c | 6 ++++++ drivers/infiniband/sw/rxe/rxe_resp.c | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_recv.c +1 -1
@@ -393,7 +393,7 @@ int rxe_rcv(struct sk_buff *skb) calc_icrc =rxe_icrc_hdr (pkt, skb); calc_icrc =rxe_crc32 (rxe, calc_icrc, (u8 *)payload_addr (pkt), -payload_size (pkt)); +payload_size (pkt) +bth_pad (pkt)); calc_icrc = (__force u32 )cpu_to_be32 (~calc_icrc);if (unlikely (calc_icrc != pack_icrc)) {if (skb->protocol ==htons (ETH_P_IPV6 ))
drivers/infiniband/sw/rxe/rxe_req.c +6 -0
@@ -500,6 +500,12 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,if (err)return err; } +if (bth_pad (pkt)) { +u8 *pad =payload_addr (pkt) + paylen; + +memset (pad,0 ,bth_pad (pkt)); + crc =rxe_crc32 (rxe, crc, pad,bth_pad (pkt)); + } } p =payload_addr (pkt) + paylen +bth_pad (pkt);
drivers/infiniband/sw/rxe/rxe_resp.c +7 -0
@@ -738,6 +738,13 @@ static enum resp_states read_reply(struct rxe_qp *qp,if (err)pr_err ("Failed copying memory\n" ); +if (bth_pad (&ack_pkt)) { +struct rxe_dev *rxe =to_rdev (qp->ibqp.device); +u8 *pad =payload_addr (&ack_pkt) + payload; + +memset (pad,0 ,bth_pad (&ack_pkt)); + icrc =rxe_crc32 (rxe, icrc, pad,bth_pad (&ack_pkt)); + } p =payload_addr (&ack_pkt) + payload +bth_pad (&ack_pkt); *p = ~icrc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/74 scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
In reply to Greg Kroah-HartmanFrom: Bo Wu <[email protected]>
[ Upstream commit 9a1b0b9a6dab452fb0e39fe96880c4faf3878369 ]
When phba->mbox_ext_buf_ctx.seqNum != phba->mbox_ext_buf_ctx.numBuf, dd_data should be freed before return SLI_CONFIG_HANDLED.
When lpfc_sli_issue_mbox func return fails, pmboxq should be also freed in job_error tag.
--- drivers/scsi/lpfc/lpfc_bsg.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +9 -6
@@ -4419,12 +4419,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, phba->mbox_ext_buf_ctx.seqNum++; nemb_tp = phba->mbox_ext_buf_ctx.nembType; - dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL ); -if (!dd_data) { - rc = -ENOMEM ; - goto job_error; - } - pbuf = (uint8_t *)dmabuf->virt; size = job->request_payload.payload_len; sg_copy_to_buffer(job->request_payload.sg_list,
@@ -4461,6 +4455,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,"2968 SLI_CONFIG ext-buffer wr all %d " "ebuffers received\n" , phba->mbox_ext_buf_ctx.numBuf); + + dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL ); +if (!dd_data) { + rc = -ENOMEM ; + goto job_error; + } +/* mailbox command structure for base driver */ pmboxq =mempool_alloc (phba->mbox_mem_pool,GFP_KERNEL );if (!pmboxq) {
@@ -4509,6 +4510,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,return SLI_CONFIG_HANDLED ; job_error: +if (pmboxq) +mempool_free (pmboxq, phba->mbox_mem_pool);lpfc_bsg_dma_page_free (phba, dmabuf);kfree (dd_data);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/74 scsi: qla2xxx: Dont call qlt_async_event twice
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 2c2f4bed9b6299e6430a65a29b5d27b8763fdf25 ]
MBA_PORT_UPDATE generates duplicate log lines in target mode because qlt_async_event is called twice. Drop the calls within the case as the function will be called right after the switch statement.
--- drivers/scsi/qla2xxx/qla_isr.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -4
@@ -1046,8 +1046,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)ql_dbg (ql_dbg_async, vha,0x5011 ,"Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n" , mb[1 ], mb[2 ], mb[3 ]); - -qlt_async_event (mb[0 ], vha, mb);break ; }
@@ -1065,8 +1063,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)set_bit (LOOP_RESYNC_NEEDED , &vha->dpc_flags);set_bit (LOCAL_LOOP_UPDATE , &vha->dpc_flags);set_bit (VP_CONFIG_OK , &vha->vp_flags); - -qlt_async_event (mb[0 ], vha, mb);break ;case MBA_RSCN_UPDATE :/* State Change Registration */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/74 scsi: iscsi: qla4xxx: fix double free in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit fee92f25777789d73e1936b91472e9c4644457c8 ]
On this error path we call qla4xxx_mem_free() and then the caller also calls qla4xxx_free_adapter() which calls qla4xxx_mem_free(). It leads to a couple double frees:
drivers/scsi/qla4xxx/ql4_os.c:8856 qla4xxx_probe_adapter() warn: 'ha->chap_dma_pool' double freed drivers/scsi/qla4xxx/ql4_os.c:8856 qla4xxx_probe_adapter() warn: 'ha->fw_ddb_dma_pool' double freed
--- drivers/scsi/qla4xxx/ql4_os.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +0 -1
@@ -4285,7 +4285,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)return QLA_SUCCESS ; mem_alloc_error_exit: -qla4xxx_mem_free (ha);return QLA_ERROR ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/74 scsi: libsas: stop discovering if oob mode is disconnected
In reply to Greg Kroah-HartmanFrom: Jason Yan <[email protected]>
[ Upstream commit f70267f379b5e5e11bdc5d72a56bf17e5feed01f ]
The discovering of sas port is driven by workqueue in libsas. When libsas is processing port events or phy events in workqueue, new events may rise up and change the state of some structures such as asd_sas_phy. This may cause some problems such as follows:
==>thread 1 ==>thread 2
==>phy up
==>phy_up_v3_hw()
==>oob_mode = SATA_OOB_MODE;
==>phy down quickly
==>hisi_sas_phy_down()
==>sas_ha->notify_phy_event()
==>sas_phy_disconnected()
==>oob_mode = OOB_NOT_CONNECTED
==>workqueue wakeup
==>sas_form_port()
==>sas_discover_domain()
==>sas_get_port_device()
==>oob_mode is OOB_NOT_CONNECTED and device
is wrongly taken as expanderThis at last lead to the panic when libsas trying to issue a command to discover the device.
[183047.614035] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000058 [183047.622896] Mem abort info: [183047.625762] ESR = 0x96000004 [183047.628893] Exception class = DABT (current EL), IL = 32 bits [183047.634888] SET = 0, FnV = 0 [183047.638015] EA = 0, S1PTW = 0 [183047.641232] Data abort info: [183047.644189] ISV = 0, ISS = 0x00000004 [183047.648100] CM = 0, WnR = 0 [183047.651145] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000b7df67be [183047.657834] [0000000000000058] pgd=0000000000000000 [183047.662789] Internal error: Oops: 96000004 [#1] SMP [183047.667740] Process kworker/u16:2 (pid: 31291, stack limit = 0x00000000417c4974) [183047.675208] CPU: 0 PID: 3291 Comm: kworker/u16:2 Tainted: G W OE 4.19.36-vhulk1907.1.0.h410.eulerosv2r8.aarch64 #1 [183047.687015] Hardware name: N/A N/A/Kunpeng Desktop Board D920S10, BIOS 0.15 10/22/2019 [183047.695007] Workqueue: 0000:74:02.0_disco_q sas_discover_domain [183047.700999] pstate: 20c00009 (nzCv daif +PAN +UAO) [183047.705864] pc : prep_ata_v3_hw+0xf8/0x230 [hisi_sas_v3_hw] [183047.711510] lr : prep_ata_v3_hw+0xb0/0x230 [hisi_sas_v3_hw] [183047.717153] sp : ffff00000f28ba60 [183047.720541] x29: ffff00000f28ba60 x28: ffff8026852d7228 [183047.725925] x27: ffff8027dba3e0a8 x26: ffff8027c05fc200 [183047.731310] x25: 0000000000000000 x24: ffff8026bafa8dc0 [183047.736695] x23: ffff8027c05fc218 x22: ffff8026852d7228 [183047.742079] x21: ffff80007c2f2940 x20: ffff8027c05fc200 [183047.747464] x19: 0000000000f80800 x18: 0000000000000010 [183047.752848] x17: 0000000000000000 x16: 0000000000000000 [183047.758232] x15: ffff000089a5a4ff x14: 0000000000000005 [183047.763617] x13: ffff000009a5a50e x12: ffff8026bafa1e20 [183047.769001] x11: ffff0000087453b8 x10: ffff00000f28b870 [183047.774385] x9 : 0000000000000000 x8 : ffff80007e58f9b0 [183047.779770] x7 : 0000000000000000 x6 : 000000000000003f [183047.785154] x5 : 0000000000000040 x4 : ffffffffffffffe0 [183047.790538] x3 : 00000000000000f8 x2 : 0000000002000007 [183047.795922] x1 : 0000000000000008 x0 : 0000000000000000 [183047.801307] Call trace: [183047.803827] prep_ata_v3_hw+0xf8/0x230 [hisi_sas_v3_hw] [183047.809127] hisi_sas_task_prep+0x750/0x888 [hisi_sas_main] [183047.814773] hisi_sas_task_exec.isra.7+0x88/0x1f0 [hisi_sas_main] [183047.820939] hisi_sas_queue_command+0x28/0x38 [hisi_sas_main] [183047.826757] smp_execute_task_sg+0xec/0x218 [183047.831013] smp_execute_task+0x74/0xa0 [183047.834921] sas_discover_expander.part.7+0x9c/0x5f8 [183047.839959] sas_discover_root_expander+0x90/0x160 [183047.844822] sas_discover_domain+0x1b8/0x1e8 [183047.849164] process_one_work+0x1b4/0x3f8 [183047.853246] worker_thread+0x54/0x470 [183047.856981] kthread+0x134/0x138 [183047.860283] ret_from_fork+0x10/0x18 [183047.863931] Code: f9407a80 528000e2 39409281 72a04002 (b9405800) [183047.870097] kernel fault(0x1) notification starting on CPU 0 [183047.875828] kernel fault(0x1) notification finished on CPU 0 [183047.881559] Modules linked in: unibsp(OE) hns3(OE) hclge(OE) hnae3(OE) mem_drv(OE) hisi_sas_v3_hw(OE) hisi_sas_main(OE) [183047.892418] ---[ end trace 4cc26083fc11b783 ]--- [183047.897107] Kernel panic - not syncing: Fatal exception [183047.902403] kernel fault(0x5) notification starting on CPU 0 [183047.908134] kernel fault(0x5) notification finished on CPU 0 [183047.913865] SMP: stopping secondary CPUs [183047.917861] Kernel Offset: disabled [183047.921422] CPU features: 0x2,a2a00a38 [183047.925243] Memory Limit: none [183047.928372] kernel reboot(0x2) notification starting on CPU 0 [183047.934190] kernel reboot(0x2) notification finished on CPU 0 [183047.940008] ---[ end Kernel panic - not syncing: Fatal exception
]---
--- drivers/scsi/libsas/sas_discover.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/libsas/sas_discover.c +10 -1
@@ -97,12 +97,21 @@ static int sas_get_port_device(struct asd_sas_port *port)else dev->dev_type =SAS_SATA_DEV ; dev->tproto =SAS_PROTOCOL_SATA ; - }else { + }else if (port->oob_mode ==SAS_OOB_MODE ) {struct sas_identify_frame *id = (struct sas_identify_frame *) dev->frame_rcvd; dev->dev_type = id->dev_type; dev->iproto = id->initiator_bits; dev->tproto = id->target_bits; + }else { +/* If the oob mode is OOB_NOT_CONNECTED, the port is +* disconnected due to race with PHY down. We cannot +* continue to discover this port +*/ +sas_put_device (dev); +pr_warn ("Port %016llx is disconnected when discovering\n" , +SAS_ADDR (port->attached_sas_addr)); +return -ENODEV ; }sas_init_dev (dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/74 drm/nouveau: Move the declaration of struct nouveau_conn_atom up a bit
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 37a68eab4cd92b507c9e8afd760fdc18e4fecac6 ]
Place the declaration of struct nouveau_conn_atom above that of struct nouveau_connector. This commit makes no changes to the moved block what so ever, it just moves it up a bit.
This is a preparation patch to fix some issues with connector handling on pre nv50 displays (which do not use atomic modesetting).
--- drivers/gpu/drm/nouveau/nouveau_connector.h | 110 ++++++++++---------- 1 file changed, 55 insertions(+), 55 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.h +55 -55
@@ -29,6 +29,7 @@#include <nvif/notify.h> +#include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include <drm/drm_encoder.h> #include <drm/drm_dp_helper.h>
@@ -37,6 +38,60 @@struct nvkm_i2c_port ; +#define nouveau_conn_atom (p) \ + container_of((p), struct nouveau_conn_atom, state) + +struct nouveau_conn_atom { +struct drm_connector_state state; + +struct { +/* The enum values specifically defined here match nv50/gf119 +* hw values, and the code relies on this. +*/ +enum { +DITHERING_MODE_OFF =0x00 , +DITHERING_MODE_ON =0x01 , +DITHERING_MODE_DYNAMIC2X2 =0x10 |DITHERING_MODE_ON , +DITHERING_MODE_STATIC2X2 =0x18 |DITHERING_MODE_ON , +DITHERING_MODE_TEMPORAL =0x20 |DITHERING_MODE_ON , +DITHERING_MODE_AUTO + } mode; +enum { +DITHERING_DEPTH_6BPC =0x00 , +DITHERING_DEPTH_8BPC =0x02 , +DITHERING_DEPTH_AUTO + } depth; + } dither; + +struct { +int mode;/* DRM_MODE_SCALE_* */ +struct { +enum { +UNDERSCAN_OFF , +UNDERSCAN_ON , +UNDERSCAN_AUTO , + } mode; +u32 hborder; +u32 vborder; + } underscan; +bool full; + } scaler; + +struct { +int color_vibrance; +int vibrant_hue; + } procamp; + +union { +struct { +bool dither:1 ; +bool scaler:1 ; +bool procamp:1 ; + }; +u8 mask; + } set; +}; +struct nouveau_connector {struct drm_connector base;enum dcb_connector_type type;
@@ -111,61 +166,6 @@ extern int nouveau_ignorelid;extern int nouveau_duallink;extern int nouveau_hdmimhz; -#include <drm/drm_crtc.h> -#define nouveau_conn_atom (p) \ - container_of((p), struct nouveau_conn_atom, state) - -struct nouveau_conn_atom { -struct drm_connector_state state; - -struct { -/* The enum values specifically defined here match nv50/gf119 -* hw values, and the code relies on this. -*/ -enum { -DITHERING_MODE_OFF =0x00 , -DITHERING_MODE_ON =0x01 , -DITHERING_MODE_DYNAMIC2X2 =0x10 |DITHERING_MODE_ON , -DITHERING_MODE_STATIC2X2 =0x18 |DITHERING_MODE_ON , -DITHERING_MODE_TEMPORAL =0x20 |DITHERING_MODE_ON , -DITHERING_MODE_AUTO - } mode; -enum { -DITHERING_DEPTH_6BPC =0x00 , -DITHERING_DEPTH_8BPC =0x02 , -DITHERING_DEPTH_AUTO - } depth; - } dither; - -struct { -int mode;/* DRM_MODE_SCALE_* */ -struct { -enum { -UNDERSCAN_OFF , -UNDERSCAN_ON , -UNDERSCAN_AUTO , - } mode; -u32 hborder; -u32 vborder; - } underscan; -bool full; - } scaler; - -struct { -int color_vibrance; -int vibrant_hue; - } procamp; - -union { -struct { -bool dither:1 ; -bool scaler:1 ; -bool procamp:1 ; - }; -u8 mask; - } set; -}; -void nouveau_conn_attach_properties (struct drm_connector *);void nouveau_conn_reset (struct drm_connector *); struct drm_connector_state *
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/74 usb: gadget: fix wrong endpoint desc
In reply to Greg Kroah-HartmanFrom: EJ Hsu <[email protected]>
[ Upstream commit e5b5da96da50ef30abb39cb9f694e99366404d24 ]
Gadget driver should always use config_ep_by_speed() to initialize usb_ep struct according to usb device's operating speed. Otherwise, usb_ep struct may be wrong if usb devcie's operating speed is changed.
The key point in this patch is that we want to make sure the desc pointer in usb_ep struct will be set to NULL when gadget is disconnected. This will force it to call config_ep_by_speed() to correctly initialize usb_ep struct based on the new operating speed when gadget is re-connected later.
--- drivers/usb/gadget/function/f_ecm.c | 6 +++++- drivers/usb/gadget/function/f_rndis.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_ecm.c +5 -1
@@ -625,8 +625,12 @@ static void ecm_disable(struct usb_function *f)DBG (cdev,"ecm deactivated\n" ); -if (ecm->port.in_ep->enabled) +if (ecm->port.in_ep->enabled) {gether_disconnect (&ecm->port); + }else { + ecm->port.in_ep->desc =NULL ; + ecm->port.out_ep->desc =NULL ; + }usb_ep_disable (ecm->notify); ecm->notify->desc =NULL ;
drivers/usb/gadget/function/f_rndis.c +1 -0
@@ -622,6 +622,7 @@ static void rndis_disable(struct usb_function *f)gether_disconnect (&rndis->port);usb_ep_disable (rndis->notify); + rndis->notify->desc =NULL ; }/*-------------------------------------------------------------------------*/
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 12/74 net: make socket read/write_iter() honor IOCB_NOWAIT
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit ebfcd8955c0b52eb793bcbc9e71140e3d0cdb228 ]
The socket read/write helpers only look at the file O_NONBLOCK. not the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 and io_uring that rely on not having the file itself marked nonblocking, but rather the iocb itself.
--- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/socket.c +2 -2
@@ -891,7 +891,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) .msg_iocb = iocb};ssize_t res; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (iocb->ki_pos !=0 )
@@ -916,7 +916,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)if (iocb->ki_pos !=0 )return -ESPIPE ; -if (file->f_flags &O_NONBLOCK ) +if (file->f_flags &O_NONBLOCK || (iocb->ki_flags &IOCB_NOWAIT )) msg.msg_flags =MSG_DONTWAIT ;if (sock->type ==SOCK_SEQPACKET )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/74 md: raid1: check rdev before reference in raid1_sync_request func
In reply to Greg Kroah-HartmanFrom: Zhiqiang Liu <[email protected]>
[ Upstream commit 028288df635f5a9addd48ac4677b720192747944 ]
In raid1_sync_request func, rdev should be checked before reference.
--- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1.c +1 -1
@@ -2749,7 +2749,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, write_targets++; } } -if (bio->bi_end_io) { +if (rdev && bio->bi_end_io) {atomic_inc (&rdev->nr_pending); bio->bi_iter.bi_sector = sector_nr + rdev->data_offset;bio_set_dev (bio, rdev->bdev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 14/74 s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit 39d4a501a9ef55c57b51e3ef07fc2aeed7f30b3b ]
Function perf_event_ever_overflow() and perf_event_account_interrupt() are called every time samples are processed by the interrupt handler. However function perf_event_account_interrupt() has checks to avoid being flooded with interrupts (more then 1000 samples are received per task_tick). Samples are then dropped and a PERF_RECORD_THROTTLED is added to the perf data. The perf subsystem limit calculation is:
maximum sample frequency := 100000 --> 1 samples per 10 us
task_tick = 10ms = 10000us --> 1000 samples per task_tickThe work flow is
measurement_alert() uses SDBT head and each SBDT points to 511
SDB pages, each with 126 sample entries. After processing 8 SBDs and for each valid sample calling:
perf_event_overflow()
perf_event_account_interrupts()
there is a considerable amount of samples being dropped, especially when the sample frequency is very high and near the 100000 limit.
To avoid the high amount of samples being dropped near the end of a task_tick time frame, increment the sampling interval in case of dropped events. The CPU Measurement sampling facility on the s390 supports only intervals, specifiing how many CPU cycles have to be executed before a sample is generated. Increase the interval when the samples being generated hit the task_tick limit.
--- arch/s390/kernel/perf_cpum_sf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/s390/kernel/perf_cpum_sf.c +16 -0
@@ -1306,6 +1306,22 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)if (sampl_overflow)OVERFLOW_REG (hwc) =DIV_ROUND_UP (OVERFLOW_REG (hwc) + sampl_overflow,1 + num_sdb); + +/* Perf_event_overflow() and perf_event_account_interrupt() limit +* the interrupt rate to an upper limit. Roughly 1000 samples per +* task tick. +* Hitting this limit results in a large number +* of throttled REF_REPORT_THROTTLE entries and the samples +* are dropped. +* Slightly increase the interval to avoid hitting this limit. +*/ +if (event_overflow) { +SAMPL_RATE (hwc) +=DIV_ROUND_UP (SAMPL_RATE (hwc),10 ); +debug_sprintf_event (sfdbg,1 ,"%s: rate adjustment %ld\n" , + __func__, +DIV_ROUND_UP (SAMPL_RATE (hwc),10 )); + } +if (sampl_overflow || event_overflow) debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " "overflow stats: sample=%llu event=%llu\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/74 s390/cpum_sf: Avoid SBD overflow condition in irq handler
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit 0539ad0b22877225095d8adef0c376f52cc23834 ]
The s390 CPU Measurement sampling facility has an overflow condition which fires when all entries in a SBD are used.
The measurement alert interrupt is triggered and reads out all samples in this SDB. It then tests the successor SDB, if this SBD is not full, the interrupt handler does not read any samples at all from this SDB The design waits for the hardware to fill this SBD and then trigger another meassurement alert interrupt.
This scheme works nicely until
an perf_event_overflow() function call discards the sample due to a too high sampling rate.
The interrupt handler has logic to read out a partially filled SDB when the perf event overflow condition in linux common code is met. This causes the CPUM sampling measurement hardware and the PMU device driver to operate on the same SBD's trailer entry. This should not happen.
This can be seen here using this trace:
cpumsf_pmu_add: tear:0xb5286000
hw_perf_event_update: sdbt 0xb5286000 full 1 over 0 flush_all:0
hw_perf_event_update: sdbt 0xb5286008 full 0 over 0 flush_all:0
above shows 1. interrupt
hw_perf_event_update: sdbt 0xb5286008 full 1 over 0 flush_all:0
hw_perf_event_update: sdbt 0xb5286008 full 0 over 0 flush_all:0
above shows 2. interrupt
... this goes on fine until...
hw_perf_event_update: sdbt 0xb5286068 full 1 over 0 flush_all:0
perf_push_sample1: overflow
one or more samples read from the IRQ handler are rejected by perf_event_overflow() and the IRQ handler advances to the next SDB and modifies the trailer entry of a partially filled SDB.
hw_perf_event_update: sdbt 0xb5286070 full 0 over 0 flush_all:1
timestamp: 14:32:52.519953
Next time the IRQ handler is called for this SDB the trailer entry shows an overflow count of 19 missed entries.
hw_perf_event_update: sdbt 0xb5286070 full 1 over 19 flush_all:1
timestamp: 14:32:52.970058
Remove access to a follow on SDB when event overflow happened.
--- arch/s390/kernel/perf_cpum_sf.c | 6 ------ 1 file changed, 6 deletions(-)
arch/s390/kernel/perf_cpum_sf.c +0 -6
@@ -1294,12 +1294,6 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)*/ if (flush_all && done)break ; - -/* If an event overflow happened, discard samples by -* processing any remaining sample-data-blocks. -*/ -if (event_overflow) - flush_all =1 ; }/* Account sample overflows in the event hardware structure */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/74 IB/mlx4: Follow mirror sequence of device add during device removal
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 89f988d93c62384758b19323c886db917a80c371 ]
Current code device add sequence is:
ib_register_device()ib_mad_init()init_sriov_init()register_netdev_notifier()
Therefore, the remove sequence should be,
unregister_netdev_notifier()close_sriov()mad_cleanup()ib_unregister_device()
However it is not above.
Hence, make do above remove sequence.
--- drivers/infiniband/hw/mlx4/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx4/main.c +5 -4
@@ -3073,16 +3073,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) ibdev->ib_active = false;flush_workqueue (wq); -mlx4_ib_close_sriov (ibdev); -mlx4_ib_mad_cleanup (ibdev); -ib_unregister_device (&ibdev->ib_dev); -mlx4_ib_diag_cleanup (ibdev);if (ibdev->iboe.nb.notifier_call) {if (unregister_netdevice_notifier (&ibdev->iboe.nb))pr_warn ("failure unregistering notifier\n" ); ibdev->iboe.nb.notifier_call =NULL ; } +mlx4_ib_close_sriov (ibdev); +mlx4_ib_mad_cleanup (ibdev); +ib_unregister_device (&ibdev->ib_dev); +mlx4_ib_diag_cleanup (ibdev); +mlx4_qp_release_range (dev, ibdev->steer_qpn_base, ibdev->steer_qpn_count);kfree (ibdev->ib_uc_qpns_bitmap);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/74 xen-blkback: prevent premature module unload
In reply to Greg Kroah-HartmanFrom: Paul Durrant <[email protected]>
[ Upstream commit fa2ac657f9783f0891b2935490afe9a7fd29d3fa ]
Objects allocated by xen_blkif_alloc come from the 'blkif_cache' kmem cache. This cache is destoyed when xen-blkif is unloaded so it is necessary to wait for the deferred free routine used for such objects to complete. This necessity was missed in commit 14855954f636 "xen-blkback:
allow module to be cleanly unloaded". This patch fixes the problem by taking/releasing extra module references in xen_blkif_alloc/free() respectively.
--- drivers/block/xen-blkback/xenbus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/block/xen-blkback/xenbus.c +10 -0
@@ -178,6 +178,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) blkif->domid = domid;atomic_set (&blkif->refcnt,1 );init_completion (&blkif->drain_complete); + +/* +* Because freeing back to the cache may be deferred, it is not +* safe to unload the module (and hence destroy the cache) until +* this has completed. To prevent premature unloading, take an +* extra module reference here and release only when the object +* has been freed back to the cache. +*/ +__module_get (THIS_MODULE );INIT_WORK (&blkif->free_work, xen_blkif_deferred_free);return blkif;
@@ -327,6 +336,7 @@ static void xen_blkif_free(struct xen_blkif *blkif)/* Make sure everything is drained before shutting down */ kmem_cache_free (xen_blkif_cachep, blkif); +module_put (THIS_MODULE ); }int __init xen_blkif_interface_init (void )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/74 xen/balloon: fix ballooned page accounting without hotplug enabled
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit c673ec61ade89bf2f417960f986bc25671762efb ]
When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages().
This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches.
--- drivers/xen/balloon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/balloon.c +2 -1
@@ -401,7 +401,8 @@ static struct notifier_block xen_memory_nb = {#else static enum bp_state reserve_additional_memory (void ) { - balloon_stats.target_pages = balloon_stats.current_pages; + balloon_stats.target_pages = balloon_stats.current_pages + + balloon_stats.target_unpopulated;return BP_ECANCELED ; }#endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/74 PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
In reply to Greg Kroah-HartmanFrom: Andy Whitcroft <[email protected]>
[ Upstream commit da6043fe85eb5ec621e34a92540735dcebbea134 ]
When looking for a bit by number we make use of the cached result from the preceding lookup to speed up operation. Firstly we check if the requested pfn is within the cached zone and if not lookup the new zone. We then check if the offset for that pfn falls within the existing cached node. This happens regardless of whether the node is within the zone we are now scanning. With certain memory layouts it is possible for this to false trigger creating a temporary alias for the pfn to a different bit. This leads the hibernation code to free memory which it was never allocated with the expected fallout.
Ensure the zone we are scanning matches the cached zone before considering the cached node.
Deep thanks go to Andrea for many, many, many hours of hacking and testing that went into cornering this bug.
--- kernel/power/snapshot.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/power/snapshot.c +8 -1
@@ -734,8 +734,15 @@ static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn,* We have found the zone. Now walk the radix tree to find the leaf node * for our PFN. */ + +/* +* If the zone we wish to scan is the the current zone and the +* pfn falls into the current node then we do not need to walk +* the tree. +*/ node = bm->cur.node; -if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) +if (zone == bm->cur.zone && + ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK ) == bm->cur.node_pfn) goto node_found; node = zone->rtree;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/74 xfs: fix mount failure crash on invalid iclog memory access
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit 798a9cada4694ca8d970259f216cec47e675bfd5 ]
syzbot (via KASAN) reports a use-after-free in the error path of xlog_alloc_log(). Specifically, the iclog freeing loop doesn't handle the case of a fully initialized ->l_iclog linked list. Instead, it assumes that the list is partially constructed and NULL terminated.
This bug manifested because there was no possible error scenario after iclog list setup when the original code was added. Subsequent code and associated error conditions were added some time later, while the original error handling code was never updated. Fix up the error loop to terminate either on a NULL iclog or reaching the end of the list.
--- fs/xfs/xfs_log.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/xfs_log.c +2 -0
@@ -1539,6 +1539,8 @@ xlog_alloc_log(if (iclog->ic_bp)xfs_buf_free (iclog->ic_bp);kmem_free (iclog); +if (prev_iclog == log->l_iclog) +break ; }spinlock_destroy (&log->l_icloglock);xfs_buf_free (log->l_xbuf);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/74 taskstats: fix data-race
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
[ Upstream commit 0b8d616fb5a8ffa307b1d3af37f55c15dae14f28 ]
When assiging and testing taskstats in taskstats_exit() there's a race when setting up and reading sig->stats when a thread-group with more than one thread exits:
write to 0xffff8881157bbe10 of 8 bytes by task 7951 on cpu 0:
taskstats_tgid_alloc kernel/taskstats.c:567 [inline] taskstats_exit+0x6b7/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 get_signal+0x2a2/0x1320 kernel/signal.c:2734 do_signal+0x3b/0xc00 arch/x86/kernel/signal.c:815 exit_to_usermode_loop+0x250/0x2c0 arch/x86/entry/common.c:159 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x2d7/0x2f0 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff8881157bbe10 of 8 bytes by task 7949 on cpu 1:
taskstats_tgid_alloc kernel/taskstats.c:559 [inline] taskstats_exit+0xb2/0x717 kernel/taskstats.c:596 do_exit+0x2c2/0x18e0 kernel/exit.c:864 do_group_exit+0xb4/0x1c0 kernel/exit.c:983 __do_sys_exit_group kernel/exit.c:994 [inline] __se_sys_exit_group kernel/exit.c:992 [inline] __x64_sys_exit_group+0x2e/0x30 kernel/exit.c:992 do_syscall_64+0xcf/0x2f0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix this by using smp_load_acquire() and smp_store_release().
--- kernel/taskstats.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
kernel/taskstats.c +19 -11
@@ -568,25 +568,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)static struct taskstats *taskstats_tgid_alloc (struct task_struct *tsk) {struct signal_struct *sig = tsk->signal; -struct taskstats *stats; +struct taskstats *stats_new, *stats; -if (sig->stats ||thread_group_empty (tsk)) - goto ret; +/* Pairs with smp_store_release() below. */ + stats =smp_load_acquire (&sig->stats); +if (stats ||thread_group_empty (tsk)) +return stats;/* No problem if kmem_cache_zalloc() fails */ - stats =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL ); + stats_new =kmem_cache_zalloc (taskstats_cache,GFP_KERNEL );spin_lock_irq (&tsk->sighand->siglock); -if (!sig->stats) { - sig->stats = stats; - stats =NULL ; + stats = sig->stats; +if (!stats) { +/* +* Pairs with smp_store_release() above and order the +* kmem_cache_zalloc(). +*/ +smp_store_release (&sig->stats, stats_new); + stats = stats_new; + stats_new =NULL ; }spin_unlock_irq (&tsk->sighand->siglock); -if (stats) -kmem_cache_free (taskstats_cache, stats); -ret: -return sig->stats; +if (stats_new) +kmem_cache_free (taskstats_cache, stats_new); + +return stats; }/* Send pid data out on exit */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/74 drm: limit to INT_MAX in create_blob ioctl
In reply to Greg Kroah-HartmanFrom: Daniel Vetter <[email protected]>
[ Upstream commit 5bf8bec3f4ce044a223c40cbce92590d938f0e9c ]
The hardened usercpy code is too paranoid ever since commit 6a30afa8c1fb ("uaccess: disallow > INT_MAX copy sizes")
Code itself should have been fine as-is.
--- drivers/gpu/drm/drm_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_property.c +1 -1
@@ -540,7 +540,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,struct drm_property_blob *blob;int ret; -if (!length || length >ULONG_MAX -sizeof (struct drm_property_blob )) +if (!length || length >INT_MAX -sizeof (struct drm_property_blob ))return ERR_PTR (-EINVAL ); blob =kvzalloc (sizeof (struct drm_property_blob )+length,GFP_KERNEL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/74 ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 0aec96f5897ac16ad9945f531b4bef9a2edd2ebd upstream.
Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724 driver with Infrasonic Quartet support code: namely, ice->set_rate callback gets called inside ice->reg_lock spinlock, while the callback in quartet.c holds ice->gpio_mutex.
This patch fixes the invalid call: it simply moves the calls of ice->set_rate and ice->set_mclk callbacks outside the spinlock.
--- sound/pci/ice1712/ice1724.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
sound/pci/ice1712/ice1724.c +6 -3
@@ -661,6 +661,7 @@ static int snd_vt1724_set_pro_rate(strucunsigned long flags;unsigned char mclk_change;unsigned int i, old_rate; +bool call_set_rate = false;if (rate > ice->hw_rates->list[ice->hw_rates->count -1 ])return -EINVAL ;
@@ -684,7 +685,7 @@ static int snd_vt1724_set_pro_rate(struc* setting clock rate for internal clock mode */ old_rate = ice->get_rate (ice);if (force || (old_rate != rate)) - ice->set_rate (ice, rate); + call_set_rate = true;else if (rate == ice->cur_rate) {spin_unlock_irqrestore (&ice->reg_lock, flags);return 0 ;
@@ -692,12 +693,14 @@ static int snd_vt1724_set_pro_rate(struc } ice->cur_rate = rate; +spin_unlock_irqrestore (&ice->reg_lock, flags); + +if (call_set_rate) + ice->set_rate (ice, rate);/* setting master clock */ mclk_change = ice->set_mclk (ice, rate); -spin_unlock_irqrestore (&ice->reg_lock, flags); -if (mclk_change && ice->gpio.i2s_mclk_changed) ice->gpio.i2s_mclk_changed (ice);if (ice->gpio.set_pro_rate)
Greg Kroah-Hartman
maintainerPATCH 24/74 drm/sun4i: hdmi: Remove duplicate cleanup calls
In reply to Greg Kroah-HartmanFrom: Stefan Mavrodiev <[email protected]>
commit 57177d214ee0816c4436c23d6c933ccb32c571f1 upstream.
When the HDMI unbinds drm_connector_cleanup() and drm_encoder_cleanup() are called. This also happens when the connector and the encoder are destroyed. This double call triggers a NULL pointer exception.
The patch fixes this by removing the cleanup calls in the unbind function.
--- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +0 -2
@@ -438,8 +438,6 @@ static void sun4i_hdmi_unbind(struct devstruct sun4i_hdmi *hdmi =dev_get_drvdata (dev);cec_unregister_adapter (hdmi->cec_adap); -drm_connector_cleanup (&hdmi->connector); -drm_encoder_cleanup (&hdmi->encoder);i2c_del_adapter (hdmi->i2c);clk_disable_unprepare (hdmi->mod_clk);clk_disable_unprepare (hdmi->bus_clk);
Greg Kroah-Hartman
maintainerPATCH 25/74 MIPS: Avoid VDSO ABI breakage due to global register variable
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
commit bbcc5672b0063b0e9d65dc8787a4f09c3b5bb5cc upstream.
Declaring __current_thread_info as a global register variable has the effect of preventing GCC from saving & restoring its value in cases where the ABI would typically do so.
To quote GCC documentation:
Quoted 4 lines
If the register is a call-saved register, call ABI is affected: the register will not be restored in function epilogue sequences after the variable has been assigned. Therefore, functions cannot safely return to callers that assume standard ABI.
When our position independent VDSO is built for the n32 or n64 ABIs all functions it exposes should be preserving the value of $gp/$28 for their caller, but in the presence of the __current_thread_info global register variable GCC stops doing so & simply clobbers $gp/$28 when calculating the address of the GOT.
In cases where the VDSO returns success this problem will typically be masked by the caller in libc returning & restoring $gp/$28 itself, but that is by no means guaranteed. In cases where the VDSO returns an error libc will typically contain a fallback path which will now fail (typically with a bad memory access) if it attempts anything which relies upon the value of $gp/$28 - eg. accessing anything via the GOT.
One fix for this would be to move the declaration of __current_thread_info inside the current_thread_info() function, demoting it from global register variable to local register variable & avoiding inadvertently creating a non-standard calling ABI for the VDSO. Unfortunately this causes issues for clang, which doesn't support local register variables as pointed out by commit fe92da0f355e ("MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC") which introduced the global register variable before we had a VDSO to worry about.
Instead, fix this by continuing to use the global register variable for the kernel proper but declare __current_thread_info as a simple extern variable when building the VDSO. It should never be referenced, and will cause a link error if it is. This resolves the calling convention issue for the VDSO without having any impact upon the build of the kernel itself for either clang or gcc.
--- arch/mips/include/asm/thread_info.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
arch/mips/include/asm/thread_info.h +19 -1
@@ -52,8 +52,26 @@ struct thread_info {#define init_thread_info (init_thread_union.thread_info)#define init_stack (init_thread_union.stack) -/* How to get the thread information struct from C. */ +/* +* A pointer to the struct thread_info for the currently executing thread is +* held in register $28/$gp. +* +* We declare __current_thread_info as a global register variable rather than a +* local register variable within current_thread_info() because clang doesn't +* support explicit local register variables. +* +* When building the VDSO we take care not to declare the global register +* variable because this causes GCC to not preserve the value of $28/$gp in +* functions that change its value (which is common in the PIC VDSO when +* accessing the GOT). Since the VDSO shouldn't be accessing +* __current_thread_info anyway we declare it extern in order to cause a link +* failure if it's referenced. +*/ +#ifdef __VDSO__ +extern struct thread_info *__current_thread_info; +#else registerstruct thread_info *__current_thread_info __asm__("$28" ); +#endif static inline struct thread_info *current_thread_info (void ) {
Greg Kroah-Hartman
maintainerPATCH 26/74 media: pulse8-cec: fix lost cec_transmit_attempt_done() call
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit e5a52a1d15c79bb48a430fb263852263ec1d3f11 upstream.
The periodic PING command could interfere with the result of a CEC transmit, causing a lost cec_transmit_attempt_done() call.
--- drivers/media/usb/pulse8-cec/pulse8-cec.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/media/usb/pulse8-cec/pulse8-cec.c +13 -4
@@ -121,6 +121,7 @@ struct pulse8 {unsigned int vers;struct completion cmd_done;struct work_struct work; +u8 work_result;struct delayed_work ping_eeprom_work;struct cec_msg rx_msg;u8 data[DATA_SIZE ];
@@ -142,8 +143,10 @@ static void pulse8_irq_work_handler(stru {struct pulse8 *pulse8 = container_of(work, struct pulse8, work); +u8 result = pulse8->work_result; -switch (pulse8->data[0 ] &0x3f ) { + pulse8->work_result =0 ; +switch (result &0x3f ) {case MSGCODE_FRAME_DATA :cec_received_msg (pulse8->adap, &pulse8->rx_msg);break ;
@@ -177,12 +180,12 @@ static irqreturn_t pulse8_interrupt(stru pulse8->escape = false; }else if (data ==MSGEND ) {struct cec_msg *msg = &pulse8->rx_msg; +u8 msgcode = pulse8->buf[0 ];if (debug)dev_info (pulse8->dev,"received: %*ph\n" , pulse8->idx, pulse8->buf); - pulse8->data[0 ] = pulse8->buf[0 ]; -switch (pulse8->buf[0 ] &0x3f ) { +switch (msgcode &0x3f ) {case MSGCODE_FRAME_START : msg->len =1 ; msg->msg[0 ] = pulse8->buf[1 ];
@@ -191,14 +194,20 @@ static irqreturn_t pulse8_interrupt(struif (msg->len ==CEC_MAX_MSG_SIZE )break ; msg->msg[msg->len++] = pulse8->buf[1 ]; -if (pulse8->buf[0 ] &MSGCODE_FRAME_EOM ) +if (msgcode &MSGCODE_FRAME_EOM ) { +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work); +break ; + }break ;case MSGCODE_TRANSMIT_SUCCEEDED :case MSGCODE_TRANSMIT_FAILED_LINE :case MSGCODE_TRANSMIT_FAILED_ACK :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA :case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE : +WARN_ON (pulse8->work_result); + pulse8->work_result = msgcode;schedule_work (&pulse8->work);break ;case MSGCODE_HIGH_ERROR :
Greg Kroah-Hartman
maintainerPATCH 27/74 media: cec: CEC 2.0-only bcast messages were ignored
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit cec935ce69fc386f13959578deb40963ebbb85c3 upstream.
Some messages are allowed to be a broadcast message in CEC 2.0 only, and should be ignored by CEC 1.4 devices.
Unfortunately, the check was wrong, causing such messages to be marked as invalid under CEC 2.0.
--- drivers/media/cec/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/cec-adap.c +3 -3
@@ -1031,11 +1031,11 @@ void cec_received_msg_ts(struct cec_adap valid_la = false; else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) valid_la = false; - else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) + else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) valid_la = false; else if (cec_msg_is_broadcast(msg) && - adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && - !(dir_fl & BCAST2_0)) + adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && + !(dir_fl & BCAST1_4)) valid_la = false; }if (valid_la && min_len) {
Greg Kroah-Hartman
maintainerPATCH 28/74 media: cec: avoid decrementing transmit_queue_sz if it is 0
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
commit 95c29d46ab2a517e4c26d0a07300edca6768db17 upstream.
WARN if transmit_queue_sz is 0 but do not decrement it. The CEC adapter will become unresponsive if it goes below 0 since then it thinks there are 4 billion messages in the queue.
Obviously this should not happen, but a driver bug could cause this.
--- drivers/media/cec/cec-adap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/media/cec/cec-adap.c +12 -2
@@ -330,7 +330,8 @@ static void cec_data_cancel(struct cec_d }else {list_del_init (&data->list);if (!(data->msg.tx_status &CEC_TX_STATUS_OK )) - data->adap->transmit_queue_sz--; +if (!WARN_ON (!data->adap->transmit_queue_sz)) + data->adap->transmit_queue_sz--; }/* Mark it as an error */
@@ -377,6 +378,14 @@ static void cec_flush(struct cec_adapter* need to do anything special in that case. */ } +/* +* If something went wrong and this counter isn't what it should +* be, then this will reset it back to 0. Warn if it is not 0, +* since it indicates a bug, either in this framework or in a +* CEC driver. +*/ +if (WARN_ON (adap->transmit_queue_sz)) + adap->transmit_queue_sz =0 ; }/*
@@ -465,7 +474,8 @@ int cec_thread_func(void *_adap) data =list_first_entry (&adap->transmit_queue, struct cec_data, list);list_del_init (&data->list); - adap->transmit_queue_sz--; +if (!WARN_ON (!data->adap->transmit_queue_sz)) + adap->transmit_queue_sz--;/* Make this the current transmitting message */ adap->transmitting = data;
Greg Kroah-Hartman
maintainerPATCH 29/74 mm/zsmalloc.c: fix the migrated zspage statistics.
In reply to Greg Kroah-HartmanFrom: Chanho Min <[email protected]>
commit ac8f05da5174c560de122c499ce5dfb5d0dfbee5 upstream.
When zspage is migrated to the other zone, the zone page state should be updated as well, otherwise the NR_ZSPAGE for each zone shows wrong counts including proc/zoneinfo in practice.
--- mm/zsmalloc.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/zsmalloc.c +5 -0
@@ -2088,6 +2088,11 @@ int zs_page_migrate(struct address_spacezs_pool_dec_isolated (pool); } +if (page_zone (newpage) !=page_zone (page)) { +dec_zone_page_state (page,NR_ZSPAGES ); +inc_zone_page_state (newpage,NR_ZSPAGES ); + } +reset_page (page);put_page (page); page = newpage;
Greg Kroah-Hartman
maintainerPATCH 30/74 memcg: account security cred as well to kmemcg
In reply to Greg Kroah-HartmanFrom: Shakeel Butt <[email protected]>
commit 84029fd04c201a4c7e0b07ba262664900f47c6f5 upstream.
The cred_jar kmem_cache is already memcg accounted in the current kernel but cred->security is not. Account cred->security to kmemcg.
Recently we saw high root slab usage on our production and on further inspection, we found a buggy application leaking processes. Though that buggy application was contained within its memcg but we observe much more system memory overhead, couple of GiBs, during that period. This overhead can adversely impact the isolation on the system.
One source of high overhead we found was cred->security objects, which have a lifetime of at least the life of the process which allocated them.
--- kernel/cred.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cred.c +3 -3
@@ -220,7 +220,7 @@ struct cred *cred_alloc_blank(void) new->magic =CRED_MAGIC ;#endif -if (security_cred_alloc_blank (new,GFP_KERNEL ) <0 ) +if (security_cred_alloc_blank (new,GFP_KERNEL_ACCOUNT ) <0 ) goto error;return new;
@@ -279,7 +279,7 @@ struct cred *prepare_creds(void) new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL ) <0 ) +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) goto error;validate_creds (new);return new;
@@ -654,7 +654,7 @@ struct cred *prepare_kernel_cred(struct#ifdef CONFIG_SECURITY new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL ) <0 ) +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) goto error;put_cred (old);
Greg Kroah-Hartman
maintainerPATCH 31/74 pstore/ram: Write new dumps to start of recycled zones
In reply to Greg Kroah-HartmanFrom: Aleksandr Yashkin <[email protected]>
commit 9e5f1c19800b808a37fb9815a26d382132c26c3d upstream.
The ram_core.c routines treat przs as circular buffers. When writing a new crash dump, the old buffer needs to be cleared so that the new dump doesn't end up in the wrong place (i.e. at the end).
The solution to this problem is to reset the circular buffer state before writing a new Oops dump.
--- fs/pstore/ram.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/pstore/ram.c +11 -0
@@ -433,6 +433,17 @@ static int notrace ramoops_pstore_write( prz = cxt->dprzs[cxt->dump_write_cnt]; +/* +* Since this is a new crash dump, we need to reset the buffer in +* case it still has an old dump present. Without this, the new dump +* will get appended, which would seriously confuse anything trying +* to check dump file contents. Specifically, ramoops_read_kmsg_hdr() +* expects to find a dump header in the beginning of buffer data, so +* we must to reset the buffer values, in order to ensure that the +* header will be written to the beginning of the buffer. +*/ +persistent_ram_zap (prz); +/* Build header and append record contents. */ hlen =ramoops_write_kmsg_hdr (prz, record); size = record->size;
Greg Kroah-Hartman
maintainerPATCH 32/74 locks: print unsigned ino in /proc/locks
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit 98ca480a8f22fdbd768e3dad07024c8d4856576c upstream.
An ino is unsigned, so display it as such in /proc/locks.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -2691,7 +2691,7 @@ static void lock_get_status(struct seq_f }if (inode) {/* userspace relies on this representation of dev_t */ -seq_printf (f,"%d %02x:%02x:%ld " , fl_pid, +seq_printf (f,"%d %02x:%02x:%lu " , fl_pid,MAJOR (inode->i_sb->s_dev),MINOR (inode->i_sb->s_dev), inode->i_ino); }else {
Greg Kroah-Hartman
maintainerPATCH 33/74 dmaengine: Fix access to uninitialized dma_slave_caps
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 53a256a9b925b47c7e67fc1f16ca41561a7b877c upstream.
dmaengine_desc_set_reuse() allocates a struct dma_slave_caps on the stack, populates it using dma_get_slave_caps() and then accesses one of its members.
However dma_get_slave_caps() may fail and this isn't accounted for, leading to a legitimate warning of gcc-4.9 (but not newer versions):
In file included from drivers/spi/spi-bcm2835.c:19:0:
drivers/spi/spi-bcm2835.c: In function 'dmaengine_desc_set_reuse':
Quoted 1 line
Quoted 1 line
include/linux/dmaengine.h:1370:10: warning: 'caps.descriptor_reuse' is used uninitialized in this function [-Wuninitialized]
if (caps.descriptor_reuse) {Fix it, thereby also silencing the gcc-4.9 warning.
The issue has been present for 4 years but surfaces only now that the first caller of dmaengine_desc_set_reuse() has been added in spi-bcm2835.c. Another user of reusable DMA descriptors has existed for a while in pxa_camera.c, but it sets the DMA_CTRL_REUSE flag directly instead of calling dmaengine_desc_set_reuse(). Nevertheless, tag this commit for stable in case there are out-of-tree users.
--- include/linux/dmaengine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/dmaengine.h +4 -1
@@ -1362,8 +1362,11 @@ static inline int dma_get_slave_caps(strstatic inline int dmaengine_desc_set_reuse (struct dma_async_tx_descriptor *tx) {struct dma_slave_caps caps; +int ret; -dma_get_slave_caps (tx->chan, &caps); + ret =dma_get_slave_caps (tx->chan, &caps); +if (ret) +return ret;if (caps.descriptor_reuse) { tx->flags |=DMA_CTRL_REUSE ;
Greg Kroah-Hartman
maintainerPATCH 34/74 compat_ioctl: block: handle Persistent Reservations
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit b2c0fcd28772f99236d261509bcd242135677965 upstream.
These were added to blkdev_ioctl() in linux-5.5 but not blkdev_compat_ioctl, so add them now.
Fold in followup patch from Arnd with missing pr.h header include.
--- block/compat_ioctl.c | 9 +++++++++ 1 file changed, 9 insertions(+)
block/compat_ioctl.c +9 -0
@@ -6,6 +6,7 @@#include <linux/compat.h> #include <linux/elevator.h> #include <linux/hdreg.h> +#include <linux/pr.h> #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/types.h>
@@ -401,6 +402,14 @@ long compat_blkdev_ioctl(struct file *ficase BLKTRACETEARDOWN :/* compatible */ ret =blk_trace_ioctl (bdev, cmd,compat_ptr (arg));return ret; +case IOC_PR_REGISTER : +case IOC_PR_RESERVE : +case IOC_PR_RELEASE : +case IOC_PR_PREEMPT : +case IOC_PR_PREEMPT_ABORT : +case IOC_PR_CLEAR : +return blkdev_ioctl (bdev, mode, cmd, + (unsigned long )compat_ptr (arg));default :if (disk->fops->compat_ioctl) ret = disk->fops->compat_ioctl (bdev, mode, cmd, arg);
Greg Kroah-Hartman
maintainerPATCH 35/74 compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 673bdf8ce0a387ef585c13b69a2676096c6edfe9 upstream.
These were added to blkdev_ioctl() but not blkdev_compat_ioctl, so add them now.
--- block/compat_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
block/compat_ioctl.c +2 -0
@@ -355,6 +355,8 @@ long compat_blkdev_ioctl(struct file *fi* but we call blkdev_ioctl, which gets the lock for us */ case BLKRRPART : +case BLKREPORTZONE : +case BLKRESETZONE :return blkdev_ioctl (bdev, mode, cmd, (unsigned long )compat_ptr (arg));case BLKBSZSET_32 :
Greg Kroah-Hartman
maintainerPATCH 36/74 ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 84b032dbfdf1c139cd2b864e43959510646975f8 upstream.
This reverts commit 6bb86fefa086faba7b60bb452300b76a47cde1a5 ("libahci_platform: Staticize ahci_platform_<en/dis>able_phys()") we are going to need ahci_platform_{enable,disable}_phys() in a subsequent commit for ahci_brcm.c in order to properly control the PHY initialization order.
Also make sure the function prototypes are declared in include/linux/ahci_platform.h as a result.
--- drivers/ata/libahci_platform.c | 6 ++++-- include/linux/ahci_platform.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +4 -2
@@ -46,7 +46,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops);* RETURNS: * 0 on success otherwise a negative error code */ -static int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv) {int rc, i;
@@ -71,6 +71,7 @@ disable_phys: }return rc; } +EXPORT_SYMBOL_GPL (ahci_platform_enable_phys);/** * ahci_platform_disable_phys - Disable PHYs
@@ -78,7 +79,7 @@ disable_phys:* * This function disables all PHYs found in hpriv->phys. */ -static void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv) {int i;
@@ -87,6 +88,7 @@ static void ahci_platform_disable_phys(sphy_exit (hpriv->phys[i]); } } +EXPORT_SYMBOL_GPL (ahci_platform_disable_phys);/** * ahci_platform_enable_clks - Enable platform clocks
include/linux/ahci_platform.h +2 -0
@@ -23,6 +23,8 @@ struct ahci_host_priv;struct platform_device ;struct scsi_host_template ; +int ahci_platform_enable_phys (struct ahci_host_priv *hpriv); +void ahci_platform_disable_phys (struct ahci_host_priv *hpriv);int ahci_platform_enable_clks (struct ahci_host_priv *hpriv);void ahci_platform_disable_clks (struct ahci_host_priv *hpriv);int ahci_platform_enable_regulators (struct ahci_host_priv *hpriv);
Greg Kroah-Hartman
maintainerPATCH 37/74 ata: ahci_brcm: Allow optional reset controller to be used
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit 2b2c47d9e1fe90311b725125d6252a859ee87a79 upstream.
On BCM63138, we need to reset the AHCI core prior to start utilizing it, grab the reset controller device cookie and do that.
--- drivers/ata/ahci_brcm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/ata/ahci_brcm.c +7 -0
@@ -25,6 +25,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/reset.h> #include <linux/string.h> #include "ahci.h"
@@ -87,6 +88,7 @@ struct brcm_ahci_priv {u32 port_mask;u32 quirks;enum brcm_ahci_version version; +struct reset_control *rcdev; };static const struct ata_port_info ahci_brcm_port_info = {
@@ -327,6 +329,11 @@ static int brcm_ahci_probe(struct platfoif (IS_ERR (priv->top_ctrl))return PTR_ERR (priv->top_ctrl); +/* Reset is optional depending on platform */ + priv->rcdev =devm_reset_control_get (&pdev->dev,"ahci" ); +if (!IS_ERR_OR_NULL (priv->rcdev)) +reset_control_deassert (priv->rcdev); +if ((priv->version ==BRCM_SATA_BCM7425 ) || (priv->version ==BRCM_SATA_NSP )) { priv->quirks |=BRCM_AHCI_QUIRK_NO_NCQ ;
Greg Kroah-Hartman
maintainerPATCH 38/74 ata: ahci_brcm: Fix AHCI resources management
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
commit c0cdf2ac4b5bf3e5ef2451ea29fb4104278cdabc upstream.
The AHCI resources management within ahci_brcm.c is a little convoluted, largely because it historically had a dedicated clock that was managed within this file in the downstream tree. Once brough upstream though, the clock was left to be managed by libahci_platform.c which is entirely appropriate.
This patch series ensures that the AHCI resources are fetched and enabled before any register access is done, thus avoiding bus errors on platforms which clock gate the controller by default.
As a result we need to re-arrange the suspend() and resume() functions in order to avoid accessing registers after the clocks have been turned off respectively before the clocks have been turned on. Finally, we can refactor brcm_ahci_get_portmask() in order to fetch the number of ports from hpriv->mmio which is now accessible without jumping through hoops like we used to do.
The commit pointed in the Fixes tag is both old and new enough not to require major headaches for backporting of this patch.
--- drivers/ata/ahci_brcm.c | 105 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 29 deletions(-)
drivers/ata/ahci_brcm.c +76 -29
@@ -223,19 +223,12 @@ static void brcm_sata_phys_disable(strucbrcm_sata_phy_disable (priv, i); } -static u32 brcm_ahci_get_portmask (struct platform_device *pdev, +static u32 brcm_ahci_get_portmask (struct ahci_host_priv *hpriv,struct brcm_ahci_priv *priv) { -void __iomem *ahci; -struct resource *res;u32 impl; - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ahci" ); - ahci =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (ahci)) -return 0 ; - - impl =readl (ahci +HOST_PORTS_IMPL ); + impl =readl (hpriv->mmio +HOST_PORTS_IMPL );if (fls (impl) >SATA_TOP_MAX_PHYS ) dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n",
@@ -243,9 +236,6 @@ static u32 brcm_ahci_get_portmask(structelse if (!impl)dev_info (priv->dev,"no ports found\n" ); -devm_iounmap (&pdev->dev, ahci); -devm_release_mem_region (&pdev->dev, res->start,resource_size (res)); -return impl; }
@@ -272,11 +262,10 @@ static int brcm_ahci_suspend(struct devistruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; -int ret; - ret =ahci_platform_suspend (dev);brcm_sata_phys_disable (priv); -return ret; + +return ahci_platform_suspend (dev); }static int brcm_ahci_resume (struct device *dev)
@@ -284,11 +273,44 @@ static int brcm_ahci_resume(struct devicstruct ata_host *host =dev_get_drvdata (dev);struct ahci_host_priv *hpriv = host->private_data;struct brcm_ahci_priv *priv = hpriv->plat_data; +int ret; + +/* Make sure clocks are turned on before re-configuration */ + ret =ahci_platform_enable_clks (hpriv); +if (ret) +return ret;brcm_sata_init (priv);brcm_sata_phys_enable (priv);brcm_sata_alpm_init (hpriv); - return ahci_platform_resume(dev); + +/* Since we had to enable clocks earlier on, we cannot use +* ahci_platform_resume() as-is since a second call to +* ahci_platform_enable_resources() would bump up the resources +* (regulators, clocks, PHYs) count artificially so we copy the part +* after ahci_platform_enable_resources(). +*/ + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + + ret =ahci_platform_resume_host (dev); +if (ret) + goto out_disable_platform_phys; + +/* We resumed so update PM runtime state */ +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + +return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +ahci_platform_disable_clks (hpriv); + return ret; }#endif
@@ -340,38 +362,63 @@ static int brcm_ahci_probe(struct platfo priv->quirks |=BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE ; } + hpriv =ahci_platform_get_resources (pdev); +if (IS_ERR (hpriv)) { + ret =PTR_ERR (hpriv); + goto out_reset; + } + + ret =ahci_platform_enable_clks (hpriv); +if (ret) + goto out_reset; + +/* Must be first so as to configure endianness including that +* of the standard AHCI register space. +*/ brcm_sata_init (priv); - priv->port_mask =brcm_ahci_get_portmask (pdev, priv); -if (!priv->port_mask) -return -ENODEV ; +/* Initializes priv->port_mask which is used below */ + priv->port_mask =brcm_ahci_get_portmask (hpriv, priv); +if (!priv->port_mask) { + ret = -ENODEV ; + goto out_disable_clks; + } +/* Must be done before ahci_platform_enable_phys() */ brcm_sata_phys_enable (priv); - hpriv =ahci_platform_get_resources (pdev); -if (IS_ERR (hpriv)) -return PTR_ERR (hpriv); hpriv->plat_data = priv; hpriv->flags =AHCI_HFLAG_WAKE_BEFORE_STOP ;brcm_sata_alpm_init (hpriv); - ret =ahci_platform_enable_resources (hpriv); -if (ret) -return ret; -if (priv->quirks &BRCM_AHCI_QUIRK_NO_NCQ ) hpriv->flags |=AHCI_HFLAG_NO_NCQ ; hpriv->flags |=AHCI_HFLAG_NO_WRITE_TO_RO ; + ret =ahci_platform_enable_phys (hpriv); +if (ret) + goto out_disable_phys; + ret =ahci_platform_init_host (pdev, hpriv, &ahci_brcm_port_info, &ahci_platform_sht);if (ret) -return ret; + goto out_disable_platform_phys;dev_info (dev,"Broadcom AHCI SATA3 registered\n" );return 0 ; + +out_disable_platform_phys: +ahci_platform_disable_phys (hpriv); +out_disable_phys: +brcm_sata_phys_disable (priv); +out_disable_clks: +ahci_platform_disable_clks (hpriv); +out_reset: +if (!IS_ERR_OR_NULL (priv->rcdev)) +reset_control_assert (priv->rcdev); +return ret; }static int brcm_ahci_remove (struct platform_device *pdev)
@@ -381,12 +428,12 @@ static int brcm_ahci_remove(struct platfstruct brcm_ahci_priv *priv = hpriv->plat_data;int ret; +brcm_sata_phys_disable (priv); + ret =ata_platform_remove_one (pdev);if (ret)return ret; -brcm_sata_phys_disable (priv); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 39/74 gpiolib: fix up emulated open drain outputs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
commit 256efaea1fdc4e38970489197409a26125ee0aaa upstream.
gpiolib has a corner case with open drain outputs that are emulated. When such outputs are outputting a logic 1, emulation will set the hardware to input mode, which will cause gpiod_get_direction() to report that it is in input mode. This is different from the behaviour with a true open-drain output.
Unify the semantics here.
--- drivers/gpio/gpiolib.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpiolib.c +8 -0
@@ -206,6 +206,14 @@ int gpiod_get_direction(struct gpio_desc chip =gpiod_to_chip (desc); offset =gpio_chip_hwgpio (desc); +/* +* Open drain emulation using input mode may incorrectly report +* input here, fix that up. +*/ +if (test_bit (FLAG_OPEN_DRAIN , &desc->flags) && +test_bit (FLAG_IS_OUT , &desc->flags)) +return 0 ; +if (!chip->get_direction)return status;
Greg Kroah-Hartman
maintainerPATCH 40/74 tracing: Fix lock inversion in trace_event_enable_tgid_record()
In reply to Greg Kroah-HartmanFrom: Prateek Sood <[email protected]>
commit 3a53acf1d9bea11b57c1f6205e3fe73f9d8a3688 upstream.
Task T2 Task T3trace_options_core_write() subsystem_open()
mutex_lock(trace_types_lock) mutex_lock(event_mutex)
set_tracer_flag()
trace_event_enable_tgid_record() mutex_lock(trace_types_lock)
mutex_lock(event_mutex)
This gives a circular dependency deadlock between trace_types_lock and event_mutex. To fix this invert the usage of trace_types_lock and event_mutex in trace_options_core_write(). This keeps the sequence of lock usage consistent.
--- kernel/trace/trace.c | 8 ++++++++ kernel/trace/trace_events.c | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
kernel/trace/trace.c +8 -0
@@ -4368,6 +4368,10 @@ int trace_keep_overwrite(struct tracer *int set_tracer_flag (struct trace_array *tr,unsigned int mask,int enabled) { +if ((mask ==TRACE_ITER_RECORD_TGID ) || + (mask ==TRACE_ITER_RECORD_CMD )) +lockdep_assert_held (&event_mutex); +/* do nothing if flag is already set */ if (!!(tr->trace_flags & mask) == !!enabled)return 0 ;
@@ -4433,6 +4437,7 @@ static int trace_set_options(struct trac cmp +=2 ; } +mutex_lock (&event_mutex);mutex_lock (&trace_types_lock);for (i =0 ; trace_options[i]; i++) {
@@ -4447,6 +4452,7 @@ static int trace_set_options(struct trac ret =set_tracer_option (tr, cmp, neg);mutex_unlock (&trace_types_lock); +mutex_unlock (&event_mutex);/* * If the first trailing whitespace is replaced with '\0' by strstrip,
@@ -7373,9 +7379,11 @@ trace_options_core_write(struct file *fiif (val !=0 && val !=1 )return -EINVAL ; +mutex_lock (&event_mutex);mutex_lock (&trace_types_lock); ret =set_tracer_flag (tr,1 << index, val);mutex_unlock (&trace_types_lock); +mutex_unlock (&event_mutex);if (ret <0 )return ret;
kernel/trace/trace_events.c +4 -4
@@ -326,7 +326,8 @@ void trace_event_enable_cmd_record(boolstruct trace_event_file *file;struct trace_array *tr; -mutex_lock (&event_mutex); +lockdep_assert_held (&event_mutex); +do_for_each_event_file (tr, file) {if (!(file->flags &EVENT_FILE_FL_ENABLED ))
@@ -340,7 +341,6 @@ void trace_event_enable_cmd_record(boolclear_bit (EVENT_FILE_FL_RECORDED_CMD_BIT , &file->flags); } }while_for_each_event_file (); -mutex_unlock (&event_mutex); }void trace_event_enable_tgid_record (bool enable)
@@ -348,7 +348,8 @@ void trace_event_enable_tgid_record(boolstruct trace_event_file *file;struct trace_array *tr; -mutex_lock (&event_mutex); +lockdep_assert_held (&event_mutex); +do_for_each_event_file (tr, file) {if (!(file->flags &EVENT_FILE_FL_ENABLED ))continue ;
@@ -362,7 +363,6 @@ void trace_event_enable_tgid_record(bool &file->flags); } }while_for_each_event_file (); -mutex_unlock (&event_mutex); } static int __ftrace_event_enable_disable(struct trace_event_file *file,
Greg Kroah-Hartman
maintainerPATCH 41/74 tracing: Have the histogram compare functions convert to u64 first
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 106f41f5a302cb1f36c7543fae6a05de12e96fa4 upstream.
The compare functions of the histogram code would be specific for the size of the value being compared (byte, short, int, long long). It would reference the value from the array via the type of the compare, but the value was stored in a 64 bit number. This is fine for little endian machines, but for big endian machines, it would end up comparing zeros or all ones (depending on the sign) for anything but 64 bit numbers.
To fix this, first derference the value as a u64 then convert it to the type being compared.
--- kernel/trace/tracing_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/tracing_map.c +2 -2
@@ -90,8 +90,8 @@ static int tracing_map_cmp_atomic64(void#define DEFINE_TRACING_MAP_CMP_FN (type) \ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ { \ - type a = *(type *)val_a; \ - type b = *(type *)val_b; \ + type a = (type)(*(u64 *)val_a); \ + type b = (type)(*(u64 *)val_b); \ \ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ }
Greg Kroah-Hartman
maintainerPATCH 42/74 ALSA: cs4236: fix error return comparison of an unsigned integer
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit d60229d84846a8399257006af9c5444599f64361 upstream.
The return from pnp_irq is an unsigned integer type resource_size_t and hence the error check for a positive non-error code is always going to be true. A check for a non-failure return from pnp_irq should in fact be for (resource_size_t)-1 rather than >= 0.
Addresses-Coverity: ("Unsigned compared against 0")
--- sound/isa/cs423x/cs4236.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/isa/cs423x/cs4236.c +2 -1
@@ -293,7 +293,8 @@ static int snd_cs423x_pnp_init_mpu(int d }else { mpu_port[dev] =pnp_port_start (pdev,0 );if (mpu_irq[dev] >=0 && -pnp_irq_valid (pdev,0 ) &&pnp_irq (pdev,0 ) >=0 ) { +pnp_irq_valid (pdev,0 ) && +pnp_irq (pdev,0 ) != (resource_size_t)-1 ) { mpu_irq[dev] =pnp_irq (pdev,0 ); }else { mpu_irq[dev] =-1 ;/* disable interrupt */
Greg Kroah-Hartman
maintainerPATCH 43/74 ALSA: firewire-motu: Correct a typo in the clock proc string
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 0929249e3be3bb82ee6cfec0025f4dde952210b3 upstream.
Just fix a typo of "S/PDIF" in the clock name string.
--- sound/firewire/motu/motu-proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/motu/motu-proc.c +1 -1
@@ -17,7 +17,7 @@ static const char *const clock_names[] = [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT] = "S/PDIF on optical interface", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A] = "S/PDIF on optical interface A", [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B] = "S/PDIF on optical interface B", - [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PCIF on coaxial interface", + [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", };
Greg Kroah-Hartman
maintainerPATCH 44/74 exit: panic before exit_mm() on global init exit
In reply to Greg Kroah-HartmanFrom: chenqiwu <[email protected]>
commit 43cf75d96409a20ef06b756877a2e72b10a026fc upstream.
Currently, when global init and all threads in its thread-group have exited we panic via:do_exit()
-> exit_notify()
-> forget_original_parent()
-> find_child_reaper()
This makes it hard to extract a useable coredump for global init from a kernel crashdump because by the time we panic exit_mm() will have already released global init's mm.
This patch moves the panic futher up before exit_mm() is called. As was the case previously, we only panic when global init and all its threads in the thread-group have exited.
--- kernel/exit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/exit.c +8 -4
@@ -577,10 +577,6 @@ static struct task_struct *find_child_re }write_unlock_irq (&tasklist_lock); -if (unlikely (pid_ns == &init_pid_ns)) { -panic ("Attempted to kill init! exitcode=0x%08x\n" , - father->signal->group_exit_code ?: father->exit_code); - }list_for_each_entry_safe (p, n, dead, ptrace_entry) {list_del_init (&p->ptrace_entry);
@@ -823,6 +819,14 @@ void __noreturn do_exit(long code)acct_update_integrals (tsk); group_dead =atomic_dec_and_test (&tsk->signal->live);if (group_dead) { +/* +* If the last thread of global init has exited, panic +* immediately to get a useable coredump. +*/ +if (unlikely (is_global_init (tsk))) +panic ("Attempted to kill init! exitcode=0x%08x\n" , + tsk->signal->group_exit_code ?: (int )code); +#ifdef CONFIG_POSIX_TIMERS hrtimer_cancel (&tsk->signal->real_timer);exit_itimers (tsk->signal);
Greg Kroah-Hartman
maintainerPATCH 45/74 ftrace: Avoid potential division by zero in function profiler
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit e31f7939c1c27faa5d0e3f14519eaf7c89e8a69d upstream.
The ftrace_profile->counter is unsigned long and do_div truncates it to 32 bits, which means it can test non-zero and be truncated to zero for division. Fix this issue by using div64_ul() instead.
--- kernel/trace/ftrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/ftrace.c +3 -3
@@ -622,8 +622,7 @@ static int function_stat_show(struct seq }#ifdef CONFIG_FUNCTION_GRAPH_TRACER - avg = rec->time; -do_div (avg, rec->counter); + avg =div64_ul (rec->time, rec->counter);if (tracing_thresh && (avg < tracing_thresh)) goto out;#endif
@@ -649,7 +648,8 @@ static int function_stat_show(struct seq* Divide only 1000 for ns^2 -> us^2 conversion. * trace_print_graph_duration will divide 1000 again. */ -do_div (stddev, rec->counter * (rec->counter -1 ) *1000 ); + stddev =div64_ul (stddev, + rec->counter * (rec->counter -1 ) *1000 ); }trace_seq_init (&s);
Greg Kroah-Hartman
maintainerPATCH 46/74 arm64: Revert support for execute-only user mappings
In reply to Greg Kroah-HartmanFrom: Catalin Marinas <[email protected]>
commit 24cecc37746393432d994c0dbc251fb9ac7c5d72 upstream.
The ARMv8 64-bit architecture supports execute-only user permissions by clearing the PTE_USER and PTE_UXN bits, practically making it a mostly privileged mapping but from which user running at EL0 can still execute.
The downside, however, is that the kernel at EL1 inadvertently reading such mapping would not trip over the PAN (privileged access never) protection.
Revert the relevant bits from commit cab15ce604e5 ("arm64: Introduce execute-only page access permissions") so that PROT_EXEC implies PROT_READ (and therefore PTE_USER) until the architecture gains proper support for execute-only user mappings.
--- arch/arm64/include/asm/pgtable-prot.h | 5 ++--- arch/arm64/include/asm/pgtable.h | 10 +++------- arch/arm64/mm/fault.c | 2 +- mm/mmap.c | 6 ------ 4 files changed, 6 insertions(+), 17 deletions(-)
arch/arm64/include/asm/pgtable-prot.h +2 -3
@@ -76,13 +76,12 @@#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE)#define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN)#define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) -#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN)#define __P000 PAGE_NONE#define __P001 PAGE_READONLY#define __P010 PAGE_READONLY#define __P011 PAGE_READONLY -#define __P100 PAGE_EXECONLY +#define __P100 PAGE_READONLY_EXEC#define __P101 PAGE_READONLY_EXEC#define __P110 PAGE_READONLY_EXEC#define __P111 PAGE_READONLY_EXEC
@@ -91,7 +90,7 @@#define __S001 PAGE_READONLY#define __S010 PAGE_SHARED#define __S011 PAGE_SHARED -#define __S100 PAGE_EXECONLY +#define __S100 PAGE_READONLY_EXEC#define __S101 PAGE_READONLY_EXEC#define __S110 PAGE_SHARED_EXEC#define __S111 PAGE_SHARED_EXEC
arch/arm64/include/asm/pgtable.h +3 -7
@@ -90,12 +90,8 @@ extern unsigned long empty_zero_page[PAG#define pte_dirty (pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte))#define pte_valid (pte) (!!(pte_val(pte) & PTE_VALID)) -/* -* Execute-only user mappings do not have the PTE_USER bit set. All valid -* kernel mappings have the PTE_UXN bit set. -*/ #define pte_valid_not_user (pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) + ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID)#define pte_valid_young (pte) \ ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))#define pte_valid_user (pte) \
@@ -111,8 +107,8 @@ extern unsigned long empty_zero_page[PAG/* * p??_access_permitted() is true for valid user mappings (subject to the -* write permission check) other than user execute-only which do not have the -* PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. +* write permission check). PROT_NONE mappings do not have the PTE_VALID bit +* set. */ #define pte_access_permitted (pte, write) \ (pte_valid_user(pte) && (!(write) || pte_write(pte)))
arch/arm64/mm/fault.c +1 -1
@@ -400,7 +400,7 @@ static int __kprobes do_page_fault(unsigstruct task_struct *tsk;struct mm_struct *mm;int fault, sig, code, major =0 ; -unsigned long vm_flags =VM_READ |VM_WRITE ; +unsigned long vm_flags =VM_READ |VM_WRITE |VM_EXEC ;unsigned int mm_flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;if (notify_page_fault (regs, esr))
mm/mmap.c +0 -6
@@ -89,12 +89,6 @@ static void unmap_region(struct mm_struc* MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes * w: (no) no w: (no) no w: (copy) copy w: (no) no * x: (no) no x: (no) yes x: (no) yes x: (yes) yes -* -* On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and -* MAP_PRIVATE: -* r: (no) no -* w: (no) no -* x: (yes) yes */ pgprot_t protection_map[16 ]__ro_after_init = { __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
Greg Kroah-Hartman
maintainerPATCH 47/74 PM / devfreq: Check NULL governor in available_governors_show
In reply to Greg Kroah-HartmanFrom: Leonard Crestez <[email protected]>
commit d68adc8f85cd757bd33c8d7b2660ad6f16f7f3dc upstream.
The governor is initialized after sysfs attributes become visible so in theory the governor field can be NULL here.
--- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/devfreq/devfreq.c +1 -1
@@ -974,7 +974,7 @@ static ssize_t available_governors_show(* The devfreq with immutable governor (e.g., passive) shows * only own governor. */ -if (df->governor->immutable) { +if (df->governor && df->governor->immutable) { count =scnprintf (&buf[count],DEVFREQ_NAME_LEN ,"%s " , df->governor_name);/*
Greg Kroah-Hartman
maintainerPATCH 48/74 nfsd4: fix up replay_matches_cache()
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
commit 6e73e92b155c868ff7fce9d108839668caf1d9be upstream.
When running an nfs stress test, I see quite a few cached replies that don't match up with the actual request. The first comment in replay_matches_cache() makes sense, but the code doesn't seem to match... fix it.
This isn't exactly a bugfix, as the server isn't required to catch every case of a false retry. So, we may as well do this, but if this is fixing a problem then that suggests there's a client bug.
--- fs/nfsd/nfs4state.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/nfsd/nfs4state.c +10 -5
@@ -3058,12 +3058,17 @@ static bool replay_matches_cache(struct (bool)seq->cachethis)return false;/* -* If there's an error than the reply can have fewer ops than -* the call. But if we cached a reply with *more* ops than the -* call you're sending us now, then this new call is clearly not -* really a replay of the old one: +* If there's an error then the reply can have fewer ops than +* the call. */ -if (slot->sl_opcnt < argp->opcnt) +if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) +return false; +/* +* But if we cached a reply with *more* ops than the call you're +* sending us now, then this new call is clearly not really a +* replay of the old one: +*/ +if (slot->sl_opcnt > argp->opcnt)return false;/* This is the only check explicitly called by spec: */ if (!same_creds (&rqstp->rq_cred, &slot->sl_cred))
Greg Kroah-Hartman
maintainerPATCH 49/74 scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
commit 600954e6f2df695434887dfc6a99a098859990cf upstream.
del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list.
--- drivers/scsi/qla2xxx/qla_target.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +0 -1
@@ -1210,7 +1210,6 @@ void qlt_schedule_sess_for_deletion(stru"Scheduling sess %p for deletion %8phC\n" , sess, sess->port_name); -INIT_WORK (&sess->del_work, qla24xx_delete_sess_fn);queue_work (sess->vha->hw->wq, &sess->del_work); }
Greg Kroah-Hartman
maintainerPATCH 50/74 xfs: dont check for AG deadlock for realtime files in bunmapi
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
commit 69ffe5960df16938bccfe1b65382af0b3de51265 upstream.
Commit 5b094d6dac04 ("xfs: fix multi-AG deadlock in xfs_bunmapi") added a check in __xfs_bunmapi() to stop early if we would touch multiple AGs in the wrong order. However, this check isn't applicable for realtime files. In most cases, it just makes us do unnecessary commits. However, without the fix from the previous commit ("xfs: fix realtime file data space leak"), if the last and second-to-last extents also happen to have different "AG numbers", then the break actually causes __xfs_bunmapi() to return without making any progress, which sends xfs_itruncate_extents_flags() into an infinite loop.
--- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
@@ -5556,7 +5556,7 @@ __xfs_bunmapi(* Make sure we don't touch multiple AGF headers out of order * in a single transaction, as that could cause AB-BA deadlocks. */ -if (!wasdel) { +if (!wasdel && !isrt) { agno =XFS_FSB_TO_AGNO (mp, del.br_startblock);if (prev_agno !=NULLAGNUMBER && prev_agno > agno)break ;
Greg Kroah-Hartman
maintainerPATCH 51/74 platform/x86: pmc_atom: Add Siemens CONNECT X300 to critclk_systems DMI table
In reply to Greg Kroah-HartmanFrom: Michael Haener <[email protected]>
commit e8796c6c69d129420ee94a1906b18d86b84644d4 upstream.
The CONNECT X300 uses the PMC clock for on-board components and gets stuck during boot if the clock is disabled. Therefore, add this device to the critical systems list.
Tested on CONNECT X300.
--- drivers/platform/x86/pmc_atom.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/platform/x86/pmc_atom.c +8 -0
@@ -482,6 +482,14 @@ static const struct dmi_system_id critcl DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"), }, }, + { + .ident = "CONNECT X300", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"), + DMI_MATCH(DMI_PRODUCT_VERSION, "A5E45074588"), + }, + }, + {/*sentinel*/ } };
Greg Kroah-Hartman
maintainerPATCH 52/74 Bluetooth: btusb: fix PM leak in error case of setup
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
commit 3d44a6fd0775e6215e836423e27f8eedf8c871ea upstream.
If setup() fails a reference for runtime PM has already been taken. Proper use of the error handling in btusb_open()is needed. You cannot just return.
--- drivers/bluetooth/btusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +2 -1
@@ -1123,7 +1123,7 @@ static int btusb_open(struct hci_dev *hdif (data->setup_on_usb) { err = data->setup_on_usb (hdev);if (err <0 ) -return err; + goto setup_fail; } data->intf->needs_remote_wakeup =1 ;
@@ -1155,6 +1155,7 @@ done: failed:clear_bit (BTUSB_INTR_RUNNING , &data->flags); +setup_fail:usb_autopm_put_interface (data->intf);return err; }
Greg Kroah-Hartman
maintainerPATCH 53/74 Bluetooth: delete a stray unlock
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit df66499a1fab340c167250a5743931dc50d5f0fa upstream.
We used to take a lock in amp_physical_cfm() but then we moved it to the caller function. Unfortunately the unlock on this error path was overlooked so it leads to a double unlock.
--- net/bluetooth/l2cap_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/bluetooth/l2cap_core.c +1 -3
@@ -4918,10 +4918,8 @@ void __l2cap_physical_cfm(struct l2cap_cBT_DBG ("chan %p, result %d, local_amp_id %d, remote_amp_id %d" , chan, result, local_amp_id, remote_amp_id); -if (chan->state ==BT_DISCONN || chan->state ==BT_CLOSED ) { -l2cap_chan_unlock (chan); +if (chan->state ==BT_DISCONN || chan->state ==BT_CLOSED )return ; - }if (chan->state !=BT_CONNECTED ) {l2cap_do_create (chan, result, local_amp_id, remote_amp_id);
Greg Kroah-Hartman
maintainerPATCH 54/74 Bluetooth: Fix memory leak in hci_connect_le_scan
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit d088337c38a5cd8f0230fbf2d514ff7672f9d0d3 upstream.
In the implementation of hci_connect_le_scan() when conn is added via hci_conn_add(), if hci_explicit_conn_params_set() fails the allocated memory for conn is leaked. Use hci_conn_del() to release it.
--- net/bluetooth/hci_conn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/hci_conn.c +3 -1
@@ -1054,8 +1054,10 @@ struct hci_conn *hci_connect_le_scan(strif (!conn)return ERR_PTR (-ENOMEM ); -if (hci_explicit_conn_params_set (hdev, dst, dst_type) <0 ) +if (hci_explicit_conn_params_set (hdev, dst, dst_type) <0 ) { +hci_conn_del (conn);return ERR_PTR (-EBUSY ); + } conn->state =BT_CONNECT ;set_bit (HCI_CONN_SCANNING , &conn->flags);
Greg Kroah-Hartman
maintainerPATCH 55/74 media: flexcop-usb: ensure -EIO is returned on error condition
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit 74a96b51a36de4d86660fbc56b05d86668162d6b upstream.
An earlier commit hard coded a return 0 to function flexcop_usb_i2c_req even though the an -EIO was intended to be returned in the case where ret != buflen. Fix this by replacing the return 0 with the return of ret to return the error return code.
Addresses-Coverity: ("Unused value")
--- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/b2c2/flexcop-usb.c +1 -1
@@ -294,7 +294,7 @@ static int flexcop_usb_i2c_req(struct flmutex_unlock (&fc_usb->data_mutex); -return 0 ; +return ret; }/* actual bus specific access functions,
Greg Kroah-Hartman
maintainerPATCH 56/74 regulator: ab8500: Remove AB8505 USB regulator
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
commit 99c4f70df3a6446c56ca817c2d0f9c12d85d4e7c upstream.
The USB regulator was removed for AB8500 in
commit 41a06aa738ad ("regulator: ab8500: Remove USB regulator"). It was then added for AB8505 in
commit 547f384f33db ("regulator: ab8500: add support for ab8505").
However, there was never an entry added for it in ab8505_regulator_match. This causes all regulators after it to be initialized with the wrong device tree data, eventually leading to an out-of-bounds array read.
Given that it is not used anywhere in the kernel, it seems likely that similar arguments against supporting it exist for AB8505 (it is controlled by hardware).
Therefore, simply remove it like for AB8500 instead of adding an entry in ab8505_regulator_match.
--- drivers/regulator/ab8500.c | 17 ----------------- include/linux/regulator/ab8500.h | 1 - 2 files changed, 18 deletions(-)
drivers/regulator/ab8500.c +0 -17
@@ -1099,23 +1099,6 @@ static struct ab8500_regulator_info .update_val_idle = 0x82, .update_val_normal = 0x02, }, - [AB8505_LDO_USB] = { - .desc = { - .name = "LDO-USB", - .ops = &ab8500_regulator_mode_ops, - .type = REGULATOR_VOLTAGE, - .id = AB8505_LDO_USB, - .owner = THIS_MODULE, - .n_voltages = 1, - .volt_table = fixed_3300000_voltage, - }, - .update_bank = 0x03, - .update_reg = 0x82, - .update_mask = 0x03, - .update_val = 0x01, - .update_val_idle = 0x03, - .update_val_normal = 0x01, - }, [AB8505_LDO_AUDIO] = { .desc = { .name = "LDO-AUDIO",
include/linux/regulator/ab8500.h +0 -1
@@ -38,7 +38,6 @@ enum ab8505_regulator_id {AB8505_LDO_AUX6 ,AB8505_LDO_INTCORE ,AB8505_LDO_ADC , -AB8505_LDO_USB ,AB8505_LDO_AUDIO ,AB8505_LDO_ANAMIC1 , AB8505_LDO_ANAMIC2,
Greg Kroah-Hartman
maintainerPATCH 57/74 media: usb: fix memory leak in af9005_identify_state
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 2289adbfa559050d2a38bcd9caac1c18b800e928 upstream.
In af9005_identify_state when returning -EIO the allocated buffer should be released. Replace the "return -EIO" with assignment into ret and move deb_info() under a check.
--- drivers/media/usb/dvb-usb/af9005.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/af9005.c +3 -2
@@ -985,8 +985,9 @@ static int af9005_identify_state(structelse if (reply ==0x02 ) *cold =0 ;else -return -EIO ; -deb_info ("Identify state cold = %d\n" , *cold); + ret = -EIO ; +if (!ret) +deb_info ("Identify state cold = %d\n" , *cold); err:kfree (buf);
Greg Kroah-Hartman
maintainerPATCH 58/74 dt-bindings: clock: renesas: rcar-usb2-clock-sel: Fix typo in example
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
commit 830dbce7c76ea529decac7d23b808c1e7da3d891 upstream.
The documented compatible value for R-Car H3 is
"renesas,r8a7795-rcar-usb2-clock-sel", not
"renesas,r8a77950-rcar-usb2-clock-sel".
--- Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt +1 -1
@@ -46,7 +46,7 @@ Required properties: Example (R-Car H3): usb2_clksel: clock-controller@e6590630 { - compatible = "renesas,r8a77950-rcar-usb2-clock-sel", + compatible = "renesas,r8a7795-rcar-usb2-clock-sel", "renesas,rcar-gen3-usb2-clock-sel"; reg = <0 0xe6590630 0 0x02>; clocks = <&cpg CPG_MOD 703>, <&usb_extal>, <&usb_xtal>;
Greg Kroah-Hartman
maintainerPATCH 59/74 tty: serial: msm_serial: Fix lockup for sysrq and oops
In reply to Greg Kroah-HartmanFrom: Leo Yan <[email protected]>
commit 0e4f7f920a5c6bfe5e851e989f27b35a0cc7fb7e upstream.
As the commit 677fe555cbfb ("serial: imx: Fix recursive locking bug") has mentioned the uart driver might cause recursive locking between normal printing and the kernel debugging facilities (e.g. sysrq and oops). In the commit it gave out suggestion for fixing recursive locking issue: "The solution is to avoid locking in the sysrq case and trylock in the oops_in_progress case."
This patch follows the suggestion (also used the exactly same code with other serial drivers, e.g. amba-pl011.c) to fix the recursive locking issue, this can avoid stuck caused by deadlock and print out log for sysrq and oops.
--- drivers/tty/serial/msm_serial.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/tty/serial/msm_serial.c +11 -2
@@ -1588,6 +1588,7 @@ static void __msm_console_write(struct uint num_newlines =0 ;bool replaced = false;void __iomem *tf; +int locked =1 ;if (is_uartdm) tf = port->membase +UARTDM_TF ;
@@ -1600,7 +1601,13 @@ static void __msm_console_write(struct u num_newlines++; count += num_newlines; -spin_lock (&port->lock); +if (port->sysrq) + locked =0 ; +else if (oops_in_progress) + locked =spin_trylock (&port->lock); +else +spin_lock (&port->lock); +if (is_uartdm)msm_reset_dm_count (port, count);
@@ -1636,7 +1643,9 @@ static void __msm_console_write(struct uiowrite32_rep (tf, buf,1 ); i += num_chars; } -spin_unlock (&port->lock); + +if (locked) +spin_unlock (&port->lock); } static void msm_console_write(struct console *co, const char *s,
Greg Kroah-Hartman
maintainerPATCH 60/74 fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 6b2daec19094a90435abe67d16fb43b1a5527254 upstream.
Unlike FICLONE, all of those take a pointer argument; they do need compat_ptr() applied to arg.
--- fs/compat_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/compat_ioctl.c +2 -1
@@ -1577,9 +1577,10 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned i#endif case FICLONE : + goto do_ioctl;case FICLONERANGE :case FIDEDUPERANGE : - goto do_ioctl; + goto found_handler;case FIBMAP :case FIGETBSZ :
Greg Kroah-Hartman
maintainerPATCH 61/74 scsi: qedf: Do not retry ELS request if qedf_alloc_cmd fails
In reply to Greg Kroah-HartmanFrom: Chad Dupuis <[email protected]>
[ Upstream commit f1c43590365bac054d753d808dbbd207d09e088d ]
If we cannot allocate an ELS middlepath request, simply fail instead of trying to delay and then reallocate. This delay logic is causing soft lockup messages:
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:1:7639]
Modules linked in: xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 tun devlink ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter dm_service_time vfat fat rpcrdma sunrpc ib_isert iscsi_target_mod ib_iser libiscsi scsi_transport_iscsi ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm sb_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd iTCO_wdt iTCO_vendor_support qedr(OE) ib_core joydev ipmi_ssif pcspkr hpilo hpwdt sg ipmi_si ipmi_devintf ipmi_msghandler ioatdma shpchp lpc_ich wmi dca acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic qedf(OE) libfcoe mgag200 libfc i2c_algo_bit drm_kms_helper scsi_transport_fc qede(OE) syscopyarea sysfillrect sysimgblt fb_sys_fops ttm qed(OE) drm crct10dif_pclmul e1000e crct10dif_common crc32c_intel scsi_tgt hpsa i2c_core ptp scsi_transport_sas pps_core dm_mirror dm_region_hash dm_log dm_mod CPU: 2 PID: 7639 Comm: kworker/2:1 Kdump: loaded Tainted: G OEL ------------ 3.10.0-861.el7.x86_64 #1 Hardware name: HP ProLiant DL580 Gen9/ProLiant DL580 Gen9, BIOS U17 07/21/2016 Workqueue: qedf_2_dpc qedf_handle_rrq [qedf] task: ffff959edd628fd0 ti: ffff959ed6f08000 task.ti: ffff959ed6f08000 RIP: 0010:[<ffffffff8355913a>] [<ffffffff8355913a>] delay_tsc+0x3a/0x60 RSP: 0018:ffff959ed6f0bd30 EFLAGS: 00000246 RAX: 000000008ef5f791 RBX: 5f646d635f666465 RCX: 0000025b8ededa2f RDX: 000000000000025b RSI: 0000000000000002 RDI: 0000000000217d1e RBP: ffff959ed6f0bd30 R08: ffffffffc079aae8 R09: 0000000000000200 R10: ffffffffc07952c6 R11: 0000000000000000 R12: 6c6c615f66646571 R13: ffff959ed6f0bcc8 R14: ffff959ed6f0bd08 R15: ffff959e00000028 FS: 0000000000000000(0000) GS:ffff959eff480000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4117fa1eb0 CR3: 0000002039e66000 CR4: 00000000003607e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: [<ffffffff8355907d>] __const_udelay+0x2d/0x30 [<ffffffffc079444a>] qedf_initiate_els+0x13a/0x450 [qedf] [<ffffffffc0794210>] ? qedf_srr_compl+0x2a0/0x2a0 [qedf] [<ffffffffc0795337>] qedf_send_rrq+0x127/0x230 [qedf] [<ffffffffc078ed55>] qedf_handle_rrq+0x15/0x20 [qedf] [<ffffffff832b2dff>] process_one_work+0x17f/0x440 [<ffffffff832b3ac6>] worker_thread+0x126/0x3c0 [<ffffffff832b39a0>] ? manage_workers.isra.24+0x2a0/0x2a0 [<ffffffff832bae31>] kthread+0xd1/0xe0 [<ffffffff832bad60>] ? insert_kthread_work+0x40/0x40 [<ffffffff8391f637>] ret_from_fork_nospec_begin+0x21/0x21 [<ffffffff832bad60>] ? insert_kthread_work+0x40/0x40
--- drivers/scsi/qedf/qedf_els.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/scsi/qedf/qedf_els.c +4 -12
@@ -23,8 +23,6 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op,int rc =0 ;uint32_t did, sid;uint16_t xid; -uint32_t start_time = jiffies /HZ ; -uint32_t current_time;struct fcoe_wqe *sqe;unsigned long flags;u16 sqe_idx;
@@ -50,18 +48,12 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, goto els_err; } -retry_els: els_req =qedf_alloc_cmd (fcport,QEDF_ELS );if (!els_req) { - current_time = jiffies /HZ ; -if ((current_time - start_time) >10 ) { -QEDF_INFO (&(qedf->dbg_ctx),QEDF_LOG_ELS , -"els: Failed els 0x%x\n" , op); - rc = -ENOMEM ; - goto els_err; - } -mdelay (20 *USEC_PER_MSEC ); - goto retry_els; +QEDF_INFO (&qedf->dbg_ctx,QEDF_LOG_ELS , +"Failed to alloc ELS request 0x%x\n" , op); + rc = -ENOMEM ; + goto els_err; } QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = "
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/74 drm/mst: Fix MST sideband up-reply failure handling
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
[ Upstream commit d8fd3722207f154b53c80eee2cf4977c3fc25a92 ]
Fix the breakage resulting in the stacktrace below, due to tx queue being full when trying to send an up-reply. txmsg->seqno is -1 in this case leading to a corruption of the mstb object by
txmsg->dst->tx_slots[txmsg->seqno] = NULL;
in process_single_up_tx_qlock().
[ +0,005162] [drm:process_single_tx_qlock [drm_kms_helper]] set_hdr_from_dst_qlock: failed to find slot [ +0,000015] [drm:drm_dp_send_up_ack_reply.constprop.19 [drm_kms_helper]] failed to send msg in q -11 [ +0,000939] BUG: kernel NULL pointer dereference, address: 00000000000005a0 [ +0,006982] #PF: supervisor write access in kernel mode [ +0,005223] #PF: error_code(0x0002) - not-present page [ +0,005135] PGD 0 P4D 0 [ +0,002581] Oops: 0002 [#1] PREEMPT SMP NOPTI [ +0,004359] CPU: 1 PID: 1200 Comm: kworker/u16:3 Tainted: G U 5.2.0-rc1+ #410 [ +0,008433] Hardware name: Intel Corporation Ice Lake Client Platform/IceLake U DDR4 SODIMM PD RVP, BIOS ICLSFWR1.R00.3175.A00.1904261428 04/26/2019 [ +0,013323] Workqueue: i915-dp i915_digport_work_func [i915] [ +0,005676] RIP: 0010:queue_work_on+0x19/0x70 [ +0,004372] Code: ff ff ff 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 41 56 49 89 f6 41 55 41 89 fd 41 54 55 53 48 89 d3 9c 5d fa e8 e7 81 0c 00 <f0> 48 0f ba 2b 00 73 31 45 31 e4 f7 c5 00 02 00 00 74 13 e8 cf 7f [ +0,018750] RSP: 0018:ffffc900007dfc50 EFLAGS: 00010006 [ +0,005222] RAX: 0000000000000046 RBX: 00000000000005a0 RCX: 0000000000000001 [ +0,007133] RDX: 000000000001b608 RSI: 0000000000000000 RDI: ffffffff82121972 [ +0,007129] RBP: 0000000000000202 R08: 0000000000000000 R09: 0000000000000001 [ +0,007129] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88847bfa5096 [ +0,007131] R13: 0000000000000010 R14: ffff88849c08f3f8 R15: 0000000000000000 [ +0,007128] FS: 0000000000000000(0000) GS:ffff88849dc80000(0000) knlGS:0000000000000000 [ +0,008083] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0,005749] CR2: 00000000000005a0 CR3: 0000000005210006 CR4: 0000000000760ee0 [ +0,007128] PKRU: 55555554 [ +0,002722] Call Trace: [ +0,002458] drm_dp_mst_handle_up_req+0x517/0x540 [drm_kms_helper] [ +0,006197] ? drm_dp_mst_hpd_irq+0x5b/0x9c0 [drm_kms_helper] [ +0,005764] drm_dp_mst_hpd_irq+0x5b/0x9c0 [drm_kms_helper] [ +0,005623] ? intel_dp_hpd_pulse+0x205/0x370 [i915] [ +0,005018] intel_dp_hpd_pulse+0x205/0x370 [i915] [ +0,004836] i915_digport_work_func+0xbb/0x140 [i915] [ +0,005108] process_one_work+0x245/0x610 [ +0,004027] worker_thread+0x37/0x380 [ +0,003684] ? process_one_work+0x610/0x610 [ +0,004184] kthread+0x119/0x130 [ +0,003240] ? kthread_park+0x80/0x80 [ +0,003668] ret_from_fork+0x24/0x50
--- drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +5 -1
@@ -1540,7 +1540,11 @@ static void process_single_up_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,if (ret !=1 )DRM_DEBUG_KMS ("failed to send msg in q %d\n" , ret); - txmsg->dst->tx_slots[txmsg->seqno] =NULL ; +if (txmsg->seqno !=-1 ) { +WARN_ON ((unsigned int )txmsg->seqno > +ARRAY_SIZE (txmsg->dst->tx_slots)); + txmsg->dst->tx_slots[txmsg->seqno] =NULL ; + } } static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/74 powerpc/pseries/hvconsole: Fix stack overread via udbg
In reply to Greg Kroah-HartmanFrom: Daniel Axtens <[email protected]>
[ Upstream commit 934bda59f286d0221f1a3ebab7f5156a996cc37d ]
While developing KASAN for 64-bit book3s, I hit the following stack over-read.
It occurs because the hypercall to put characters onto the terminal takes 2 longs (128 bits/16 bytes) of characters at a time, and so hvc_put_chars() would unconditionally copy 16 bytes from the argument buffer, regardless of supplied length. However, udbg_hvc_putc() can call hvc_put_chars() with a single-byte buffer, leading to the error.
==================================================================
BUG: KASAN: stack-out-of-bounds in hvc_put_chars+0xdc/0x110
Read of size 8 at addr c0000000023e7a90 by task swapper/0
CPU: 0 PID: 0 Comm: swapper Not tainted 5.2.0-rc2-next-20190528-02824-g048a6ab4835b #113
Call Trace:
dump_stack+0x104/0x154 (unreliable)
print_address_description+0xa0/0x30c
__kasan_report+0x20c/0x224
kasan_report+0x18/0x30
__asan_report_load8_noabort+0x24/0x40
hvc_put_chars+0xdc/0x110
hvterm_raw_put_chars+0x9c/0x110
udbg_hvc_putc+0x154/0x200
udbg_write+0xf0/0x240
console_unlock+0x868/0xd30
register_console+0x970/0xe90
register_early_udbg_console+0xf8/0x114
setup_arch+0x108/0x790
start_kernel+0x104/0x784
start_here_common+0x1c/0x534
Memory state around the buggy address:
c0000000023e7980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0000000023e7a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
>c0000000023e7a80: f1 f1 01 f2 f2 f2 00 00 00 00 00 00 00 00 00 00
^
c0000000023e7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0000000023e7b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================Document that a 16-byte buffer is requred, and provide it in udbg.
--- arch/powerpc/platforms/pseries/hvconsole.c | 2 +- drivers/tty/hvc/hvc_vio.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/hvconsole.c +1 -1
@@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars);* @vtermno: The vtermno or unit_address of the adapter from which the data * originated. * @buf: The character buffer that contains the character data to send to -* firmware. +* firmware. Must be at least 16 bytes, even if count is less than 16. * @count: Send this number of characters. */ int hvc_put_chars (uint32_t vtermno,const char *buf,int count)
drivers/tty/hvc/hvc_vio.c +15 -1
@@ -120,6 +120,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count)return got; } +/** +* hvterm_raw_put_chars: send characters to firmware for given vterm adapter +* @vtermno: The virtual terminal number. +* @buf: The characters to send. Because of the underlying hypercall in +* hvc_put_chars(), this buffer must be at least 16 bytes long, even if +* you are sending fewer chars. +* @count: number of chars to send. +*/ static int hvterm_raw_put_chars (uint32_t vtermno,const char *buf,int count) {struct hvterm_priv *pv = hvterm_privs[vtermno];
@@ -232,6 +240,7 @@ static const struct hv_ops hvterm_hvsi_ops = {static void udbg_hvc_putc (char c) {int count =-1 ; +unsigned char bounce_buffer[16 ];if (!hvterm_privs[0 ])return ;
@@ -242,7 +251,12 @@ static void udbg_hvc_putc(char c) do { switch(hvterm_privs[0]->proto) { case HV_PROTOCOL_RAW: - count = hvterm_raw_put_chars(0, &c, 1); + /* + * hvterm_raw_put_chars requires at least a 16-byte + * buffer, so go via the bounce buffer + */ + bounce_buffer[0] = c; + count = hvterm_raw_put_chars(0, bounce_buffer, 1); break; case HV_PROTOCOL_HVSI: count = hvterm_hvsi_put_chars(0, &c, 1);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/74 selftests: rtnetlink: add addresses with fixed life time
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 3cfa148826e3c666da1cc2a43fbe8689e2650636 ]
This exercises kernel code path that deal with addresses that have a limited lifetime.
Without previous fix, this triggers following crash on net-next:
BUG: KASAN: null-ptr-deref in check_lifetime+0x403/0x670 Read of size 8 at addr 0000000000000010 by task kworker [..]
--- tools/testing/selftests/net/rtnetlink.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tools/testing/selftests/net/rtnetlink.sh +21 -0
@@ -195,6 +195,26 @@ kci_test_route_get() echo "PASS: route get" } +kci_test_addrlft() +{ + for i in $(seq 10 100) ;do + lft=$(((RANDOM%3) + 1)) + ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1)) + check_err $? + done + + sleep 5 + + ip addr show dev "$devdummy" | grep "10.23.11." + if [ $? -eq 0 ]; then + echo "FAIL: preferred_lft addresses remaining" + check_err 1 + return + fi + + echo "PASS: preferred_lft addresses have expired" +} + kci_test_addrlabel() { ret=0
@@ -245,6 +265,7 @@ kci_test_rtnl() kci_test_polrouting kci_test_route_get + kci_test_addrlft kci_test_tc kci_test_gre kci_test_bridge
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/74 coresight: tmc-etf: Do not call smp_processor_id from preemptible
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit 024c1fd9dbcc1d8a847f1311f999d35783921b7f ]
During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below :
BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc
Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs.
--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-tmc-etf.c +1 -3
@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,int node;struct cs_buffers *buf; -if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu);/* Allocate memory structure for interaction with Perf */ buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node);
Signature · 1 line
2.20.1
Re: [PATCH 4.14 65/74] coresight: tmc-etf: Do not call smp_processor_id from preemptible
Quoted 50 lines · Greg Kroah-Hartman
From: Suzuki K Poulose <[email protected]>
[ Upstream commit
024c1fd9dbcc1d8a847f1311f999d35783921b7f]During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using
smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below :BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xcUse
NUMA_NO_NODEhint instead of using the current node for events not bound to CPUs.Fixes 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API")Cc Mathieu Poirier <[email protected]>Signed-off-by Suzuki K Poulose <[email protected]>Cc stable <[email protected]> # 4.7+Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tmc-etf.c +0
-0
drivers/hwtracing/coresight/coresight-tmc-etf.c static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu, · line 311
Quoted 7 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c +1
-3@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,int node;struct cs_buffers *buf; -if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu);
This breaks the build on 4.14 (and I believe 4.19 from the looks of it) because the event variable is not available without
commit a0f08a6a9fee ("coresight: Communicate perf event to sink buffer allocation functions") from upstream. I am not sure how this should be fixed (either backporting the above commit or changing this one somehow) but it should be dropped in the meantime.
Cheers,
Nathan
Re: [PATCH 4.14 65/74] coresight: tmc-etf: Do not call smp_processor_id from preemptible
Hi Nathan,
Quoted 5 lines · Nathan Chancellor
Quoted 4 lines · Greg Kroah-Hartman
From: Suzuki K Poulose <[email protected]>
[ Upstream commit
024c1fd9dbcc1d8a847f1311f999d35783921b7f]
...
Quoted 8 lines
Quoted 8 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c +0
-0@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,int node;struct cs_buffers *buf;
Quoted 11 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu, · line 311
Quoted 4 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c +1
-3-if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu);This breaks the build on 4.14 (and I believe 4.19 from the looks of it) because the event variable is not available without
commita0f08a6a9fee("coresight: Communicate perf event to sink buffer allocation functions") from upstream. I am not sure how this should be fixed (either backporting the above commit or changing this one somehow) but it should be dropped in the meantime.
Thanks for the report. I will send a separate fix for the version where it breaks. We should be able to use the "cpu" argument directly in these cases, where event was not introduced.
Cheers
Suzuki
Greg Kroah-Hartman
maintainerRe: [PATCH 4.14 65/74] coresight: tmc-etf: Do not call smp_processor_id from preemptible
In reply to Nathan ChancellorQuoted 54 lines · Nathan Chancellor
Quoted 53 lines · Greg Kroah-Hartman
From: Suzuki K Poulose <[email protected]>
[ Upstream commit
024c1fd9dbcc1d8a847f1311f999d35783921b7f]During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using
smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below :BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xcUse
NUMA_NO_NODEhint instead of using the current node for events not bound to CPUs.Fixes 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API")Cc Mathieu Poirier <[email protected]>Signed-off-by Suzuki K Poulose <[email protected]>Cc stable <[email protected]> # 4.7+Signed-off-by Mathieu Poirier <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-tmc-etf.c +0
-0@@ -308,9 +308,7 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu,int node;struct cs_buffers *buf;
Quoted 11 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, int cpu, · line 311
Quoted 4 lines
drivers/hwtracing/coresight/coresight-tmc-etf.c +1
-3-if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu);This breaks the build on 4.14 (and I believe 4.19 from the looks of it) because the event variable is not available without
commita0f08a6a9fee("coresight: Communicate perf event to sink buffer allocation functions") from upstream. I am not sure how this should be fixed (either backporting the above commit or changing this one somehow) but it should be dropped in the meantime.
Ok, now dropped from both trees, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 66/74 coresight: etb10: Do not call smp_processor_id from preemptible
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit 730766bae3280a25d40ea76a53dc6342e84e6513 ]
During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below :
BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544
Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs.
--- drivers/hwtracing/coresight/coresight-etb10.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +1 -3
@@ -287,9 +287,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,int node;struct cs_buffers *buf; -if (cpu ==-1 ) - cpu =smp_processor_id (); - node =cpu_to_node (cpu); + node = (event->cpu ==-1 ) ?NUMA_NO_NODE :cpu_to_node (event->cpu); buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node);if (!buf)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/74 rxrpc: Fix possible NULL pointer access in ICMP handling
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit f0308fb0708078d6c1d8a4d533941a7a191af634 ]
If an ICMP packet comes in on the UDP socket backing an AF_RXRPC socket as the UDP socket is being shut down, rxrpc_error_report() may get called to deal with it after sk_user_data on the UDP socket has been cleared, leading to a NULL pointer access when this local endpoint record gets accessed.
Fix this by just returning immediately if sk_user_data was NULL.
The oops looks like the following:
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
...
RIP: 0010:rxrpc_error_report+0x1bd/0x6a9 ... Call Trace: ? sock_queue_err_skb+0xbd/0xde ? __udp4_lib_err+0x313/0x34d __udp4_lib_err+0x313/0x34d icmp_unreach+0x1ee/0x207 icmp_rcv+0x25b/0x28f ip_protocol_deliver_rcu+0x95/0x10e ip_local_deliver+0xe9/0x148 __netif_receive_skb_one_core+0x52/0x6e process_backlog+0xdc/0x177 net_rx_action+0xf9/0x270 __do_softirq+0x1b6/0x39a ? smpboot_register_percpu_thread+0xce/0xce run_ksoftirqd+0x1d/0x42 smpboot_thread_fn+0x19e/0x1b3 kthread+0xf1/0xf6 ? kthread_delayed_work_timer_fn+0x83/0x83 ret_from_fork+0x24/0x30
--- net/rxrpc/peer_event.c | 3 +++ 1 file changed, 3 insertions(+)
net/rxrpc/peer_event.c +3 -0
@@ -150,6 +150,9 @@ void rxrpc_error_report(struct sock *sk)struct rxrpc_peer *peer;struct sk_buff *skb; +if (unlikely (!local)) +return ; +_enter ("%p{%d}" , sk, local->debug_id); skb =sock_dequeue_err_skb (sk);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/74 ath9k_htc: Modify byte order for an error message
In reply to Greg Kroah-HartmanFrom: Masashi Honma <[email protected]>
[ Upstream commit e01fddc19d215f6ad397894ec2a851d99bf154e2 ]
rs_datalen is be16 so we need to convert it before printing.
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 -1
@@ -986,7 +986,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) {ath_err (common,"Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n" , - rxstatus->rs_datalen, skb->len); +be16_to_cpu (rxstatus->rs_datalen), skb->len); goto rx_next; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/74 ath9k_htc: Discard undersized packets
In reply to Greg Kroah-HartmanFrom: Masashi Honma <[email protected]>
[ Upstream commit cd486e627e67ee9ab66914d36d3127ef057cc010 ]
Sometimes the hardware will push small packets that trigger a WARN_ON in mac80211. Discard them early to avoid this issue.
This patch ports 2 patches from ath9k to ath9k_htc. commit 3c0efb745a172bfe96459e20cbd37b0c945d5f8d "ath9k: discard undersized packets".
commit df5c4150501ee7e86383be88f6490d970adcf157 "ath9k: correctly handle short radar pulses".
[ 112.835889] ------------[ cut here ]------------ [ 112.835971] WARNING: CPU: 5 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi+0xaac/0xb40 [mac80211] [ 112.835973] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath mac80211 cfg80211 libarc4 nouveau snd_hda_codec_hdmi intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_hda_codec video snd_hda_core ttm snd_hwdep drm_kms_helper snd_pcm crct10dif_pclmul snd_seq_midi drm snd_seq_midi_event crc32_pclmul snd_rawmidi ghash_clmulni_intel snd_seq aesni_intel aes_x86_64 crypto_simd cryptd snd_seq_device glue_helper snd_timer sch_fq_codel i2c_algo_bit fb_sys_fops snd input_leds syscopyarea sysfillrect sysimgblt intel_cstate mei_me intel_rapl_perf soundcore mxm_wmi lpc_ich mei kvm_intel kvm mac_hid irqbypass parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear e1000e ahci libahci wmi [ 112.836022] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.3.0-wt #1 [ 112.836023] Hardware name: MouseComputer Co.,Ltd. X99-S01/X99-S01, BIOS 1.0C-W7 04/01/2015 [ 112.836056] RIP: 0010:ieee80211_rx_napi+0xaac/0xb40 [mac80211] [ 112.836059] Code: 00 00 66 41 89 86 b0 00 00 00 e9 c8 fa ff ff 4c 89 b5 40 ff ff ff 49 89 c6 e9 c9 fa ff ff 48 c7 c7 e0 a2 a5 c0 e8 47 41 b0 e9 <0f> 0b 48 89 df e8 5a 94 2d ea e9 02 f9 ff ff 41 39 c1 44 89 85 60 [ 112.836060] RSP: 0018:ffffaa6180220da8 EFLAGS: 00010286 [ 112.836062] RAX: 0000000000000024 RBX: ffff909a20eeda00 RCX: 0000000000000000 [ 112.836064] RDX: 0000000000000000 RSI: ffff909a2f957448 RDI: ffff909a2f957448 [ 112.836065] RBP: ffffaa6180220e78 R08: 00000000000006e9 R09: 0000000000000004 [ 112.836066] R10: 000000000000000a R11: 0000000000000001 R12: 0000000000000000 [ 112.836068] R13: ffff909a261a47a0 R14: 0000000000000000 R15: 0000000000000004 [ 112.836070] FS: 0000000000000000(0000) GS:ffff909a2f940000(0000) knlGS:0000000000000000 [ 112.836071] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 112.836073] CR2: 00007f4e3ffffa08 CR3: 00000001afc0a006 CR4: 00000000001606e0 [ 112.836074] Call Trace: [ 112.836076] <IRQ> [ 112.836083] ? finish_td+0xb3/0xf0 [ 112.836092] ? ath9k_rx_prepare.isra.11+0x22f/0x2a0 [ath9k_htc] [ 112.836099] ath9k_rx_tasklet+0x10b/0x1d0 [ath9k_htc] [ 112.836105] tasklet_action_common.isra.22+0x63/0x110 [ 112.836108] tasklet_action+0x22/0x30 [ 112.836115] __do_softirq+0xe4/0x2da [ 112.836118] irq_exit+0xae/0xb0 [ 112.836121] do_IRQ+0x86/0xe0 [ 112.836125] common_interrupt+0xf/0xf [ 112.836126] </IRQ> [ 112.836130] RIP: 0010:cpuidle_enter_state+0xa9/0x440 [ 112.836133] Code: 3d bc 20 38 55 e8 f7 1d 84 ff 49 89 c7 0f 1f 44 00 00 31 ff e8 28 29 84 ff 80 7d d3 00 0f 85 e6 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 ed 0f 89 ff 01 00 00 41 c7 44 24 10 00 00 00 00 48 83 c4 18 [ 112.836134] RSP: 0018:ffffaa61800e3e48 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde [ 112.836136] RAX: ffff909a2f96b340 RBX: ffffffffabb58200 RCX: 000000000000001f [ 112.836137] RDX: 0000001a458adc5d RSI: 0000000026c9b581 RDI: 0000000000000000 [ 112.836139] RBP: ffffaa61800e3e88 R08: 0000000000000002 R09: 000000000002abc0 [ 112.836140] R10: ffffaa61800e3e18 R11: 000000000000002d R12: ffffca617fb40b00 [ 112.836141] R13: 0000000000000002 R14: ffffffffabb582d8 R15: 0000001a458adc5d [ 112.836145] ? cpuidle_enter_state+0x98/0x440 [ 112.836149] ? menu_select+0x370/0x600 [ 112.836151] cpuidle_enter+0x2e/0x40 [ 112.836154] call_cpuidle+0x23/0x40 [ 112.836156] do_idle+0x204/0x280 [ 112.836159] cpu_startup_entry+0x1d/0x20 [ 112.836164] start_secondary+0x167/0x1c0 [ 112.836169] secondary_startup_64+0xa4/0xb0 [ 112.836173] ---[ end trace 9f4cd18479cc5ae5 ]---
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +19 -4
@@ -973,6 +973,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,struct ath_htc_rx_status *rxstatus;struct ath_rx_status rx_stats;bool decrypt_error = false; +__be16 rs_datalen; +bool is_phyerr;if (skb->len <HTC_RX_FRAME_HEADER_SIZE ) { ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
@@ -982,11 +984,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, rxstatus = (struct ath_htc_rx_status *)skb->data; -if (be16_to_cpu (rxstatus->rs_datalen) - - (skb->len -HTC_RX_FRAME_HEADER_SIZE ) !=0 ) { + rs_datalen =be16_to_cpu (rxstatus->rs_datalen); +if (unlikely (rs_datalen - + (skb->len -HTC_RX_FRAME_HEADER_SIZE ) !=0 )) {ath_err (common,"Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n" , -be16_to_cpu (rxstatus->rs_datalen), skb->len); + rs_datalen, skb->len); + goto rx_next; + } + + is_phyerr = rxstatus->rs_status &ATH9K_RXERR_PHY ; +/* +* Discard zero-length packets and packets smaller than an ACK +* which are not PHY_ERROR (short radar pulses have a length of 3) +*/ +if (unlikely (!rs_datalen || (rs_datalen <10 && !is_phyerr))) { +ath_warn (common, +"Short RX data len, dropping (dlen: %d)\n" , + rs_datalen); goto rx_next; }
@@ -1011,7 +1026,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,* Process PHY errors and return so that the packet * can be dropped. */ -if (rx_stats.rs_status &ATH9K_RXERR_PHY ) { +if (unlikely (is_phyerr)) {/* TODO: Not using DFS processing now. */ if (ath_cmn_process_fft (&priv->spec_priv, hdr, &rx_stats, rx_status->mactime)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/74 arm64: dts: meson: odroid-c2: Disable usb_otg bus to avoid power failed warning
In reply to Greg Kroah-HartmanFrom: Anand Moon <[email protected]>
[ Upstream commit 72c9b5f6f75fbc6c47e0a2d02bc3838a2a47c90a ]
usb_otg bus needs to get initialize from the u-boot to be configured to used as power source to SBC or usb otg port will get configured as host device. Right now this support is missing in the u-boot and phy driver so to avoid power failed warning, we would disable this feature until proper fix is found.
[ 2.716048] phy phy-c0000000.phy.0: USB ID detect failed! [ 2.720186] phy phy-c0000000.phy.0: phy poweron failed --> -22 [ 2.726001] ------------[ cut here ]------------ [ 2.730583] WARNING: CPU: 0 PID: 12 at drivers/regulator/core.c:2039 _regulator_put+0x3c/0xe8 [ 2.738983] Modules linked in: [ 2.742005] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.2.9-1-ARCH #1 [ 2.748643] Hardware name: Hardkernel ODROID-C2 (DT) [ 2.753566] Workqueue: events deferred_probe_work_func [ 2.758649] pstate: 60000005 (nZCv daif -PAN -UAO) [ 2.763394] pc : _regulator_put+0x3c/0xe8 [ 2.767361] lr : _regulator_put+0x3c/0xe8 [ 2.771326] sp : ffff000011aa3a50 [ 2.774604] x29: ffff000011aa3a50 x28: ffff80007ed1b600 [ 2.779865] x27: ffff80007f7036a8 x26: ffff80007f7036a8 [ 2.785126] x25: 0000000000000000 x24: ffff000011a44458 [ 2.790387] x23: ffff000011344218 x22: 0000000000000009 [ 2.795649] x21: ffff000011aa3b68 x20: ffff80007ed1b500 [ 2.800910] x19: ffff80007ed1b500 x18: 0000000000000010 [ 2.806171] x17: 000000005be5943c x16: 00000000f1c73b29 [ 2.811432] x15: ffffffffffffffff x14: ffff0000117396c8 [ 2.816694] x13: ffff000091aa37a7 x12: ffff000011aa37af [ 2.821955] x11: ffff000011763000 x10: ffff000011aa3730 [ 2.827216] x9 : 00000000ffffffd0 x8 : ffff000010871760 [ 2.832477] x7 : 00000000000000d0 x6 : ffff0000119d151b [ 2.837739] x5 : 000000000000000f x4 : 0000000000000000 [ 2.843000] x3 : 0000000000000000 x2 : 38104b2678c20100 [ 2.848261] x1 : 0000000000000000 x0 : 0000000000000024 [ 2.853523] Call trace: [ 2.855940] _regulator_put+0x3c/0xe8 [ 2.859562] regulator_put+0x34/0x48 [ 2.863098] regulator_bulk_free+0x40/0x58 [ 2.867153] devm_regulator_bulk_release+0x24/0x30 [ 2.871896] release_nodes+0x1f0/0x2e0 [ 2.875604] devres_release_all+0x64/0xa4 [ 2.879571] really_probe+0x1c8/0x3e0 [ 2.883194] driver_probe_device+0xe4/0x138 [ 2.887334] __device_attach_driver+0x90/0x110 [ 2.891733] bus_for_each_drv+0x8c/0xd8 [ 2.895527] __device_attach+0xdc/0x160 [ 2.899322] device_initial_probe+0x24/0x30 [ 2.903463] bus_probe_device+0x9c/0xa8 [ 2.907258] deferred_probe_work_func+0xa0/0xf0 [ 2.911745] process_one_work+0x1b4/0x408 [ 2.915711] worker_thread+0x54/0x4b8 [ 2.919334] kthread+0x12c/0x130 [ 2.922526] ret_from_fork+0x10/0x1c [ 2.926060] ---[ end trace 51a68f4c0035d6c0 ]--- [ 2.930691] ------------[ cut here ]------------ [ 2.935242] WARNING: CPU: 0 PID: 12 at drivers/regulator/core.c:2039 _regulator_put+0x3c/0xe8 [ 2.943653] Modules linked in: [ 2.946675] CPU: 0 PID: 12 Comm: kworker/0:1 Tainted: G W 5.2.9-1-ARCH #1 [ 2.954694] Hardware name: Hardkernel ODROID-C2 (DT) [ 2.959613] Workqueue: events deferred_probe_work_func [ 2.964700] pstate: 60000005 (nZCv daif -PAN -UAO) [ 2.969445] pc : _regulator_put+0x3c/0xe8 [ 2.973412] lr : _regulator_put+0x3c/0xe8 [ 2.977377] sp : ffff000011aa3a50 [ 2.980655] x29: ffff000011aa3a50 x28: ffff80007ed1b600 [ 2.985916] x27: ffff80007f7036a8 x26: ffff80007f7036a8 [ 2.991177] x25: 0000000000000000 x24: ffff000011a44458 [ 2.996439] x23: ffff000011344218 x22: 0000000000000009 [ 3.001700] x21: ffff000011aa3b68 x20: ffff80007ed1bd00 [ 3.006961] x19: ffff80007ed1bd00 x18: 0000000000000010 [ 3.012222] x17: 000000005be5943c x16: 00000000f1c73b29 [ 3.017484] x15: ffffffffffffffff x14: ffff0000117396c8 [ 3.022745] x13: ffff000091aa37a7 x12: ffff000011aa37af [ 3.028006] x11: ffff000011763000 x10: ffff000011aa3730 [ 3.033267] x9 : 00000000ffffffd0 x8 : ffff000010871760 [ 3.038528] x7 : 00000000000000fd x6 : ffff0000119d151b [ 3.043790] x5 : 000000000000000f x4 : 0000000000000000 [ 3.049051] x3 : 0000000000000000 x2 : 38104b2678c20100 [ 3.054312] x1 : 0000000000000000 x0 : 0000000000000024 [ 3.059574] Call trace: [ 3.061991] _regulator_put+0x3c/0xe8 [ 3.065613] regulator_put+0x34/0x48 [ 3.069149] regulator_bulk_free+0x40/0x58 [ 3.073203] devm_regulator_bulk_release+0x24/0x30 [ 3.077947] release_nodes+0x1f0/0x2e0 [ 3.081655] devres_release_all+0x64/0xa4 [ 3.085622] really_probe+0x1c8/0x3e0 [ 3.089245] driver_probe_device+0xe4/0x138 [ 3.093385] __device_attach_driver+0x90/0x110 [ 3.097784] bus_for_each_drv+0x8c/0xd8 [ 3.101578] __device_attach+0xdc/0x160 [ 3.105373] device_initial_probe+0x24/0x30 [ 3.109514] bus_probe_device+0x9c/0xa8 [ 3.113309] deferred_probe_work_func+0xa0/0xf0 [ 3.117796] process_one_work+0x1b4/0x408 [ 3.121762] worker_thread+0x54/0x4b8 [ 3.125384] kthread+0x12c/0x130 [ 3.128575] ret_from_fork+0x10/0x1c [ 3.132110] ---[ end trace 51a68f4c0035d6c1 ]--- [ 3.136753] dwc2: probe of c9000000.usb failed with error -22
--- arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +2 -2
@@ -295,7 +295,7 @@ }; &usb0_phy { - status = "okay"; + status = "disabled"; phy-supply = <&usb_otg_pwr>; };
@@ -305,7 +305,7 @@ }; &usb0 { - status = "okay"; + status = "disabled"; }; &usb1 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/74 net: add annotations on hh->hh_len lockless accesses
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit c305c6ae79e2ce20c22660ceda94f0d86d639a82 ]
KCSAN reported a data-race [1]
While we can use READ_ONCE() on the read sides,
we need to make sure hh->hh_len is written last.
[1]
BUG: KCSAN: data-race in eth_header_cache / neigh_resolve_output
write to 0xffff8880b9dedcb8 of 4 bytes by task 29760 on cpu 0:
eth_header_cache+0xa9/0xd0 net/ethernet/eth.c:247 neigh_hh_init net/core/neighbour.c:1463 [inline] neigh_resolve_output net/core/neighbour.c:1480 [inline] neigh_resolve_output+0x415/0x470 net/core/neighbour.c:1470 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505 ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647 rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
read to 0xffff8880b9dedcb8 of 4 bytes by task 29572 on cpu 1:
neigh_resolve_output net/core/neighbour.c:1479 [inline] neigh_resolve_output+0x113/0x470 net/core/neighbour.c:1470 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505 ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647 rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615 process_one_work+0x3d4/0x890 kernel/workqueue.c:2269 worker_thread+0xa0/0x800 kernel/workqueue.c:2415 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 29572 Comm: kworker/1:4 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events rt6_probe_deferred
--- drivers/firewire/net.c | 6 +++++- include/net/neighbour.h | 2 +- net/core/neighbour.c | 4 ++-- net/ethernet/eth.c | 7 ++++++- 4 files changed, 14 insertions(+), 5 deletions(-)
drivers/firewire/net.c +5 -1
@@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh, h = (struct fwnet_header *)((u8 *)hh->hh_data +HH_DATA_OFF (sizeof (*h))); h->h_proto = type;memcpy (h->h_dest, neigh->ha, net->addr_len); - hh->hh_len =FWNET_HLEN ; + +/* Pairs with the READ_ONCE() in neigh_resolve_output(), +* neigh_hh_output() and neigh_update_hhs(). +*/ +smp_store_release (&hh->hh_len,FWNET_HLEN );return 0 ; }
include/net/neighbour.h +1 -1
@@ -458,7 +458,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb do { seq = read_seqbegin(&hh->hh_lock); - hh_len = hh->hh_len; + hh_len = READ_ONCE(hh->hh_len); if (likely(hh_len <= HH_DATA_MOD)) { hh_alen = HH_DATA_MOD;
net/core/neighbour.c +2 -2
@@ -1094,7 +1094,7 @@ static void neigh_update_hhs(struct neighbour *neigh)if (update) { hh = &neigh->hh; -if (hh->hh_len) { +if (READ_ONCE (hh->hh_len)) {write_seqlock_bh (&hh->hh_lock);update (hh, neigh->dev, neigh->ha);write_sequnlock_bh (&hh->hh_lock);
@@ -1355,7 +1355,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)struct net_device *dev = neigh->dev;unsigned int seq; -if (dev->header_ops->cache && !neigh->hh.hh_len) +if (dev->header_ops->cache && !READ_ONCE (neigh->hh.hh_len))neigh_hh_init (neigh); do {
net/ethernet/eth.c +6 -1
@@ -239,7 +239,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 eth->h_proto = type;memcpy (eth->h_source, dev->dev_addr,ETH_ALEN );memcpy (eth->h_dest, neigh->ha,ETH_ALEN ); - hh->hh_len =ETH_HLEN ; + +/* Pairs with READ_ONCE() in neigh_resolve_output(), +* neigh_hh_output() and neigh_update_hhs(). +*/ +smp_store_release (&hh->hh_len,ETH_HLEN ); +return 0 ; }EXPORT_SYMBOL (eth_header_cache);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 72/74 s390/smp: fix physical to logical CPU map for SMT
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 72a81ad9d6d62dcb79f7e8ad66ffd1c768b72026 ]
If an SMT capable system is not IPL'ed from the first CPU the setup of the physical to logical CPU mapping is broken: the IPL core gets CPU number 0, but then the next core gets CPU number 1. Correct would be that all SMT threads of CPU 0 get the subsequent logical CPU numbers.
This is important since a lot of code (like e.g. the CPU topology code) assumes that CPU maps are setup like this. If the mapping is broken the system will not IPL due to broken topology masks:
[ 1.716341] BUG: arch topology broken [ 1.716342] the SMT domain not a subset of the MC domain [ 1.716343] BUG: arch topology broken [ 1.716344] the MC domain not a subset of the BOOK domain
This scenario can usually not happen since LPARs are always IPL'ed from CPU 0 and also re-IPL is intiated from CPU 0. However older kernels did initiate re-IPL on an arbitrary CPU. If therefore a re-IPL from an old kernel into a new kernel is initiated this may lead to crash.
Fix this by setting up the physical to logical CPU mapping correctly.
--- arch/s390/kernel/smp.c | 80 ++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 26 deletions(-)
arch/s390/kernel/smp.c +54 -26
@@ -725,39 +725,67 @@ static void __ref smp_get_core_info(struct sclp_core_info *info, int early)static int smp_add_present_cpu (int cpu); -static int __smp_rescan_cpus (struct sclp_core_info *info,int sysfs_add) +static int smp_add_core (struct sclp_core_entry *core,cpumask_t *avail, +bool configured,bool early) {struct pcpu *pcpu; -cpumask_t avail; -int cpu, nr, i, j; +int cpu, nr, i;u16 address; nr =0 ; -cpumask_xor (&avail, cpu_possible_mask, cpu_present_mask); - cpu =cpumask_first (&avail); -for (i =0 ; (i < info->combined) && (cpu < nr_cpu_ids); i++) { -if (sclp.has_core_type && info->core[i].type != boot_core_type) +if (sclp.has_core_type && core->type != boot_core_type) +return nr; + cpu =cpumask_first (avail); + address = core->core_id << smp_cpu_mt_shift; +for (i =0 ; (i <= smp_cpu_mtid) && (cpu < nr_cpu_ids); i++) { +if (pcpu_find_address (cpu_present_mask, address + i))continue ; - address = info->core[i].core_id << smp_cpu_mt_shift; -for (j =0 ; j <= smp_cpu_mtid; j++) { -if (pcpu_find_address (cpu_present_mask, address + j)) -continue ; - pcpu = pcpu_devices + cpu; - pcpu->address = address + j; - pcpu->state = - (cpu >= info->configured*(smp_cpu_mtid +1 )) ? -CPU_STATE_STANDBY :CPU_STATE_CONFIGURED ; -smp_cpu_set_polarization (cpu,POLARIZATION_UNKNOWN ); -set_cpu_present (cpu, true); -if (sysfs_add &&smp_add_present_cpu (cpu) !=0 ) -set_cpu_present (cpu, false); -else - nr++; - cpu =cpumask_next (cpu, &avail); -if (cpu >= nr_cpu_ids) + pcpu = pcpu_devices + cpu; + pcpu->address = address + i; +if (configured) + pcpu->state =CPU_STATE_CONFIGURED ; +else + pcpu->state =CPU_STATE_STANDBY ; +smp_cpu_set_polarization (cpu,POLARIZATION_UNKNOWN ); +set_cpu_present (cpu, true); +if (!early &&smp_add_present_cpu (cpu) !=0 ) +set_cpu_present (cpu, false); +else + nr++; +cpumask_clear_cpu (cpu, avail); + cpu =cpumask_next (cpu, avail); + } +return nr; +} + +static int __smp_rescan_cpus (struct sclp_core_info *info,bool early) +{ +struct sclp_core_entry *core; +cpumask_t avail; +bool configured; +u16 core_id; +int nr, i; + + nr =0 ; +cpumask_xor (&avail, cpu_possible_mask, cpu_present_mask); +/* +* Add IPL core first (which got logical CPU number 0) to make sure +* that all SMT threads get subsequent logical CPU numbers. +*/ +if (early) { + core_id = pcpu_devices[0 ].address >> smp_cpu_mt_shift; +for (i =0 ; i < info->configured; i++) { + core = &info->core[i]; +if (core->core_id == core_id) { + nr +=smp_add_core (core, &avail, true, early);break ; + } } } +for (i =0 ; i < info->combined; i++) { + configured = i < info->configured; + nr +=smp_add_core (&info->core[i], &avail, configured, early); + }return nr; }
@@ -803,7 +831,7 @@ void __init smp_detect_cpus(void)/* Add CPUs present at boot */ get_online_cpus (); -__smp_rescan_cpus (info,0 ); +__smp_rescan_cpus (info, true);put_online_cpus ();memblock_free_early ((unsigned long )info,sizeof (*info)); }
@@ -1156,7 +1184,7 @@ int __ref smp_rescan_cpus(void)smp_get_core_info (info,0 );get_online_cpus ();mutex_lock (&smp_cpu_state_mutex); - nr =__smp_rescan_cpus (info,1 ); + nr =__smp_rescan_cpus (info, false);mutex_unlock (&smp_cpu_state_mutex);put_online_cpus ();kfree (info);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/74 xen/blkback: Avoid unmapping unmapped grant pages
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
[ Upstream commit f9bd84a8a845d82f9b5a081a7ae68c98a11d2e84 ]
For each I/O request, blkback first maps the foreign pages for the request to its local pages. If an allocation of a local page for the mapping fails, it should unmap every mapping already made for the request.
However, blkback's handling mechanism for the allocation failure does not mark the remaining foreign pages as unmapped. Therefore, the unmap function merely tries to unmap every valid grant page for the request, including the pages not mapped due to the allocation failure. On a system that fails the allocation frequently, this problem leads to following kernel crash.
[ 372.012538] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001 [ 372.012546] IP: [<ffffffff814071ac>] gnttab_unmap_refs.part.7+0x1c/0x40 [ 372.012557] PGD 16f3e9067 PUD 16426e067 PMD 0 [ 372.012562] Oops: 0002 [#1] SMP [ 372.012566] Modules linked in: act_police sch_ingress cls_u32 ... [ 372.012746] Call Trace: [ 372.012752] [<ffffffff81407204>] gnttab_unmap_refs+0x34/0x40 [ 372.012759] [<ffffffffa0335ae3>] xen_blkbk_unmap+0x83/0x150 [xen_blkback] ... [ 372.012802] [<ffffffffa0336c50>] dispatch_rw_block_io+0x970/0x980 [xen_blkback] ... Decompressing Linux... Parsing ELF... done. Booting the kernel. [ 0.000000] Initializing cgroup subsys cpuset
This commit fixes this problem by marking the grant pages of the given request that didn't mapped due to the allocation failure as invalid.
--- drivers/block/xen-blkback/blkback.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/xen-blkback/blkback.c +2 -0
@@ -929,6 +929,8 @@ next: out_of_memory:pr_alert ("%s: out of memory\n" , __func__);put_free_pages (ring, pages_to_gnt, segs_to_map); +for (i = last_map; i < num; i++) + pages[i]->handle =BLKBACK_INVALID_HANDLE ;return -ENOMEM ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/74 perf/x86/intel/bts: Fix the use of page_private()
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
[ Upstream commit ff61541cc6c1962957758ba433c574b76f588d23 ]
Commit
8062382c8dbe2 ("perf/x86/intel/bts: Add BTS PMU driver")
brought in a warning with the BTS buffer initialization that is easily tripped with (assuming KPTI is disabled):
instantly throwing:
Quoted 9 lines
------------[ cut here ]------------ WARNING: CPU: 2 PID: 326 at arch/x86/events/intel/bts.c:86 bts_buffer_setup_aux+0x117/0x3d0 Modules linked in: CPU: 2 PID: 326 Comm: perf Not tainted 5.4.0-rc8-00291-gceb9e77324fa #904 RIP: 0010:bts_buffer_setup_aux+0x117/0x3d0 Call Trace: rb_alloc_aux+0x339/0x550 perf_mmap+0x607/0xc70 mmap_region+0x76b/0xbd0
...
It appears to assume (for lost raisins) that PagePrivate() is set, while later it actually tests for PagePrivate() before using page_private().
Make it consistent and always check PagePrivate() before using page_private().
--- arch/x86/events/intel/bts.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/x86/events/intel/bts.c +11 -5
@@ -71,9 +71,17 @@ struct bts_buffer {static struct pmu bts_pmu; +static int buf_nr_pages (struct page *page) +{ +if (!PagePrivate (page)) +return 1 ; + +return 1 <<page_private (page); +} +static size_t buf_size (struct page *page) { -return 1 << (PAGE_SHIFT +page_private (page)); +return buf_nr_pages (page) *PAGE_SIZE ; } static void *
@@ -89,9 +97,7 @@ bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite)/* count all the high order buffers */ for (pg =0 , nbuf =0 ; pg < nr_pages;) { page =virt_to_page (pages[pg]); -if (WARN_ON_ONCE (!PagePrivate (page) && nr_pages >1 )) -return NULL ; - pg +=1 <<page_private (page); + pg +=buf_nr_pages (page); nbuf++; }
@@ -115,7 +121,7 @@ bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite)unsigned int __nr_pages; page =virt_to_page (pages[pg]); - __nr_pages =PagePrivate (page) ?1 <<page_private (page) :1 ; + __nr_pages =buf_nr_pages (page); buf->buf[nbuf].page = page; buf->buf[nbuf].offset = offset; buf->buf[nbuf].displacement = (pad ?BTS_RECORD_SIZE - pad :0 );
Signature · 1 line
2.20.1
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.163 release. There are 74 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 Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.163-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.163 release. There are 74 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 Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
For v4.14.162-73-g404399b2e7db:
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 373 pass: 373 fail: 0
Guenter
Jon Hunter
maintainerQuoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.163 release. There are 74 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 Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.163-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests for Tegra are passing ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.163-rc2-ga95271edf2c8
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.163 release. There are 74 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 Thu, 09 Jan 2020 20:44:51 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.163-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.163-rc2
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 404399b2e7dbcae8377bff92324178718f9574d0
git describe: v4.14.161-163-g404399b2e7db
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.161-163-g404399b2e7db
No regressions (compared to build v4.14.161)
No fixes (compared to build v4.14.161)
Ran 21424 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* network-basic-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-open-posix-tests
* ltp-syscalls-tests
* kvm-unit-tests
* ssuite
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org