From: Jitao Shi <jitao.shi(a)mediatek.com>
To comply with the panel sequence, hold the mipi signal to LP00 before the dcs cmds transmission,
and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3) lcm_reset pull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
If dsi is not in cmd mode, then dsi will pull the mipi signal high in the mtk_output_dsi_enable function.
The delay in lane_ready func is the reaction time of dsi_rx after pulling up the mipi signal.
Fixes: 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridge API")
Cc: <stable(a)vger.kernel.org> # 6.6.x: b255d51e3967: sched: Modify dsi funcs to atomic operations
Cc: <stable(a)vger.kernel.org> # 6.6.x: 72c69c977502: sched: Separate poweron/poweroff from enable/disable and define new funcs
Cc: <stable(a)vger.kernel.org> # 6.6.x
Signed-off-by: Jitao Shi <jitao.shi(a)mediatek.com>
Signed-off-by: Xinlei Lee <xinlei.lee(a)mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno(a)collabora.com>
---
drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9a6b928dba8..25e84d9426bf 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -203,6 +203,7 @@ struct mtk_dsi {
struct mtk_phy_timing phy_timing;
int refcount;
bool enabled;
+ bool lanes_ready;
u32 irq_data;
wait_queue_head_t irq_wait_queue;
const struct mtk_dsi_driver_data *driver_data;
@@ -661,18 +662,11 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
mtk_dsi_reset_engine(dsi);
mtk_dsi_phy_timconfig(dsi);
- mtk_dsi_rxtx_control(dsi);
- usleep_range(30, 100);
- mtk_dsi_reset_dphy(dsi);
mtk_dsi_ps_control_vact(dsi);
mtk_dsi_set_vm_cmd(dsi);
mtk_dsi_config_vdo_timing(dsi);
mtk_dsi_set_interrupt_enable(dsi);
- mtk_dsi_clk_ulp_mode_leave(dsi);
- mtk_dsi_lane0_ulp_mode_leave(dsi);
- mtk_dsi_clk_hs_mode(dsi, 0);
-
return 0;
err_disable_engine_clk:
clk_disable_unprepare(dsi->engine_clk);
@@ -701,6 +695,23 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
clk_disable_unprepare(dsi->digital_clk);
phy_power_off(dsi->phy);
+
+ dsi->lanes_ready = false;
+}
+
+static void mtk_dsi_lane_ready(struct mtk_dsi *dsi)
+{
+ if (!dsi->lanes_ready) {
+ dsi->lanes_ready = true;
+ mtk_dsi_rxtx_control(dsi);
+ usleep_range(30, 100);
+ mtk_dsi_reset_dphy(dsi);
+ mtk_dsi_clk_ulp_mode_leave(dsi);
+ mtk_dsi_lane0_ulp_mode_leave(dsi);
+ mtk_dsi_clk_hs_mode(dsi, 0);
+ msleep(20);
+ /* The reaction time after pulling up the mipi signal for dsi_rx */
+ }
}
static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
@@ -708,6 +719,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
if (dsi->enabled)
return;
+ mtk_dsi_lane_ready(dsi);
mtk_dsi_set_mode(dsi);
mtk_dsi_clk_hs_mode(dsi, 1);
@@ -1017,6 +1029,8 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
if (MTK_DSI_HOST_IS_READ(msg->type))
irq_flag |= LPRX_RD_RDY_INT_FLAG;
+ mtk_dsi_lane_ready(dsi);
+
ret = mtk_dsi_host_send_cmd(dsi, msg, irq_flag);
if (ret)
goto restore_dsi_mode;
--
2.18.0
This is the start of the stable review cycle for the 4.19.244 release.
There are 32 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed, 18 May 2022 19:36:02 +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.19.244-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.19.244-rc1
Yang Yingliang <yangyingliang(a)huawei.com>
tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe()
Nicolas Dichtel <nicolas.dichtel(a)6wind.com>
ping: fix address binding wrt vrf
Sudip Mukherjee <sudipm.mukherjee(a)gmail.com>
MIPS: fix allmodconfig build with latest mkimage
Zack Rusin <zackr(a)vmware.com>
drm/vmwgfx: Initialize drm_mode_fb_cmd2
Waiman Long <longman(a)redhat.com>
cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in cpuset_init_smp()
Miaoqian Lin <linmq006(a)gmail.com>
slimbus: qcom: Fix IRQ check in qcom_slim_probe
Sven Schwermer <sven.schwermer(a)disruptive-technologies.com>
USB: serial: option: add Fibocom MA510 modem
Sven Schwermer <sven.schwermer(a)disruptive-technologies.com>
USB: serial: option: add Fibocom L610 modem
Ethan Yang <etyang(a)sierrawireless.com>
USB: serial: qcserial: add support for Sierra Wireless EM7590
Scott Chen <scott(a)labau.com.tw>
USB: serial: pl2303: add device id for HP LM930 Display
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
usb: typec: tcpci: Don't skip cleanup in .remove() on error
Sergey Ryazanov <ryazanov.s.a(a)gmail.com>
usb: cdc-wdm: fix reading stuck on device close
Eric Dumazet <edumazet(a)google.com>
tcp: resalt the secret every 10 seconds
Sven Schnelle <svens(a)linux.ibm.com>
s390: disable -Warray-bounds
Mark Brown <broonie(a)kernel.org>
ASoC: ops: Validate input values in snd_soc_put_volsw_range()
Mark Brown <broonie(a)kernel.org>
ASoC: max98090: Generate notifications on changes for custom control
Mark Brown <broonie(a)kernel.org>
ASoC: max98090: Reject invalid values in custom control put()
Ji-Ze Hong (Peter Hong) <hpeter(a)gmail.com>
hwmon: (f71882fg) Fix negative temperature
Andreas Gruenbacher <agruenba(a)redhat.com>
gfs2: Fix filesystem block deallocation for short writes
Taehee Yoo <ap420073(a)gmail.com>
net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
Guangguan Wang <guangguan.wang(a)linux.alibaba.com>
net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
Paolo Abeni <pabeni(a)redhat.com>
net/sched: act_pedit: really ensure the skb is writable
Alexandra Winter <wintera(a)linux.ibm.com>
s390/lcs: fix variable dereferenced before check
Alexandra Winter <wintera(a)linux.ibm.com>
s390/ctcm: fix potential memory leak
Alexandra Winter <wintera(a)linux.ibm.com>
s390/ctcm: fix variable dereferenced before check
Randy Dunlap <rdunlap(a)infradead.org>
hwmon: (ltq-cputemp) restrict it to SOC_XWAY
Johannes Berg <johannes.berg(a)intel.com>
mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
Eric Dumazet <edumazet(a)google.com>
netlink: do not reset transport header in netlink_recvmsg()
Lokesh Dhoundiyal <lokesh.dhoundiyal(a)alliedtelesis.co.nz>
ipv4: drop dst in multicast routing path
Tariq Toukan <tariqt(a)nvidia.com>
net: Fix features skip in for_each_netdev_feature()
Camel Guo <camel.guo(a)axis.com>
hwmon: (tmp401) Add OF device ID table
Sven Eckelmann <sven(a)narfation.org>
batman-adv: Don't skb_split skbuffs with frag_list
-------------
Diffstat:
Makefile | 4 ++--
arch/mips/generic/board-ocelot_pcb123.its.S | 10 +++++-----
arch/s390/Makefile | 10 ++++++++++
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
drivers/hwmon/Kconfig | 2 +-
drivers/hwmon/f71882fg.c | 5 +++--
drivers/hwmon/tmp401.c | 11 +++++++++++
drivers/net/ethernet/sfc/ef10.c | 5 +++++
drivers/net/wireless/mac80211_hwsim.c | 3 +++
drivers/s390/net/ctcm_mpc.c | 6 +-----
drivers/s390/net/ctcm_sysfs.c | 5 +++--
drivers/s390/net/lcs.c | 7 ++++---
drivers/slimbus/qcom-ctrl.c | 4 ++--
drivers/tty/serial/digicolor-usart.c | 2 +-
drivers/usb/class/cdc-wdm.c | 1 +
drivers/usb/serial/option.c | 4 ++++
drivers/usb/serial/pl2303.c | 1 +
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/qcserial.c | 2 ++
drivers/usb/typec/tcpci.c | 2 +-
fs/gfs2/bmap.c | 11 +++++------
include/linux/netdev_features.h | 4 ++--
include/net/tc_act/tc_pedit.h | 1 +
kernel/cgroup/cpuset.c | 7 +++++--
net/batman-adv/fragmentation.c | 11 +++++++++++
net/core/secure_seq.c | 12 +++++++++---
net/ipv4/ping.c | 12 +++++++++++-
net/ipv4/route.c | 1 +
net/netlink/af_netlink.c | 1 -
net/sched/act_pedit.c | 26 ++++++++++++++++++++++----
net/smc/smc_rx.c | 4 ++--
sound/soc/codecs/max98090.c | 5 ++++-
sound/soc/soc-ops.c | 18 +++++++++++++++++-
33 files changed, 152 insertions(+), 48 deletions(-)
This is the start of the stable review cycle for the 5.10.117 release.
There are 68 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed, 18 May 2022 21:35:34 +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/v5.x/stable-review/patch-5.10.117-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.10.117-rc2
Gustavo A. R. Silva <gustavoars(a)kernel.org>
SUNRPC: Fix fall-through warnings for Clang
Jens Axboe <axboe(a)kernel.dk>
io_uring: always use original task when preparing req identity
Dan Vacura <w36195(a)motorola.com>
usb: gadget: uvc: allow for application to cleanly shutdown
Michael Tretter <m.tretter(a)pengutronix.de>
usb: gadget: uvc: rename function to be more consistent
Nicolas Dichtel <nicolas.dichtel(a)6wind.com>
ping: fix address binding wrt vrf
Mike Rapoport <rppt(a)kernel.org>
arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map
Francesco Dolcini <francesco.dolcini(a)toradex.com>
net: phy: Fix race condition on link status change
Trond Myklebust <trond.myklebust(a)hammerspace.com>
SUNRPC: Ensure we flush any closed sockets before xs_xprt_free()
Trond Myklebust <trond.myklebust(a)hammerspace.com>
SUNRPC: Don't call connect() more than once on a TCP socket
Trond Myklebust <trond.myklebust(a)hammerspace.com>
SUNRPC: Prevent immediate close+reconnect
Trond Myklebust <trond.myklebust(a)hammerspace.com>
SUNRPC: Clean up scheduling of autoclose
Zack Rusin <zackr(a)vmware.com>
drm/vmwgfx: Initialize drm_mode_fb_cmd2
Waiman Long <longman(a)redhat.com>
cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in cpuset_init_smp()
Manuel Ullmann <labre(a)posteo.de>
net: atlantic: always deep reset on pm op, fixing up my null deref regression
Xiaomeng Tong <xiam0nd.tong(a)gmail.com>
i40e: i40e_main: fix a missing check on list iterator
Robin Murphy <robin.murphy(a)arm.com>
drm/nouveau/tegra: Stop using iommu_present()
Jeff Layton <jlayton(a)kernel.org>
ceph: fix setting of xattrs on async created inodes
AngeloGioacchino Del Regno <angelogioacchino.delregno(a)collabora.com>
serial: 8250_mtk: Fix register address for XON/XOFF character
AngeloGioacchino Del Regno <angelogioacchino.delregno(a)collabora.com>
serial: 8250_mtk: Fix UART_EFR register address
Miaoqian Lin <linmq006(a)gmail.com>
slimbus: qcom: Fix IRQ check in qcom_slim_probe
Sven Schwermer <sven.schwermer(a)disruptive-technologies.com>
USB: serial: option: add Fibocom MA510 modem
Sven Schwermer <sven.schwermer(a)disruptive-technologies.com>
USB: serial: option: add Fibocom L610 modem
Ethan Yang <etyang(a)sierrawireless.com>
USB: serial: qcserial: add support for Sierra Wireless EM7590
Scott Chen <scott(a)labau.com.tw>
USB: serial: pl2303: add device id for HP LM930 Display
ChiYuan Huang <cy_huang(a)richtek.com>
usb: typec: tcpci_mt6360: Update for BMC PHY setting
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
usb: typec: tcpci: Don't skip cleanup in .remove() on error
Sergey Ryazanov <ryazanov.s.a(a)gmail.com>
usb: cdc-wdm: fix reading stuck on device close
Daniel Starke <daniel.starke(a)siemens.com>
tty: n_gsm: fix mux activation issues in gsm_config()
Yang Yingliang <yangyingliang(a)huawei.com>
tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe()
Thiébaud Weksteen <tweek(a)google.com>
firmware_loader: use kernel credentials when reading firmware
Eric Dumazet <edumazet(a)google.com>
tcp: resalt the secret every 10 seconds
Matthew Hagan <mnhagan88(a)gmail.com>
net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
Shravya Kumbham <shravya.kumbham(a)xilinx.com>
net: emaclite: Don't advertise 1000BASE-T and do auto negotiation
Sven Schnelle <svens(a)linux.ibm.com>
s390: disable -Warray-bounds
Mark Brown <broonie(a)kernel.org>
ASoC: ops: Validate input values in snd_soc_put_volsw_range()
Mark Brown <broonie(a)kernel.org>
ASoC: max98090: Generate notifications on changes for custom control
Mark Brown <broonie(a)kernel.org>
ASoC: max98090: Reject invalid values in custom control put()
Ji-Ze Hong (Peter Hong) <hpeter(a)gmail.com>
hwmon: (f71882fg) Fix negative temperature
Andreas Gruenbacher <agruenba(a)redhat.com>
gfs2: Fix filesystem block deallocation for short writes
Maxim Mikityanskiy <maximmi(a)nvidia.com>
tls: Fix context leak on tls_device_down
Taehee Yoo <ap420073(a)gmail.com>
net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
Guangguan Wang <guangguan.wang(a)linux.alibaba.com>
net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
Florian Fainelli <f.fainelli(a)gmail.com>
net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down()
Florian Fainelli <f.fainelli(a)gmail.com>
net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral
Paolo Abeni <pabeni(a)redhat.com>
net/sched: act_pedit: really ensure the skb is writable
Alexandra Winter <wintera(a)linux.ibm.com>
s390/lcs: fix variable dereferenced before check
Alexandra Winter <wintera(a)linux.ibm.com>
s390/ctcm: fix potential memory leak
Alexandra Winter <wintera(a)linux.ibm.com>
s390/ctcm: fix variable dereferenced before check
Joel Savitz <jsavitz(a)redhat.com>
selftests: vm: Makefile: rename TARGETS to VMTARGETS
Randy Dunlap <rdunlap(a)infradead.org>
hwmon: (ltq-cputemp) restrict it to SOC_XWAY
Jesse Brandeburg <jesse.brandeburg(a)intel.com>
dim: initialize all struct fields
Yang Yingliang <yangyingliang(a)huawei.com>
ionic: fix missing pci_release_regions() on error in ionic_probe()
Dan Aloni <dan.aloni(a)vastdata.com>
nfs: fix broken handling of the softreval mount option
Johannes Berg <johannes.berg(a)intel.com>
mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
Taehee Yoo <ap420073(a)gmail.com>
net: sfc: fix memory leak due to ptp channel
Jiapeng Chong <jiapeng.chong(a)linux.alibaba.com>
sfc: Use swap() instead of open coding it
Eric Dumazet <edumazet(a)google.com>
netlink: do not reset transport header in netlink_recvmsg()
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
drm/nouveau: Fix a potential theorical leak in nouveau_get_backlight_name()
Lokesh Dhoundiyal <lokesh.dhoundiyal(a)alliedtelesis.co.nz>
ipv4: drop dst in multicast routing path
Vladimir Oltean <vladimir.oltean(a)nxp.com>
net: mscc: ocelot: avoid corrupting hardware counters when moving VCAP filters
Vladimir Oltean <vladimir.oltean(a)nxp.com>
net: mscc: ocelot: restrict tc-trap actions to VCAP IS2 lookup 0
Vladimir Oltean <vladimir.oltean(a)nxp.com>
net: mscc: ocelot: fix VCAP IS2 filters matching on both lookups
Vladimir Oltean <vladimir.oltean(a)nxp.com>
net: mscc: ocelot: fix last VCAP IS1/IS2 filter persisting in hardware when deleted
Tariq Toukan <tariqt(a)nvidia.com>
net: Fix features skip in for_each_netdev_feature()
Manikanta Pubbisetty <quic_mpubbise(a)quicinc.com>
mac80211: Reset MBSSID parameters upon connection
Camel Guo <camel.guo(a)axis.com>
hwmon: (tmp401) Add OF device ID table
Guenter Roeck <linux(a)roeck-us.net>
iwlwifi: iwl-dbg: Use del_timer_sync() before freeing
Sven Eckelmann <sven(a)narfation.org>
batman-adv: Don't skb_split skbuffs with frag_list
-------------
Diffstat:
Makefile | 4 +-
arch/arm/include/asm/io.h | 3 ++
arch/arm/mm/ioremap.c | 8 ++++
arch/arm64/include/asm/io.h | 4 ++
arch/arm64/mm/ioremap.c | 9 +++++
arch/s390/Makefile | 10 +++++
drivers/base/firmware_loader/main.c | 17 ++++++++
drivers/gpu/drm/nouveau/nouveau_backlight.c | 9 +++--
drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
drivers/hwmon/Kconfig | 2 +-
drivers/hwmon/f71882fg.c | 5 ++-
drivers/hwmon/tmp401.c | 11 ++++++
drivers/net/dsa/bcm_sf2.c | 3 ++
.../net/ethernet/aquantia/atlantic/aq_pci_func.c | 4 +-
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++
drivers/net/ethernet/intel/i40e/i40e_main.c | 27 ++++++-------
drivers/net/ethernet/mscc/ocelot_flower.c | 5 ++-
drivers/net/ethernet/mscc/ocelot_vcap.c | 9 ++++-
.../net/ethernet/pensando/ionic/ionic_bus_pci.c | 3 +-
drivers/net/ethernet/sfc/ef10.c | 5 +++
drivers/net/ethernet/sfc/efx_channels.c | 21 +++++-----
drivers/net/ethernet/sfc/ptp.c | 14 ++++++-
drivers/net/ethernet/sfc/ptp.h | 1 +
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 15 --------
drivers/net/phy/phy.c | 45 +++++++++++++++++++---
drivers/net/phy/sfp.c | 12 +++++-
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +-
drivers/net/wireless/mac80211_hwsim.c | 3 ++
drivers/s390/net/ctcm_mpc.c | 6 +--
drivers/s390/net/ctcm_sysfs.c | 5 ++-
drivers/s390/net/lcs.c | 7 ++--
drivers/slimbus/qcom-ctrl.c | 4 +-
drivers/tty/n_gsm.c | 12 ++++--
drivers/tty/serial/8250/8250_mtk.c | 22 ++++++-----
drivers/tty/serial/digicolor-usart.c | 5 +--
drivers/usb/class/cdc-wdm.c | 1 +
drivers/usb/gadget/function/f_uvc.c | 32 +++++++++++++--
drivers/usb/gadget/function/uvc.h | 2 +
drivers/usb/gadget/function/uvc_v4l2.c | 3 +-
drivers/usb/serial/option.c | 4 ++
drivers/usb/serial/pl2303.c | 1 +
drivers/usb/serial/pl2303.h | 1 +
drivers/usb/serial/qcserial.c | 2 +
drivers/usb/typec/tcpm/tcpci.c | 2 +-
drivers/usb/typec/tcpm/tcpci_mt6360.c | 26 +++++++++++++
fs/ceph/file.c | 16 ++++++--
fs/file_table.c | 1 +
fs/gfs2/bmap.c | 11 +++---
fs/io_uring.c | 2 +-
fs/nfs/fs_context.c | 2 +-
include/linux/netdev_features.h | 4 +-
include/linux/sunrpc/xprtsock.h | 1 +
include/net/tc_act/tc_pedit.h | 1 +
include/trace/events/sunrpc.h | 1 -
kernel/cgroup/cpuset.c | 7 +++-
lib/dim/net_dim.c | 44 ++++++++++-----------
net/batman-adv/fragmentation.c | 11 ++++++
net/core/secure_seq.c | 12 ++++--
net/ipv4/ping.c | 15 +++++++-
net/ipv4/route.c | 1 +
net/mac80211/mlme.c | 6 +++
net/netlink/af_netlink.c | 1 -
net/sched/act_pedit.c | 26 +++++++++++--
net/smc/smc_rx.c | 4 +-
net/sunrpc/rpc_pipe.c | 1 +
net/sunrpc/xprt.c | 36 ++++++++---------
net/sunrpc/xprtsock.c | 37 ++++++++++++------
net/tls/tls_device.c | 3 ++
sound/soc/codecs/max98090.c | 5 ++-
sound/soc/soc-ops.c | 18 ++++++++-
tools/testing/selftests/vm/Makefile | 10 ++---
72 files changed, 486 insertions(+), 184 deletions(-)
From: Willy Tarreau <w(a)1wt.eu>
commit f71f01394f742fc4558b3f9f4c7ef4c4cf3b07c8 upstream.
Interrupt handler bad_flp_intr() may cause a UAF on the recently freed
request just to increment the error count. There's no point keeping
that one in the request anyway, and since the interrupt handler uses a
static pointer to the error which cannot be kept in sync with the
pending request, better make it use a static error counter that's reset
for each new request. This reset now happens when entering
redo_fd_request() for a new request via set_next_request().
One initial concern about a single error counter was that errors on one
floppy drive could be reported on another one, but this problem is not
real given that the driver uses a single drive at a time, as that
PC-compatible controllers also have this limitation by using shared
signals. As such the error count is always for the "current" drive.
Reported-by: Minh Yuan <yuanmingbuaa(a)gmail.com>
Suggested-by: Linus Torvalds <torvalds(a)linuxfoundation.org>
Tested-by: Denis Efremov <efremov(a)linux.com>
Signed-off-by: Willy Tarreau <w(a)1wt.eu>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
Signed-off-by: Denis Efremov <efremov(a)linux.com>
---
drivers/block/floppy.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index cfe1bfb3c20e..216ee1057b12 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -516,8 +516,8 @@ static unsigned long fdc_busy;
static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);
static DECLARE_WAIT_QUEUE_HEAD(command_done);
-/* Errors during formatting are counted here. */
-static int format_errors;
+/* errors encountered on the current (or last) request */
+static int floppy_errors;
/* Format request descriptor. */
static struct format_descr format_req;
@@ -537,7 +537,6 @@ static struct format_descr format_req;
static char *floppy_track_buffer;
static int max_buffer_sectors;
-static int *errors;
typedef void (*done_f)(int);
static const struct cont_t {
void (*interrupt)(void);
@@ -1426,7 +1425,7 @@ static int interpret_errors(void)
if (DP->flags & FTD_MSG)
DPRINT("Over/Underrun - retrying\n");
bad = 0;
- } else if (*errors >= DP->max_errors.reporting) {
+ } else if (floppy_errors >= DP->max_errors.reporting) {
print_errors();
}
if (ST2 & ST2_WC || ST2 & ST2_BC)
@@ -2049,7 +2048,7 @@ static void bad_flp_intr(void)
if (!next_valid_format())
return;
}
- err_count = ++(*errors);
+ err_count = ++floppy_errors;
INFBOUND(DRWE->badness, err_count);
if (err_count > DP->max_errors.abort)
cont->done(0);
@@ -2194,9 +2193,8 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
return -EINVAL;
}
format_req = *tmp_format_req;
- format_errors = 0;
cont = &format_cont;
- errors = &format_errors;
+ floppy_errors = 0;
ret = wait_til_done(redo_format, true);
if (ret == -EINTR)
return -EINTR;
@@ -2679,7 +2677,7 @@ static int make_raw_rw_request(void)
*/
if (!direct ||
(indirect * 2 > direct * 3 &&
- *errors < DP->max_errors.read_track &&
+ floppy_errors < DP->max_errors.read_track &&
((!probing ||
(DP->read_track & (1 << DRS->probed_format)))))) {
max_size = blk_rq_sectors(current_req);
@@ -2812,8 +2810,10 @@ static int set_next_request(void)
fdc_queue = 0;
if (q) {
current_req = blk_fetch_request(q);
- if (current_req)
+ if (current_req) {
+ floppy_errors = 0;
break;
+ }
}
} while (fdc_queue != old_pos);
@@ -2873,7 +2873,6 @@ static void redo_fd_request(void)
_floppy = floppy_type + DP->autodetect[DRS->probed_format];
} else
probing = 0;
- errors = &(current_req->errors);
tmp = make_raw_rw_request();
if (tmp < 2) {
request_done(tmp);
--
2.35.3
From: Willy Tarreau <w(a)1wt.eu>
commit f71f01394f742fc4558b3f9f4c7ef4c4cf3b07c8 upstream.
Interrupt handler bad_flp_intr() may cause a UAF on the recently freed
request just to increment the error count. There's no point keeping
that one in the request anyway, and since the interrupt handler uses a
static pointer to the error which cannot be kept in sync with the
pending request, better make it use a static error counter that's reset
for each new request. This reset now happens when entering
redo_fd_request() for a new request via set_next_request().
One initial concern about a single error counter was that errors on one
floppy drive could be reported on another one, but this problem is not
real given that the driver uses a single drive at a time, as that
PC-compatible controllers also have this limitation by using shared
signals. As such the error count is always for the "current" drive.
Reported-by: Minh Yuan <yuanmingbuaa(a)gmail.com>
Suggested-by: Linus Torvalds <torvalds(a)linuxfoundation.org>
Tested-by: Denis Efremov <efremov(a)linux.com>
Signed-off-by: Willy Tarreau <w(a)1wt.eu>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
Signed-off-by: Denis Efremov <efremov(a)linux.com>
---
drivers/block/floppy.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 97c8fc4d6e7b..0e66314415c5 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -520,8 +520,8 @@ static unsigned long fdc_busy;
static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);
static DECLARE_WAIT_QUEUE_HEAD(command_done);
-/* Errors during formatting are counted here. */
-static int format_errors;
+/* errors encountered on the current (or last) request */
+static int floppy_errors;
/* Format request descriptor. */
static struct format_descr format_req;
@@ -541,7 +541,6 @@ static struct format_descr format_req;
static char *floppy_track_buffer;
static int max_buffer_sectors;
-static int *errors;
typedef void (*done_f)(int);
static const struct cont_t {
void (*interrupt)(void);
@@ -1434,7 +1433,7 @@ static int interpret_errors(void)
if (DP->flags & FTD_MSG)
DPRINT("Over/Underrun - retrying\n");
bad = 0;
- } else if (*errors >= DP->max_errors.reporting) {
+ } else if (floppy_errors >= DP->max_errors.reporting) {
print_errors();
}
if (ST2 & ST2_WC || ST2 & ST2_BC)
@@ -2054,7 +2053,7 @@ static void bad_flp_intr(void)
if (!next_valid_format())
return;
}
- err_count = ++(*errors);
+ err_count = ++floppy_errors;
INFBOUND(DRWE->badness, err_count);
if (err_count > DP->max_errors.abort)
cont->done(0);
@@ -2199,9 +2198,8 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
return -EINVAL;
}
format_req = *tmp_format_req;
- format_errors = 0;
cont = &format_cont;
- errors = &format_errors;
+ floppy_errors = 0;
ret = wait_til_done(redo_format, true);
if (ret == -EINTR)
return -EINTR;
@@ -2684,7 +2682,7 @@ static int make_raw_rw_request(void)
*/
if (!direct ||
(indirect * 2 > direct * 3 &&
- *errors < DP->max_errors.read_track &&
+ floppy_errors < DP->max_errors.read_track &&
((!probing ||
(DP->read_track & (1 << DRS->probed_format)))))) {
max_size = blk_rq_sectors(current_req);
@@ -2818,7 +2816,7 @@ static int set_next_request(void)
if (q) {
current_req = blk_fetch_request(q);
if (current_req) {
- current_req->error_count = 0;
+ floppy_errors = 0;
break;
}
}
@@ -2880,7 +2878,6 @@ static void redo_fd_request(void)
_floppy = floppy_type + DP->autodetect[DRS->probed_format];
} else
probing = 0;
- errors = &(current_req->error_count);
tmp = make_raw_rw_request();
if (tmp < 2) {
request_done(tmp);
--
2.35.3