drm/vc4: hdmi: Avoid log spam for audio start failure
Subsystems (10)
Sasha Levin
maintainerPATCH 1/48 drm/vc4: hdmi: Avoid log spam for audio start failure
From: Dom Cobley <[email protected]>
[ Upstream commit b4e5646178e86665f5caef2894578600f597098a ]
We regularly get dmesg error reports of:
[ 18.184066] hdmi-audio-codec hdmi-audio-codec.3.auto: ASoC: error at snd_soc_dai_startup on i2s-hifi: -19 [ 18.184098] MAI: soc_pcm_open() failed (-19)
These are generated for any disconnected hdmi interface when pulseaudio attempts to open the associated ALSA device (numerous times). Each open generates a kernel error message, generating general log spam.
The error messages all come from _soc_pcm_ret in sound/soc/soc-pcm.c#L39 which suggests returning ENOTSUPP, rather that ENODEV will be quiet. And indeed it is.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -1
@@ -2156,7 +2156,7 @@ static int vc4_hdmi_audio_startup(struct device *dev, void *data) }if (!vc4_hdmi_audio_can_stream (vc4_hdmi)) { - ret = -ENODEV ; + ret = -ENOTSUPP ; goto out_dev_exit; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/48 drm/vc4: hvs: Set AXI panic modes for the HVS
From: Dave Stevenson <[email protected]>
[ Upstream commit 014eccc9da7bfc76a3107fceea37dd60f1d63630 ]
The HVS can change AXI request mode based on how full the COB FIFOs are.
Until now the vc4 driver has been relying on the firmware to have set these to sensible values.
With HVS channel 2 now being used for live video, change the panic mode for all channels to be explicitly set by the driver, and the same for all channels.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/vc4/vc4_hvs.c +11 -0
@@ -906,6 +906,17 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) SCALER_DISPCTRL_SCLEIRQ); +/* Set AXI panic mode. +* VC4 panics when < 2 lines in FIFO. +* VC5 panics when less than 1 line in the FIFO. +*/ + dispctrl &= ~(SCALER_DISPCTRL_PANIC0_MASK | +SCALER_DISPCTRL_PANIC1_MASK | +SCALER_DISPCTRL_PANIC2_MASK ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC0 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC1 ); + dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_PANIC2 ); +/* Set AXI panic mode. * VC4 panics when < 2 lines in FIFO. * VC5 panics when less than 1 line in the FIFO.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/48 drm: panel-orientation-quirks: Add quirk for AYA NEO 2 model
In reply to Sasha LevinFrom: Joaquín Ignacio Aramendía <[email protected]>
[ Upstream commit 361ebf5ef843b0aa1704c72eb26b91cf76c3c5b7 ]
Add quirk orientation for AYA NEO 2. The name appears without spaces in DMI strings. That made it difficult to reuse the 2021 match. Also the display is larger in resolution.
Tested by the JELOS team that has been patching their own kernel for a while now and confirmed by users in the AYA NEO and ChimeraOS discord servers.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -184,6 +184,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AYANEO 2 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/48 drm: panel-orientation-quirks: Add quirk for AYA NEO Founder edition
In reply to Sasha LevinFrom: Joaquín Ignacio Aramendía <[email protected]>
[ Upstream commit d7972d735ca80a40a571bf753c138263981a5698 ]
Add quirk orientation for AYA NEO Founder. The name appears with spaces in DMI strings as other devices of the brand. The panel is the same as the NEXT and 2021 models. Those could not be reused as the former has VENDOR name as "AYANEO" without spaces and the latter has "AYADEVICE".
Tested by the JELOS team that has been patching their own kernel for a while now and confirmed by users in the AYA NEO and ChimeraOS discord servers.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -202,6 +202,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "AIR"), }, .driver_data = (void *)&lcd1080x1920_leftside_up, + }, { /* AYA NEO Founder */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYA NEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "AYA NEO Founder"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/48 drm: panel-orientation-quirks: Add quirk for AYA NEO GEEK
In reply to Sasha LevinFrom: Joaquín Ignacio Aramendía <[email protected]>
[ Upstream commit 428656feb972ca99200fc127b5aecb574efd9d3d ]
Add quirk orientation for AYA NEO GEEK. The name appears without spaces in DMI strings. The board name is completely different to the previous models making it difficult to reuse their quirks despite being the same resolution and using the same orientation.
Tested by the JELOS team that has been patching their own kernel for a while now and confirmed by users in the AYA NEO and ChimeraOS discord servers.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -208,6 +208,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "AYA NEO Founder"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO GEEK */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "GEEK"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/48 drm/bridge: it6505: Enable module autoloading
In reply to Sasha LevinFrom: Liao Chen <[email protected]>
[ Upstream commit 1e2ab24cd708b1c864ff983ee1504c0a409d2f8e ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpu/drm/bridge/ite-it6505.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ite-it6505.c +1 -0
@@ -3349,6 +3349,7 @@ static const struct of_device_id it6505_of_match[] = { { .compatible = "ite,it6505" }, { } }; +MODULE_DEVICE_TABLE (of, it6505_of_match);static struct i2c_driver it6505_i2c_driver = { .driver = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/48 drm/mcde: Enable module autoloading
In reply to Sasha LevinFrom: Liao Chen <[email protected]>
[ Upstream commit 8a16b5cdae26207ff4c22834559384ad3d7bc970 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
--- drivers/gpu/drm/mcde/mcde_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mcde/mcde_drv.c +1 -0
@@ -468,6 +468,7 @@ static const struct of_device_id mcde_of_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, mcde_of_match);static struct platform_driver mcde_driver = { .driver = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/48 drm/radeon/r600_cs: Fix possible int overflow in r600_packet3_check()
In reply to Sasha LevinFrom: Igor Artemiev <[email protected]>
[ Upstream commit a1e2da6a5072f8abe5b0feaa91a5bcd9dc544a04 ]
It is possible, although unlikely, that an integer overflow will occur when the result of radeon_get_ib_value() is shifted to the left.
Avoid it by casting one of the operands to larger data type (u64).
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/r600_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r600_cs.c +1 -1
@@ -2104,7 +2104,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p,return -EINVAL ; } - offset =radeon_get_ib_value (p, idx+1 ) <<8 ; + offset = (u64 )radeon_get_ib_value (p, idx+1 ) <<8 ;if (offset != track->vgt_strmout_bo_offset[idx_value]) {DRM_ERROR ("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n" , offset, track->vgt_strmout_bo_offset[idx_value]);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/48 drm/display: Fix building with GCC 15
In reply to Sasha LevinFrom: Brahmajit Das <[email protected]>
[ Upstream commit a500f3751d3c861be7e4463c933cf467240cca5d ]
GCC 15 enables -Werror=unterminated-string-initialization by default. This results in the following build error
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c: In function ‘is_hdmi_adaptor’:drivers/gpu/drm/display/drm_dp_dual_mode_helper.c:164:17: error: initializer-string for array of
‘char’ is too long [-Werror=unterminated-string-initialization]
164 | "DP-HDMI ADAPTOR\x04";
| ^~~~~~~~~~~~~~~~~~~~~After discussion with Ville, the fix was to increase the size of dp_dual_mode_hdmi_id array by one, so that it can accommodate the NULL line character. This should let us build the kernel with GCC 15.
--- drivers/gpu/drm/display/drm_dp_dual_mode_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/display/drm_dp_dual_mode_helper.c +2 -2
@@ -160,11 +160,11 @@ EXPORT_SYMBOL(drm_dp_dual_mode_write);static bool is_hdmi_adaptor (const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ]) { -static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN ] = +static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN +1 ] ="DP-HDMI ADAPTOR\x04" ;return memcmp (hdmi_id, dp_dual_mode_hdmi_id, -sizeof (dp_dual_mode_hdmi_id)) ==0 ; +DP_DUAL_MODE_HDMI_ID_LEN ) ==0 ; }static bool is_type1_adaptor (uint8_t adaptor_id)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/48 r8169: don't apply UDP padding quirk on RTL8126A
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 87e26448dbda4523b73a894d96f0f788506d3795 ]
Vendor drivers r8125/r8126 indicate that this quirk isn't needed any longer for RTL8126A. Mimic this in r8169.
--- drivers/net/ethernet/realtek/r8169_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +10 -4
@@ -4139,8 +4139,8 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp, {unsigned int padto =0 , len = skb->len; -if (rtl_is_8125 (tp) && len <128 +RTL_MIN_PATCH_LEN && -rtl_skb_is_udp (skb) &&skb_transport_header_was_set (skb)) { +if (len <128 +RTL_MIN_PATCH_LEN &&rtl_skb_is_udp (skb) && +skb_transport_header_was_set (skb)) {unsigned int trans_data_len =skb_tail_pointer (skb) -skb_transport_header (skb);
@@ -4164,9 +4164,15 @@ static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp,static unsigned int rtl_quirk_packet_padto (struct rtl8169_private *tp,struct sk_buff *skb) { -unsigned int padto; +unsigned int padto =0 ; - padto =rtl8125_quirk_udp_padto (tp, skb); +switch (tp->mac_version) { + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_63: + padto =rtl8125_quirk_udp_padto (tp, skb); +break ; +default : +break ; + }switch (tp->mac_version) {case RTL_GIGA_MAC_VER_34 :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/48 samples/bpf: Fix a resource leak
In reply to Sasha LevinFrom: Zhu Jun <[email protected]>
[ Upstream commit f3ef53174b23246fe9bc2bbc2542f3a3856fa1e2 ]
The opened file should be closed in show_sockopts(), otherwise resource leak will occur that this problem was discovered by reading code
--- samples/bpf/test_cgrp2_sock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
samples/bpf/test_cgrp2_sock.c +3 -1
@@ -178,8 +178,10 @@ static int show_sockopts(int family)return 1 ; } -if (get_bind_to_device (sd, name,sizeof (name)) <0 ) +if (get_bind_to_device (sd, name,sizeof (name)) <0 ) { +close (sd);return 1 ; + } mark =get_somark (sd); prio =get_priority (sd);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/48 net: fec_mpc52xx_phy: Use %pa to format resource_size_t
In reply to Sasha LevinFrom: Simon Horman <[email protected]>
[ Upstream commit 020bfdc4ed94be472138c891bde4d14241cf00fd ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c: In function 'mpc52xx_fec_mdio_probe':drivers/net/ethernet/freescale/fec_mpc52xx_phy.c:97:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
97 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c +1 -1
@@ -93,7 +93,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of) goto out_free; } -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); bus->priv = priv; bus->parent = dev;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/48 net: ethernet: fs_enet: Use %pa to format resource_size_t
In reply to Sasha LevinFrom: Simon Horman <[email protected]>
[ Upstream commit 45fe45fada261e1e83fce2a07fa22835aec1cf0a ]
The correct format string for resource_size_t is %pa which acts on the address of the variable to be formatted [1].
[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
Flagged by gcc-14 as:
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c: In function 'fs_mii_bitbang_init':drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:126:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
126 | snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
| ~^ ~~~~~~~~~
| | |
| | resource_size_t {aka long long unsigned int}
| unsigned int
| %llxNo functional change intended.
Compile tested only.
--- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +1 -1
@@ -126,7 +126,7 @@ static int fs_mii_bitbang_init(struct mii_bus *bus, struct device_node *np)* we get is an int, and the odds of multiple bitbang mdio buses * is low enough that it's not worth going too crazy. */ -snprintf (bus->id,MII_BUS_ID_SIZE ,"%x" , res.start); +snprintf (bus->id,MII_BUS_ID_SIZE ,"%pa" , &res.start); data =of_get_property (np,"fsl,mdio-pin" , &len);if (!data || len !=4 )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/48 net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
In reply to Sasha LevinFrom: Elena Salomatkina <[email protected]>
[ Upstream commit 397006ba5d918f9b74e734867e8fddbc36dc2282 ]
The subsequent calculation of port_rate = speed * 1000 * BYTES_PER_KBIT, where the BYTES_PER_KBIT is of type LL, may cause an overflow. At least when speed = SPEED_20000, the expression to the left of port_rate will be greater than INT_MAX.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- net/sched/sch_cbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cbs.c +1 -1
@@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) {struct ethtool_link_ksettings ecmd;int speed =SPEED_10 ; -int port_rate; +s64 port_rate;int err; err =__ethtool_get_link_ksettings (dev, &ecmd);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/48 af_packet: avoid erroring out after sock_init_data() in packet_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 46f2a11cb82b657fd15bab1c47821b635e03838b ]
After sock_init_data() the allocated sk object is attached to the provided sock object. On error, packet_create() frees the sk object leaving the dangling pointer in the sock object on return. Some other code may try to use this pointer and cause use-after-free.
--- net/packet/af_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/packet/af_packet.c +6 -6
@@ -3418,18 +3418,18 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,if (sock->type ==SOCK_PACKET ) sock->ops = &packet_ops_spkt; + po =pkt_sk (sk); + err =packet_alloc_pending (po); +if (err) + goto out_sk_free; +sock_init_data (sock, sk); - po =pkt_sk (sk);init_completion (&po->skb_completion); sk->sk_family =PF_PACKET ; po->num = proto; po->xmit = dev_queue_xmit; - err =packet_alloc_pending (po); -if (err) - goto out2; -packet_cached_dev_reset (po); sk->sk_destruct = packet_sock_destruct;
@@ -3462,7 +3462,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,sock_prot_inuse_add (net, &packet_proto,1 );return 0 ; -out2: +out_sk_free:sk_free (sk); out:return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/48 Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 7c4f78cdb8e7501e9f92d291a7d956591bf73be9 ]
bt_sock_alloc() allocates the sk object and attaches it to the provided sock object. On error l2cap_sock_alloc() frees the sk object, but the dangling pointer is still attached to the sock object, which may create use-after-free in other code.
--- net/bluetooth/l2cap_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/l2cap_sock.c +1 -0
@@ -1920,6 +1920,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, chan =l2cap_chan_create ();if (!chan) {sk_free (sk); + sock->sk =NULL ;return NULL ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/48 Bluetooth: RFCOMM: avoid leaving dangling sk pointer in rfcomm_sock_alloc()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 3945c799f12b8d1f49a3b48369ca494d981ac465 ]
bt_sock_alloc() attaches allocated sk object to the provided sock object. If rfcomm_dlc_alloc() fails, we release the sk object, but leave the dangling pointer in the sock object, which may cause use-after-free.
Fix this by swapping calls to bt_sock_alloc() and rfcomm_dlc_alloc().
--- net/bluetooth/rfcomm/sock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/bluetooth/rfcomm/sock.c +5 -5
@@ -274,13 +274,13 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock,struct rfcomm_dlc *d;struct sock *sk; - sk =bt_sock_alloc (net, sock, &rfcomm_proto, proto, prio, kern); -if (!sk) + d =rfcomm_dlc_alloc (prio); +if (!d)return NULL ; - d =rfcomm_dlc_alloc (prio); -if (!d) { -sk_free (sk); + sk =bt_sock_alloc (net, sock, &rfcomm_proto, proto, prio, kern); +if (!sk) { +rfcomm_dlc_free (d);return NULL ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/48 net: af_can: do not leave a dangling sk pointer in can_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 811a7ca7320c062e15d0f5b171fe6ad8592d1434 ]
On error can_create() frees the allocated sk object, but sock_init_data() has already attached it to the provided sock object. This will leave a dangling sk pointer in the sock object and may cause use-after-free later.
--- net/can/af_can.c | 1 + 1 file changed, 1 insertion(+)
net/can/af_can.c +1 -0
@@ -171,6 +171,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,/* release sk on errors */ sock_orphan (sk);sock_put (sk); + sock->sk =NULL ; } errout:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/48 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit b4fcd63f6ef79c73cafae8cf4a114def5fc3d80d ]
sock_init_data() attaches the allocated sk object to the provided sock object. If ieee802154_create() fails later, the allocated sk object is freed, but the dangling pointer remains in the provided sock object, which may allow use-after-free.
Clear the sk pointer in the sock object on error.
--- net/ieee802154/socket.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ieee802154/socket.c +7 -5
@@ -1046,19 +1046,21 @@ static int ieee802154_create(struct net *net, struct socket *sock,if (sk->sk_prot->hash) { rc = sk->sk_prot->hash (sk); -if (rc) { -sk_common_release (sk); - goto out; - } +if (rc) + goto out_sk_release; }if (sk->sk_prot->init) { rc = sk->sk_prot->init (sk);if (rc) -sk_common_release (sk); + goto out_sk_release; } out:return rc; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }static const struct net_proto_family ieee802154_family_ops = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/48 net: inet: do not leave a dangling sk pointer in inet_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 9365fa510c6f82e3aa550a09d0c5c6b44dbc78ff ]
sock_init_data() attaches the allocated sk object to the provided sock object. If inet_create() fails later, the sk object is freed, but the sock object retains the dangling pointer, which may create use-after-free later.
Clear the sk pointer in the sock object on error.
--- net/ipv4/af_inet.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv4/af_inet.c +10 -12
@@ -371,32 +371,30 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, inet->inet_sport =htons (inet->inet_num);/* Add to protocol hash chains. */ err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/48 net: inet6: do not leave a dangling sk pointer in inet6_create()
In reply to Sasha LevinFrom: Ignat Korchagin <[email protected]>
[ Upstream commit 9df99c395d0f55fb444ef39f4d6f194ca437d884 ]
sock_init_data() attaches the allocated sk pointer to the provided sock object. If inet6_create() fails later, the sk object is released, but the sock object retains the dangling sk pointer, which may cause use-after-free later.
Clear the sock sk pointer on error.
--- net/ipv6/af_inet6.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv6/af_inet6.c +10 -12
@@ -260,31 +260,29 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,*/ inet->inet_sport =htons (inet->inet_num); err = sk->sk_prot->hash (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (sk->sk_prot->init) { err = sk->sk_prot->init (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; }if (!kern) { err =BPF_CGROUP_RUN_PROG_INET_SOCK (sk); -if (err) { -sk_common_release (sk); - goto out; - } +if (err) + goto out_sk_release; } out:return err; out_rcu_unlock:rcu_read_unlock (); goto out; +out_sk_release: +sk_common_release (sk); + sock->sk =NULL ; + goto out; } static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 22/48 wifi: ath5k: add PCI ID for SX76X
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit da0474012402d4729b98799d71a54c35dc5c5de3 ]
This is in two devices made by Gigaset, SX762 and SX763.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -46,6 +46,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ + { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 23/48 wifi: ath5k: add PCI ID for Arcadyan devices
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit f3ced9bb90b0a287a1fa6184d16b0f104a78fa90 ]
Arcadyan made routers with this PCI ID containing an AR2417.
--- drivers/net/wireless/ath/ath5k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath5k/pci.c +1 -0
@@ -47,6 +47,7 @@ static const struct pci_device_id ath5k_pci_id_table[] = { { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ { PCI_VDEVICE(ATHEROS, 0xff16) }, /* Gigaset SX76[23] AR241[34]A */ + { PCI_VDEVICE(ATHEROS, 0xff1a) }, /* Arcadyan ARV45XX AR2417 */ { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ { 0 } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 24/48 drm/panel: simple: Add Microchip AC69T88A LVDS Display panel
In reply to Sasha LevinFrom: Manikandan Muralidharan <[email protected]>
[ Upstream commit 40da1463cd6879f542238b36c1148f517927c595 ]
Add support for Microchip AC69T88A 5 inch TFT LCD 800x480 Display module with LVDS interface.The panel uses the Sitronix ST7262 800x480 Display driver
--- drivers/gpu/drm/panel/panel-simple.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +28 -0
@@ -3908,6 +3908,31 @@ static const struct panel_desc yes_optoelectronics_ytc700tlag_05_201c = { .connector_type = DRM_MODE_CONNECTOR_LVDS, }; +static const struct drm_display_mode mchp_ac69t88a_mode = { + .clock =25000 , + .hdisplay =800 , + .hsync_start =800 +88 , + .hsync_end =800 +88 +5 , + .htotal =800 +88 +5 +40 , + .vdisplay =480 , + .vsync_start =480 +23 , + .vsync_end =480 +23 +5 , + .vtotal =480 +23 +5 +1 , +}; + +static const struct panel_desc mchp_ac69t88a = { + .modes = &mchp_ac69t88a_mode, + .num_modes =1 , + .bpc =8 , + .size = { + .width =108 , + .height =65 , + }, + .bus_flags =DRM_BUS_FLAG_DE_HIGH , + .bus_format =MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA , + .connector_type =DRM_MODE_CONNECTOR_LVDS , +}; +static const struct drm_display_mode arm_rtsm_mode[] = { { .clock =65000 ,
@@ -4325,6 +4350,9 @@ static const struct of_device_id platform_of_match[] = { }, { .compatible = "yes-optoelectronics,ytc700tlag-05-201c", .data = &yes_optoelectronics_ytc700tlag_05_201c, + }, { + .compatible = "microchip,ac69t88a", + .data = &mchp_ac69t88a, }, { /* Must be the last entry */ .compatible = "panel-dpi",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 25/48 net: sfp: change quirks for Alcatel Lucent G-010S-P
In reply to Sasha LevinFrom: Shengyu Qu <[email protected]>
[ Upstream commit 90cb5f1776ba371478e2b08fbf7018c7bd781a8d ]
Seems Alcatel Lucent G-010S-P also have the same problem that it uses TX_FAULT pin for SOC uart. So apply sfp_fixup_ignore_tx_fault to it.
--- drivers/net/phy/sfp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/sfp.c +2 -1
@@ -386,7 +386,8 @@ static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,static const struct sfp_quirk sfp_quirks[] = {// Alcatel Lucent G-010S-P can operate at 2500base-X, but incorrectly // report 2500MBd NRZ in their EEPROM -SFP_QUIRK_M ("ALCATELLUCENT" ,"G010SP" , sfp_quirk_2500basex), +SFP_QUIRK ("ALCATELLUCENT" ,"G010SP" , sfp_quirk_2500basex, + sfp_fixup_ignore_tx_fault),// Alcatel Lucent G-010S-A can operate at 2500base-X, but report 3.2GBd // NRZ in their EEPROM
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 26/48 drm/sched: memset() 'job' in drm_sched_job_init()
In reply to Sasha LevinFrom: Philipp Stanner <[email protected]>
[ Upstream commit 2320c9e6a768d135c7b0039995182bb1a4e4fd22 ]
drm_sched_job_init() has no control over how users allocate struct drm_sched_job. Unfortunately, the function can also not set some struct members such as job->sched.
This could theoretically lead to UB by users dereferencing the struct's pointer members too early.
It is easier to debug such issues if these pointers are initialized to NULL, so dereferencing them causes a NULL pointer exception. Accordingly, drm_sched_entity_init() does precisely that and initializes its struct with memset().
Initialize parameter "job" to 0 in drm_sched_job_init().
--- drivers/gpu/drm/scheduler/sched_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/scheduler/sched_main.c +8 -0
@@ -595,6 +595,14 @@ int drm_sched_job_init(struct drm_sched_job *job,if (!entity->rq)return -ENOENT ; +/* +* We don't know for sure how the user has allocated. Thus, zero the +* struct so that unallowed (i.e., too early) usage of pointers that +* this function does not set is guaranteed to lead to a NULL pointer +* exception instead of UB. +*/ +memset (job,0 ,sizeof (*job)); + job->entity = entity; job->s_fence =drm_sched_fence_alloc (entity, owner);if (!job->s_fence)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 27/48 drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts for vega20_ih
In reply to Sasha LevinFrom: Victor Lu <[email protected]>
[ Upstream commit 8b22f048331dfd45fdfbf0efdfb1d43deff7518d ]
Port this change to vega20_ih.c:
commit afbf7955ff01 ("drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts")
Original commit message:
"Why:
Setting IH_RB_WPTR register to 0 will not clear the RB_OVERFLOW bit if RB_ENABLE is not set.
How to fix:
Set WPTR_OVERFLOW_CLEAR bit after RB_ENABLE bit is set. The RB_ENABLE bit is required to be set, together with WPTR_OVERFLOW_ENABLE bit so that setting WPTR_OVERFLOW_CLEAR bit would clear the RB_OVERFLOW."
--- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/vega20_ih.c +27 -0
@@ -109,6 +109,33 @@ static int vega20_ih_toggle_ring_interrupts(struct amdgpu_device *adev, tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,RB_ENABLE , (enable ?1 :0 )); tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,RB_GPU_TS_ENABLE ,1 ); +if (enable) { +/* Unset the CLEAR_OVERFLOW bit to make sure the next step +* is switching the bit from 0 to 1 +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); +if (amdgpu_sriov_vf (adev) &&amdgpu_sriov_reg_indirect_ih (adev)) { +if (psp_reg_program (&adev->psp, ih_regs->psp_reg_id, tmp)) +return -ETIMEDOUT ; + }else { +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + } + +/* Clear RB_OVERFLOW bit */ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,1 ); +if (amdgpu_sriov_vf (adev) &&amdgpu_sriov_reg_indirect_ih (adev)) { +if (psp_reg_program (&adev->psp, ih_regs->psp_reg_id, tmp)) +return -ETIMEDOUT ; + }else { +WREG32_NO_KIQ (ih_regs->ih_rb_cntl, tmp); + } + +/* Unset the CLEAR_OVERFLOW bit immediately so new overflows +* can be detected. +*/ + tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,WPTR_OVERFLOW_CLEAR ,0 ); + } +/* enable_intr field is only valid in ring0 */ if (ih == &adev->irq.ih) tmp =REG_SET_FIELD (tmp,IH_RB_CNTL ,ENABLE_INTR , (enable ?1 :0 ));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 28/48 drm/amdgpu: Dereference the ATCS ACPI buffer
In reply to Sasha LevinFrom: Prike Liang <[email protected]>
[ Upstream commit 32e7ee293ff476c67b51be006e986021967bc525 ]
Need to dereference the atcs acpi buffer after the method is executed, otherwise it will result in a memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -0
@@ -758,6 +758,7 @@ int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,return -EIO ; } +kfree (info);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 29/48 drm/amdgpu: refine error handling in amdgpu_ttm_tt_pin_userptr
In reply to Sasha LevinFrom: Lang Yu <[email protected]>
[ Upstream commit 46186667f98fb7158c98f4ff5da62c427761ffcd ]
Free sg table when dma_map_sgtable() failed to avoid memory leak.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -1
@@ -776,7 +776,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,/* Map SG to device */ r =dma_map_sgtable (adev->dev, ttm->sg, direction,0 );if (r) - goto release_sg; + goto release_sg_table;/* convert SG to linear array of pages and dma addresses */ drm_prime_sg_to_dma_addr_array(ttm->sg, gtt->ttm.dma_address,
@@ -784,6 +784,8 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev,return 0 ; +release_sg_table: +sg_free_table (ttm->sg); release_sg:kfree (ttm->sg); ttm->sg =NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 30/48 dma-debug: fix a possible deadlock on radix_lock
In reply to Sasha LevinFrom: Levi Yun <[email protected]>
[ Upstream commit 7543c3e3b9b88212fcd0aaf5cab5588797bdc7de ]
radix_lock() shouldn't be held while holding dma_hash_entry[idx].lock otherwise, there's a possible deadlock scenario when
dma debug API is called holding rq_lock():
CPU0 CPU1 CPU2dma_free_attrs()check_unmap() add_dma_entry() __schedule() //out
(A) rq_lock()
get_hash_bucket()
(A) dma_entry_hash
check_sync()
(A) radix_lock() (W) dma_entry_hashdma_entry_free()
(W) radix_lock()
// CPU2's one
(W) rq_lock()CPU1 situation can happen when it extending radix tree and it tries to wake up kswapd via wake_all_kswapd().
CPU2 situation can happen while perf_event_task_sched_out() (i.e. dma sync operation is called while deleting perf_event using
etm and etr tmc which are Arm Coresight hwtracing driver backends).
To remove this possible situation, call dma_entry_free() after put_hash_bucket() in check_unmap().
--- kernel/dma/debug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/dma/debug.c +6 -2
@@ -1044,9 +1044,13 @@ static void check_unmap(struct dma_debug_entry *ref) }hash_bucket_del (entry); -dma_entry_free (entry); -put_hash_bucket (bucket, flags); + +/* +* Free the entry outside of bucket_lock to avoid ABBA deadlocks +* between that and radix_lock. +*/ +dma_entry_free (entry); } static void check_for_stack(struct device *dev,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 31/48 jfs: array-index-out-of-bounds fix in dtReadFirst
In reply to Sasha LevinFrom: Ghanshyam Agrawal <[email protected]>
[ Upstream commit ca84a2c9be482836b86d780244f0357e5a778c46 ]
The value of stbl can be sometimes out of bounds due to a bad filesystem. Added a check with appopriate return of error code in that case.
--- fs/jfs/jfs_dtree.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/jfs/jfs_dtree.c +7 -0
@@ -3086,6 +3086,13 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)/* get the leftmost entry */ stbl =DT_GETSTBL (p); + +if (stbl[0 ] <0 || stbl[0 ] >127 ) { +DT_PUTPAGE (mp); +jfs_error (ip->i_sb,"stbl[0] out of bound\n" ); +return -EIO ; + } + xd = (pxd_t *) & p->slot[stbl[0 ]];/* get the child page block address */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 32/48 jfs: fix shift-out-of-bounds in dbSplit
In reply to Sasha LevinFrom: Ghanshyam Agrawal <[email protected]>
[ Upstream commit a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ]
When dmt_budmin is less than zero, it causes errors
in the later stages. Added a check to return an error beforehand in dbAllocCtl itself.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -1820,6 +1820,9 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)return -EIO ; dp = (struct dmap *) mp->data; +if (dp->tree.budmin <0 ) +return -EIO ; +/* try to allocate the blocks. */ rc =dbAllocDmapLev (bmp, dp, (int ) nblocks, l2nb, results);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 33/48 jfs: fix array-index-out-of-bounds in jfs_readdir
In reply to Sasha LevinFrom: Ghanshyam Agrawal <[email protected]>
[ Upstream commit 839f102efb168f02dfdd46717b7c6dddb26b015e ]
The stbl might contain some invalid values. Added a check to return error code in that case.
--- fs/jfs/jfs_dtree.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/jfs/jfs_dtree.c +8 -0
@@ -2891,6 +2891,14 @@ int jfs_readdir(struct file *file, struct dir_context *ctx) stbl =DT_GETSTBL (p);for (i = index; i < p->header.nextindex; i++) { +if (stbl[i] <0 || stbl[i] >127 ) { +jfs_err ("JFS: Invalid stbl[%d] = %d for inode %ld, block = %lld" , + i, stbl[i], (long )ip->i_ino, (long long )bn); +free_page (dirent_buf); +DT_PUTPAGE (mp); +return -EIO ; + } + d = (struct ldtentry *) & p->slot[stbl[i]]; if (((long) jfs_dirent + d->namlen + 1) >
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 34/48 jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree
In reply to Sasha LevinFrom: Nihar Chaithanya <[email protected]>
[ Upstream commit a174706ba4dad895c40b1d2277bade16dfacdcd9 ]
When the value of lp is 0 at the beginning of the for loop, it will become negative in the next assignment and we should bail out.
--- fs/jfs/jfs_dmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dmap.c +3 -0
@@ -2891,6 +2891,9 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)/* bubble the new value up the tree as required. */ for (k =0 ; k <le32_to_cpu (tp->dmt_height); k++) { +if (lp ==0 ) +break ; +/* get the index of the first leaf of the 4 leaf * group containing the specified leaf (leafno). */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 35/48 net: enetc: remove ERR050089 workaround for i.MX95
In reply to Sasha LevinFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 86831a3f4cd4c924dd78cf0d6e4d73acacfe1b11 ]
The ERR050089 workaround causes performance degradation and potential functional issues (e.g., RCU stalls) under certain workloads. Since new SoCs like i.MX95 do not require this workaround, use a static key to compile out enetc_lock_mdio() and enetc_unlock_mdio() at runtime, improving performance and avoiding unnecessary logic.
--- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 28 +++++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_hw.h +24 -10
@@ -372,18 +372,22 @@ struct enetc_hw {*/ extern rwlock_t enetc_mdio_lock; +DECLARE_STATIC_KEY_FALSE (enetc_has_err050089); +/* use this locking primitive only on the fast datapath to * group together multiple non-MDIO register accesses to * minimize the overhead of the lock */ static inline void enetc_lock_mdio (void ) { -read_lock (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +read_lock (&enetc_mdio_lock); }static inline void enetc_unlock_mdio (void ) { -read_unlock (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +read_unlock (&enetc_mdio_lock); }/* use these accessors only on the fast datapath under
@@ -392,14 +396,16 @@ static inline void enetc_unlock_mdio(void)*/ static inline u32 enetc_rd_reg_hot (void __iomem *reg) { -lockdep_assert_held (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +lockdep_assert_held (&enetc_mdio_lock);return ioread32 (reg); }static inline void enetc_wr_reg_hot (void __iomem *reg,u32 val) { -lockdep_assert_held (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +lockdep_assert_held (&enetc_mdio_lock);iowrite32 (val, reg); }
@@ -428,9 +434,13 @@ static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *reg)unsigned long flags;u32 val; -write_lock_irqsave (&enetc_mdio_lock, flags); - val =ioread32 (reg); -write_unlock_irqrestore (&enetc_mdio_lock, flags); +if (static_branch_unlikely (&enetc_has_err050089)) { +write_lock_irqsave (&enetc_mdio_lock, flags); + val =ioread32 (reg); +write_unlock_irqrestore (&enetc_mdio_lock, flags); + }else { + val =ioread32 (reg); + }return val; }
@@ -439,9 +449,13 @@ static inline void _enetc_wr_mdio_reg_wa(void __iomem *reg, u32 val) {unsigned long flags; -write_lock_irqsave (&enetc_mdio_lock, flags); -iowrite32 (val, reg); -write_unlock_irqrestore (&enetc_mdio_lock, flags); +if (static_branch_unlikely (&enetc_has_err050089)) { +write_lock_irqsave (&enetc_mdio_lock, flags); +iowrite32 (val, reg); +write_unlock_irqrestore (&enetc_mdio_lock, flags); + }else { +iowrite32 (val, reg); + } }#ifdef ioread64
drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +28 -0
@@ -9,6 +9,28 @@#define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus"#define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" +DEFINE_STATIC_KEY_FALSE (enetc_has_err050089); +EXPORT_SYMBOL_GPL (enetc_has_err050089); + +static void enetc_emdio_enable_err050089 (struct pci_dev *pdev) +{ +if (pdev->vendor ==PCI_VENDOR_ID_FREESCALE && + pdev->device ==ENETC_MDIO_DEV_ID ) { +static_branch_inc (&enetc_has_err050089); +dev_info (&pdev->dev,"Enabled ERR050089 workaround\n" ); + } +} + +static void enetc_emdio_disable_err050089 (struct pci_dev *pdev) +{ +if (pdev->vendor ==PCI_VENDOR_ID_FREESCALE && + pdev->device ==ENETC_MDIO_DEV_ID ) { +static_branch_dec (&enetc_has_err050089); +if (!static_key_enabled (&enetc_has_err050089.key)) +dev_info (&pdev->dev,"Disabled ERR050089 workaround\n" ); + } +} +static int enetc_pci_mdio_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -60,6 +82,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } +enetc_emdio_enable_err050089 (pdev); + err =of_mdiobus_register (bus, dev->of_node);if (err) goto err_mdiobus_reg;
@@ -69,6 +93,7 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev,return 0 ; err_mdiobus_reg: +enetc_emdio_disable_err050089 (pdev);pci_release_region (pdev,0 ); err_pci_mem_reg:pci_disable_device (pdev);
@@ -86,6 +111,9 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev)struct enetc_mdio_priv *mdio_priv;mdiobus_unregister (bus); + +enetc_emdio_disable_err050089 (pdev); + mdio_priv = bus->priv;iounmap (mdio_priv->hw->port);pci_release_region (pdev,0 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 36/48 net: enetc: add i.MX95 EMDIO support
In reply to Sasha LevinFrom: Wei Fang <[email protected]>
[ Upstream commit a52201fb9caa9b33b4d881725d1ec733438b07f2 ]
The verdor ID and device ID of i.MX95 EMDIO are different from LS1028A EMDIO, so add new vendor ID and device ID to pci_device_id table to support i.MX95 EMDIO.
--- drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +3 -0
@@ -4,6 +4,8 @@#include <linux/of_mdio.h> #include "enetc_pf.h" +#define NETC_EMDIO_VEN_ID 0x1131 +#define NETC_EMDIO_DEV_ID 0xee00#define ENETC_MDIO_DEV_ID 0xee01#define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO"#define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus"
@@ -122,6 +124,7 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev)static const struct pci_device_id enetc_pci_mdio_id_table[] = { {PCI_DEVICE (PCI_VENDOR_ID_FREESCALE ,ENETC_MDIO_DEV_ID ) }, + {PCI_DEVICE (NETC_EMDIO_VEN_ID ,NETC_EMDIO_DEV_ID ) }, {0 , }/* End of table. */ };MODULE_DEVICE_TABLE (pci, enetc_pci_mdio_id_table);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 37/48 drm/amdgpu: skip amdgpu_device_cache_pci_state under sriov
In reply to Sasha LevinFrom: Victor Zhao <[email protected]>
[ Upstream commit afe260df55ac280cd56306248cb6d8a6b0db095c ]
Under sriov, host driver will save and restore vf pci cfg space during reset. And during device init, under sriov, pci_restore_state happens after fullaccess released, and it can have race condition with mmio protection enable from host side leading to missing interrupts.
So skip amdgpu_device_cache_pci_state for sriov.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -6013,6 +6013,9 @@ bool amdgpu_device_cache_pci_state(struct pci_dev *pdev)struct amdgpu_device *adev =drm_to_adev (dev);int r; +if (amdgpu_sriov_vf (adev)) +return false; + r =pci_save_state (pdev);if (!r) {kfree (adev->pci_state);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 38/48 ALSA: usb-audio: Make mic volume workarounds globally applicable
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit d6e6b9218ced5249b9136833ef5ec3f554ec7fde ]
It seems that many webcams have buggy firmware and don't expose the mic capture volume with the proper resolution. We have workarounds in mixer.c, but judging from the numbers, those can be better managed as global quirk flags.
--- sound/usb/mixer.c | 58 ++++++++++++-------------------------------- sound/usb/quirks.c | 31 +++++++++++++++++++---- sound/usb/usbaudio.h | 4 +++ 3 files changed, 45 insertions(+), 48 deletions(-)
sound/usb/mixer.c +15 -43
@@ -1084,6 +1084,21 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, struct snd_kcontrol *kctl) {struct snd_usb_audio *chip = cval->head.mixer->chip; + +if (chip->quirk_flags &QUIRK_FLAG_MIC_RES_384 ) { +if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { +usb_audio_info (chip, +"set resolution quirk: cval->res = 384\n" ); + cval->res =384 ; + } + }else if (chip->quirk_flags &QUIRK_FLAG_MIC_RES_16 ) { +if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { +usb_audio_info (chip, +"set resolution quirk: cval->res = 16\n" ); + cval->res =16 ; + } + } +switch (chip->usb_id) {case USB_ID (0x0763 ,0x2030 ):/* M-Audio Fast Track C400 */ case USB_ID (0x0763 ,0x2031 ):/* M-Audio Fast Track C600 */
@@ -1168,27 +1183,6 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, }break ; -case USB_ID (0x046d ,0x0807 ):/* Logitech Webcam C500 */ -case USB_ID (0x046d ,0x0808 ): -case USB_ID (0x046d ,0x0809 ): -case USB_ID (0x046d ,0x0819 ):/* Logitech Webcam C210 */ -case USB_ID (0x046d ,0x081b ):/* HD Webcam c310 */ -case USB_ID (0x046d ,0x081d ):/* HD Webcam c510 */ -case USB_ID (0x046d ,0x0825 ):/* HD Webcam c270 */ -case USB_ID (0x046d ,0x0826 ):/* HD Webcam c525 */ -case USB_ID (0x046d ,0x08ca ):/* Logitech Quickcam Fusion */ -case USB_ID (0x046d ,0x0991 ): -case USB_ID (0x046d ,0x09a2 ):/* QuickCam Communicate Deluxe/S7500 */ -/* Most audio usb devices lie about volume resolution. -* Most Logitech webcams have res = 384. -* Probably there is some logitech magic behind this number --fishor -*/ -if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { -usb_audio_info (chip, -"set resolution quirk: cval->res = 384\n" ); - cval->res =384 ; - } -break ;case USB_ID (0x0495 ,0x3042 ):/* ESS Technology Asus USB DAC */ if ((strstr (kctl->id.name,"Playback Volume" ) !=NULL ) ||strstr (kctl->id.name,"Capture Volume" ) !=NULL ) {
@@ -1197,28 +1191,6 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, cval->res =1 ; }break ; -case USB_ID (0x1224 ,0x2a25 ):/* Jieli Technology USB PHY 2.0 */ -if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { -usb_audio_info (chip, -"set resolution quirk: cval->res = 16\n" ); - cval->res =16 ; - } -break ; -case USB_ID (0x1bcf ,0x2283 ):/* NexiGo N930AF FHD Webcam */ -case USB_ID (0x03f0 ,0x654a ):/* HP 320 FHD Webcam */ -if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { -usb_audio_info (chip, -"set resolution quirk: cval->res = 16\n" ); - cval->res =16 ; - } -break ; -case USB_ID (0x1bcf ,0x2281 ):/* HD Webcam */ -if (!strcmp (kctl->id.name,"Mic Capture Volume" )) { -usb_audio_info (chip, -"set resolution quirk: cval->res = 16\n" ); - cval->res =16 ; - } -break ; } }
sound/usb/quirks.c +26 -5
@@ -2015,7 +2015,7 @@ struct usb_audio_quirk_flags_table {static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {/* Device matches */ DEVICE_FLG (0x03f0 ,0x654a ,/* HP 320 FHD Webcam */ -QUIRK_FLAG_GET_SAMPLE_RATE ), +QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ),DEVICE_FLG (0x041e ,0x3000 ,/* Creative SB Extigy */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x041e, 0x4080, /* Creative Live Cam VF0610 */
@@ -2023,10 +2023,31 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x045e ,0x083c ,/* MS USB Link headset */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_CTL_MSG_DELAY |QUIRK_FLAG_DISABLE_AUTOSUSPEND ), +DEVICE_FLG (0x046d ,0x0807 ,/* Logitech Webcam C500 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x0808 ,/* Logitech Webcam C600 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x0809 , +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x0819 ,/* Logitech Webcam C210 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x081b ,/* HD Webcam c310 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x081d ,/* HD Webcam c510 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x0825 ,/* HD Webcam c270 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x0826 ,/* HD Webcam c525 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ),DEVICE_FLG (0x046d ,0x084c ,/* Logitech ConferenceCam Connect */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_CTL_MSG_DELAY_1M ), +DEVICE_FLG (0x046d ,0x08ca ,/* Logitech Quickcam Fusion */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ),DEVICE_FLG (0x046d ,0x0991 ,/* Logitech QuickCam Pro */ -QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_IGNORE_CTL_ERROR ), +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_IGNORE_CTL_ERROR | +QUIRK_FLAG_MIC_RES_384 ), +DEVICE_FLG (0x046d ,0x09a2 ,/* QuickCam Communicate Deluxe/S7500 */ +QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_MIC_RES_384 ),DEVICE_FLG (0x046d ,0x09a4 ,/* Logitech QuickCam E 3500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */
@@ -2094,7 +2115,7 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x0fd9 ,0x0008 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ),DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ -QUIRK_FLAG_GET_SAMPLE_RATE ), +QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ),DEVICE_FLG (0x1395 ,0x740a ,/* Sennheiser DECT */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x1397, 0x0507, /* Behringer UMC202HD */
@@ -2132,9 +2153,9 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {DEVICE_FLG (0x19f7 ,0x0035 ,/* RODE NT-USB+ */ QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1bcf ,0x2281 ,/* HD Webcam */ -QUIRK_FLAG_GET_SAMPLE_RATE ), +QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ),DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ -QUIRK_FLAG_GET_SAMPLE_RATE ), +QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ),DEVICE_FLG (0x2040 ,0x7200 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
sound/usb/usbaudio.h +4 -0
@@ -178,6 +178,8 @@ extern bool snd_usb_skip_validation;* QUIRK_FLAG_FIXED_RATE * Do not set PCM rate (frequency) when only one rate is available * for the given endpoint. +* QUIRK_FLAG_MIC_RES_16 and QUIRK_FLAG_MIC_RES_384 +* Set the fixed resolution for Mic Capture Volume (mostly for webcams) */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -202,5 +204,7 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19)#define QUIRK_FLAG_FORCE_IFACE_RESET (1U << 20)#define QUIRK_FLAG_FIXED_RATE (1U << 21) +#define QUIRK_FLAG_MIC_RES_16 (1U << 22) +#define QUIRK_FLAG_MIC_RES_384 (1U << 23)#endif /* __USBAUDIO_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 39/48 drm/amdgpu: set the right AMDGPU sg segment limitation
In reply to Sasha LevinFrom: Prike Liang <[email protected]>
[ Upstream commit e2e97435783979124ba92d6870415c57ecfef6a5 ]
The driver needs to set the correct max_segment_size; otherwise debug_dma_map_sg() will complain about the over-mapping of the AMDGPU sg length as following:
WARNING: CPU: 6 PID: 1964 at kernel/dma/debug.c:1178 debug_dma_map_sg+0x2dc/0x370 [ 364.049444] Modules linked in: veth amdgpu(OE) amdxcp drm_exec gpu_sched drm_buddy drm_ttm_helper ttm(OE) drm_suballoc_helper drm_display_helper drm_kms_helper i2c_algo_bit rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs lockd grace netfs xt_conntrack xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo iptable_nat xt_addrtype iptable_filter br_netfilter nvme_fabrics overlay nfnetlink_cttimeout nfnetlink openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c bridge stp llc amd_atl intel_rapl_msr intel_rapl_common sunrpc sch_fq_codel snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg edac_mce_amd binfmt_misc snd_hda_codec snd_pci_acp6x snd_hda_core snd_acp_config snd_hwdep snd_soc_acpi kvm_amd snd_pcm kvm snd_seq_midi snd_seq_midi_event crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 snd_rawmidi sha256_ssse3 sha1_ssse3 aesni_intel snd_seq nls_iso8859_1 crypto_simd snd_seq_device cryptd snd_timer rapl input_leds snd [ 364.049532] ipmi_devintf wmi_bmof ccp serio_raw k10temp sp5100_tco soundcore ipmi_msghandler cm32181 industrialio mac_hid msr parport_pc ppdev lp parport drm efi_pstore ip_tables x_tables pci_stub crc32_pclmul nvme ahci libahci i2c_piix4 r8169 nvme_core i2c_designware_pci realtek i2c_ccgx_ucsi video wmi hid_generic cdc_ether usbnet usbhid hid r8152 mii [ 364.049576] CPU: 6 PID: 1964 Comm: rocminfo Tainted: G OE 6.10.0-custom #492 [ 364.049579] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS RMJ1009A 06/13/2021 [ 364.049582] RIP: 0010:debug_dma_map_sg+0x2dc/0x370 [ 364.049585] Code: 89 4d b8 e8 36 b1 86 00 8b 4d b8 48 8b 55 b0 44 8b 45 a8 4c 8b 4d a0 48 89 c6 48 c7 c7 00 4b 74 bc 4c 89 4d b8 e8 b4 73 f3 ff <0f> 0b 4c 8b 4d b8 8b 15 c8 2c b8 01 85 d2 0f 85 ee fd ff ff 8b 05 [ 364.049588] RSP: 0018:ffff9ca600b57ac0 EFLAGS: 00010286 [ 364.049590] RAX: 0000000000000000 RBX: ffff88b7c132b0c8 RCX: 0000000000000027 [ 364.049592] RDX: ffff88bb0f521688 RSI: 0000000000000001 RDI: ffff88bb0f521680 [ 364.049594] RBP: ffff9ca600b57b20 R08: 000000000000006f R09: ffff9ca600b57930 [ 364.049596] R10: ffff9ca600b57928 R11: ffffffffbcb46328 R12: 0000000000000000 [ 364.049597] R13: 0000000000000001 R14: ffff88b7c19c0700 R15: ffff88b7c9059800 [ 364.049599] FS: 00007fb2d3516e80(0000) GS:ffff88bb0f500000(0000) knlGS:0000000000000000 [ 364.049601] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 364.049603] CR2: 000055610bd03598 CR3: 00000001049f6000 CR4: 0000000000350ef0 [ 364.049605] Call Trace: [ 364.049607] <TASK> [ 364.049609] ? show_regs+0x6d/0x80 [ 364.049614] ? __warn+0x8c/0x140 [ 364.049618] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049621] ? report_bug+0x193/0x1a0 [ 364.049627] ? handle_bug+0x46/0x80 [ 364.049631] ? exc_invalid_op+0x1d/0x80 [ 364.049635] ? asm_exc_invalid_op+0x1f/0x30 [ 364.049642] ? debug_dma_map_sg+0x2dc/0x370 [ 364.049647] __dma_map_sg_attrs+0x90/0xe0 [ 364.049651] dma_map_sgtable+0x25/0x40 [ 364.049654] amdgpu_bo_move+0x59a/0x850 [amdgpu] [ 364.049935] ? srso_return_thunk+0x5/0x5f [ 364.049939] ? amdgpu_ttm_tt_populate+0x5d/0xc0 [amdgpu] [ 364.050095] ttm_bo_handle_move_mem+0xc3/0x180 [ttm] [ 364.050103] ttm_bo_validate+0xc1/0x160 [ttm] [ 364.050108] ? amdgpu_ttm_tt_get_user_pages+0xe5/0x1b0 [amdgpu] [ 364.050263] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0xa12/0xc90 [amdgpu] [ 364.050473] kfd_ioctl_alloc_memory_of_gpu+0x16b/0x3b0 [amdgpu] [ 364.050680] kfd_ioctl+0x3c2/0x530 [amdgpu] [ 364.050866] ? __pfx_kfd_ioctl_alloc_memory_of_gpu+0x10/0x10 [amdgpu] [ 364.051054] ? srso_return_thunk+0x5/0x5f [ 364.051057] ? tomoyo_file_ioctl+0x20/0x30 [ 364.051063] __x64_sys_ioctl+0x9c/0xd0 [ 364.051068] x64_sys_call+0x1219/0x20d0 [ 364.051073] do_syscall_64+0x51/0x120 [ 364.051077] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 364.051081] RIP: 0033:0x7fb2d2f1a94f
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -1732,6 +1732,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)mutex_init (&adev->mman.gtt_window_lock); +dma_set_max_seg_size (adev->dev,UINT_MAX );/* No others user of address space so set it to 0 */ r = ttm_device_init(&adev->mman.bdev, &amdgpu_bo_driver, adev->dev, adev_to_drm(adev)->anon_inode->i_mapping,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 40/48 wifi: ipw2x00: libipw_rx_any(): fix bad alignment
In reply to Sasha LevinFrom: Jiapeng Chong <[email protected]>
[ Upstream commit 4fa4f049dc0d9741b16c96bcbf0108c85368a2b9 ]
This patch fixes incorrect code alignment.
./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.
--- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +4 -4
@@ -870,8 +870,8 @@ void libipw_rx_any(struct libipw_device *ieee,switch (ieee->iw_mode) {case IW_MODE_ADHOC :/* our BSS and not from/to DS */ -if (ether_addr_equal (hdr->addr3, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 ) { +if (ether_addr_equal (hdr->addr3, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
@@ -885,8 +885,8 @@ void libipw_rx_any(struct libipw_device *ieee,break ;case IW_MODE_INFRA :/* our BSS (== from our AP) and from DS */ -if (ether_addr_equal (hdr->addr2, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS ) { +if (ether_addr_equal (hdr->addr2, ieee->bssid) && + ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS )) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 41/48 wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
In reply to Sasha LevinFrom: Norbert van Bolhuis <[email protected]>
[ Upstream commit 857282b819cbaa0675aaab1e7542e2c0579f52d7 ]
This patch fixes a NULL pointer dereference bug in brcmfmac that occurs when a high 'sd_sgentry_align' value applies (e.g. 512) and a lot of queued SKBs are sent from the pkt queue.
The problem is the number of entries in the pre-allocated sgtable, it is nents = max(rxglom_size, txglom_size) + max(rxglom_size, txglom_size) >> 4 + 1. Given the default [rt]xglom_size=32 it's actually 35 which is too small. Worst case, the pkt queue can end up with 64 SKBs. This occurs when a new SKB is added for each original SKB if tailroom isn't enough to hold tail_pad. At least one sg entry is needed for each SKB. So, eventually the "skb_queue_walk loop" in brcmf_sdiod_sglist_rw may run out of sg entries. This makes sg_next return NULL and this causes the oops.
The patch sets nents to max(rxglom_size, txglom_size) * 2 to be able handle the worst-case.
Btw. this requires only 64-35=29 * 16 (or 20 if CONFIG_NEED_SG_DMA_LENGTH) = 464 additional bytes of memory.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -770,7 +770,7 @@ void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev) nents =max_t (uint,BRCMF_DEFAULT_RXGLOM_SIZE , sdiodev->settings->bus.sdio.txglomsz); - nents += (nents >>4 ) +1 ; + nents *=2 ;WARN_ON (nents > sdiodev->max_segment_count);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 42/48 dsa: qca8k: Use nested lock to avoid splat
In reply to Sasha LevinFrom: Andrew Lunn <[email protected]>
[ Upstream commit 078e0d596f7b5952dad8662ace8f20ed2165e2ce ]
qca8k_phy_eth_command() is used to probe the child MDIO bus while the parent MDIO is locked. This causes lockdep splat, reporting a possible deadlock. It is not an actually deadlock, because different locks are used. By making use of mutex_lock_nested() we can avoid this false positive.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/qca/qca8k-8xxx.c +1 -1
@@ -551,7 +551,7 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy,* We therefore need to lock the MDIO bus onto which the switch is * connected. */ -mutex_lock (&priv->bus->mdio_lock); +mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED );/* Actually start the request: * 1. Send mdio master packet
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 43/48 Bluetooth: btusb: Add RTL8852BE device 0489:e123 to device tables
In reply to Sasha LevinFrom: Hilda Wu <[email protected]>
[ Upstream commit 69b84ffce260ff13826dc10aeb3c3e5c2288a552 ]
Add the support ID 0489:e123 to usb_device_id table for Realtek RTL8852B chip.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=04 Dev#= 7 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e123 Rev= 0.00 S: Manufacturer=Realtek S: Product=Bluetooth Radio S: SerialNumber=00e04c000001 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -549,6 +549,8 @@ static const struct usb_device_id blacklist_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3591), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe123), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe125), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 44/48 Bluetooth: hci_core: Fix not checking skb length on hci_acldata_packet
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 3fe288a8214e7dd784d1f9b7c9e448244d316b47 ]
This fixes not checking if skb really contains an ACL header otherwise the code may attempt to access some uninitilized/invalid memory past the valid skb->data.
--- net/bluetooth/hci_core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/bluetooth/hci_core.c +9 -4
@@ -3829,18 +3829,22 @@ static void hci_tx_work(struct work_struct *work)/* ACL data packet */ static void hci_acldata_packet (struct hci_dev *hdev,struct sk_buff *skb) { -struct hci_acl_hdr *hdr = (void *) skb->data; +struct hci_acl_hdr *hdr;struct hci_conn *conn;__u16 handle, flags; -skb_pull (skb,HCI_ACL_HDR_SIZE ); + hdr =skb_pull_data (skb,sizeof (*hdr)); +if (!hdr) { +bt_dev_err (hdev,"ACL packet too small" ); + goto drop; + } handle =__le16_to_cpu (hdr->handle); flags =hci_flags (handle); handle =hci_handle (handle); -BT_DBG ("%s len %d handle 0x%4.4x flags 0x%4.4x" , hdev->name, skb->len, - handle, flags); +bt_dev_dbg (hdev,"len %d handle 0x%4.4x flags 0x%4.4x" , skb->len, + handle, flags); hdev->stat.acl_rx++;
@@ -3859,6 +3863,7 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) handle); } +drop:kfree_skb (skb); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 45/48 ASoC: hdmi-codec: reorder channel allocation list
In reply to Sasha LevinFrom: Jonas Karlman <[email protected]>
[ Upstream commit 82ff5abc2edcfba0c0f1a1be807795e2876f46e9 ]
The ordering in hdmi_codec_get_ch_alloc_table_idx() results in wrong channel allocation for a number of cases, e.g. when ELD reports FL|FR|LFE|FC|RL|RR or FL|FR|LFE|FC|RL|RR|RC|RLC|RRC:
ca_id 0x01 with speaker mask FL|FR|LFE is selected instead of ca_id 0x03 with speaker mask FL|FR|LFE|FC for 4 channels
and
ca_id 0x04 with speaker mask FL|FR|RC gets selected instead of ca_id 0x0b with speaker mask FL|FR|LFE|FC|RL|RR for 6 channels
Fix this by reordering the channel allocation list with most specific speaker masks at the top.
--- sound/soc/codecs/hdmi-codec.c | 140 +++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 63 deletions(-)
sound/soc/codecs/hdmi-codec.c +77 -63
@@ -184,84 +184,97 @@ static const struct snd_pcm_chmap_elem hdmi_codec_8ch_chmaps[] = {/* * hdmi_codec_channel_alloc: speaker configuration available for CEA * -* This is an ordered list that must match with hdmi_codec_8ch_chmaps struct +* This is an ordered list where ca_id must exist in hdmi_codec_8ch_chmaps * The preceding ones have better chances to be selected by * hdmi_codec_get_ch_alloc_table_idx(). */ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = { { .ca_id =0x00 , .n_ch =2 , - .mask =FL |FR }, -/* 2.1 */ - { .ca_id =0x01 , .n_ch =4 , - .mask =FL |FR |LFE }, -/* Dolby Surround */ + .mask =FL |FR }, + { .ca_id =0x03 , .n_ch =4 , + .mask =FL |FR |LFE |FC }, { .ca_id =0x02 , .n_ch =4 , .mask =FL |FR |FC }, -/* surround51 */ + { .ca_id =0x01 , .n_ch =4 , + .mask =FL |FR |LFE }, { .ca_id =0x0b , .n_ch =6 , - .mask =FL |FR |LFE |FC |RL |RR }, -/* surround40 */ - { .ca_id =0x08 , .n_ch =6 , - .mask =FL |FR |RL |RR }, -/* surround41 */ - { .ca_id =0x09 , .n_ch =6 , - .mask =FL |FR |LFE |RL |RR }, -/* surround50 */ + .mask =FL |FR |LFE |FC |RL |RR }, { .ca_id =0x0a , .n_ch =6 , .mask =FL |FR |FC |RL |RR }, -/* 6.1 */ - { .ca_id =0x0f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |RC }, -/* surround71 */ + { .ca_id =0x09 , .n_ch =6 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =6 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =6 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =6 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =6 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =6 , + .mask =FL |FR |RC }, { .ca_id =0x13 , .n_ch =8 , .mask =FL |FR |LFE |FC |RL |RR |RLC |RRC }, -/* others */ - { .ca_id =0x03 , .n_ch =8 , - .mask =FL |FR |LFE |FC }, - { .ca_id =0x04 , .n_ch =8 , - .mask =FL |FR |RC }, - { .ca_id =0x05 , .n_ch =8 , - .mask =FL |FR |LFE |RC }, - { .ca_id =0x06 , .n_ch =8 , - .mask =FL |FR |FC |RC }, - { .ca_id =0x07 , .n_ch =8 , - .mask =FL |FR |LFE |FC |RC }, - { .ca_id =0x0c , .n_ch =8 , - .mask =FL |FR |RC |RL |RR }, - { .ca_id =0x0d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RC }, - { .ca_id =0x0e , .n_ch =8 , - .mask =FL |FR |FC |RL |RR |RC }, - { .ca_id =0x10 , .n_ch =8 , - .mask =FL |FR |RL |RR |RLC |RRC }, - { .ca_id =0x11 , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, { .ca_id =0x12 , .n_ch =8 , .mask =FL |FR |FC |RL |RR |RLC |RRC }, - { .ca_id =0x14 , .n_ch =8 , - .mask =FL |FR |FLC |FRC }, - { .ca_id =0x15 , .n_ch =8 , - .mask =FL |FR |LFE |FLC |FRC }, - { .ca_id =0x16 , .n_ch =8 , - .mask =FL |FR |FC |FLC |FRC }, - { .ca_id =0x17 , .n_ch =8 , - .mask =FL |FR |LFE |FC |FLC |FRC }, - { .ca_id =0x18 , .n_ch =8 , - .mask =FL |FR |RC |FLC |FRC }, - { .ca_id =0x19 , .n_ch =8 , - .mask =FL |FR |LFE |RC |FLC |FRC }, - { .ca_id =0x1a , .n_ch =8 , - .mask =FL |FR |RC |FC |FLC |FRC }, - { .ca_id =0x1b , .n_ch =8 , - .mask =FL |FR |LFE |RC |FC |FLC |FRC }, - { .ca_id =0x1c , .n_ch =8 , - .mask =FL |FR |RL |RR |FLC |FRC }, - { .ca_id =0x1d , .n_ch =8 , - .mask =FL |FR |LFE |RL |RR |FLC |FRC }, { .ca_id =0x1e , .n_ch =8 , .mask =FL |FR |FC |RL |RR |FLC |FRC }, - { .ca_id =0x1f , .n_ch =8 , - .mask =FL |FR |LFE |FC |RL |RR |FLC |FRC }, + { .ca_id =0x11 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RLC |RRC }, + { .ca_id =0x1d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |FLC |FRC }, + { .ca_id =0x10 , .n_ch =8 , + .mask =FL |FR |RL |RR |RLC |RRC }, + { .ca_id =0x1c , .n_ch =8 , + .mask =FL |FR |RL |RR |FLC |FRC }, + { .ca_id =0x0f , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR |RC }, + { .ca_id =0x1b , .n_ch =8 , + .mask =FL |FR |LFE |RC |FC |FLC |FRC }, + { .ca_id =0x0e , .n_ch =8 , + .mask =FL |FR |FC |RL |RR |RC }, + { .ca_id =0x1a , .n_ch =8 , + .mask =FL |FR |RC |FC |FLC |FRC }, + { .ca_id =0x0d , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR |RC }, + { .ca_id =0x19 , .n_ch =8 , + .mask =FL |FR |LFE |RC |FLC |FRC }, + { .ca_id =0x0c , .n_ch =8 , + .mask =FL |FR |RC |RL |RR }, + { .ca_id =0x18 , .n_ch =8 , + .mask =FL |FR |RC |FLC |FRC }, + { .ca_id =0x17 , .n_ch =8 , + .mask =FL |FR |LFE |FC |FLC |FRC }, + { .ca_id =0x16 , .n_ch =8 , + .mask =FL |FR |FC |FLC |FRC }, + { .ca_id =0x15 , .n_ch =8 , + .mask =FL |FR |LFE |FLC |FRC }, + { .ca_id =0x14 , .n_ch =8 , + .mask =FL |FR |FLC |FRC }, + { .ca_id =0x0b , .n_ch =8 , + .mask =FL |FR |LFE |FC |RL |RR }, + { .ca_id =0x0a , .n_ch =8 , + .mask =FL |FR |FC |RL |RR }, + { .ca_id =0x09 , .n_ch =8 , + .mask =FL |FR |LFE |RL |RR }, + { .ca_id =0x08 , .n_ch =8 , + .mask =FL |FR |RL |RR }, + { .ca_id =0x07 , .n_ch =8 , + .mask =FL |FR |LFE |FC |RC }, + { .ca_id =0x06 , .n_ch =8 , + .mask =FL |FR |FC |RC }, + { .ca_id =0x05 , .n_ch =8 , + .mask =FL |FR |LFE |RC }, + { .ca_id =0x04 , .n_ch =8 , + .mask =FL |FR |RC }, + { .ca_id =0x03 , .n_ch =8 , + .mask =FL |FR |LFE |FC }, + { .ca_id =0x02 , .n_ch =8 , + .mask =FL |FR |FC }, + { .ca_id =0x01 , .n_ch =8 , + .mask =FL |FR |LFE }, };struct hdmi_codec_priv {
@@ -370,7 +383,8 @@ static int hdmi_codec_chmap_ctl_get(struct snd_kcontrol *kcontrol,struct snd_pcm_chmap *info =snd_kcontrol_chip (kcontrol);struct hdmi_codec_priv *hcp = info->private_data; - map = info->chmap[hcp->chmap_idx].map; +if (hcp->chmap_idx !=HDMI_CODEC_CHMAP_IDX_UNKNOWN ) + map = info->chmap[hcp->chmap_idx].map;for (i =0 ; i < info->max_channels; i++) {if (hcp->chmap_idx ==HDMI_CODEC_CHMAP_IDX_UNKNOWN )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 46/48 rocker: fix link status detection in rocker_carrier_init()
In reply to Sasha LevinFrom: Dmitry Antipov <[email protected]>
[ Upstream commit e64285ff41bb7a934bd815bd38f31119be62ac37 ]
Since '1 << rocker_port->pport' may be undefined for port >= 32, cast the left operand to 'unsigned long long' like it's done in 'rocker_port_set_enable()' above. Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/rocker/rocker_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/rocker/rocker_main.c +1 -1
@@ -2504,7 +2504,7 @@ static void rocker_carrier_init(const struct rocker_port *rocker_port)u64 link_status =rocker_read64 (rocker,PORT_PHYS_LINK_STATUS );bool link_up; - link_up = link_status & (1 << rocker_port->pport); + link_up = link_status & (1ULL << rocker_port->pport);if (link_up)netif_carrier_on (rocker_port->dev);else
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 47/48 net/neighbor: clear error in case strict check is not set
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 0de6a472c3b38432b2f184bd64eb70d9ea36d107 ]
Commit 51183d233b5a ("net/neighbor: Update neigh_dump_info for strict data checking") added strict checking. The err variable is not cleared, so if we find no table to dump we will return the validation error even if user did not want strict checking.
I think the only way to hit this is to send an buggy request, and ask for a table which doesn't exist, so there's no point treating this as a real fix. I only noticed it because a syzbot repro depended on it to trigger another bug.
--- net/core/neighbour.c | 1 + 1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
@@ -2865,6 +2865,7 @@ static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb) err =neigh_valid_dump_req (nlh, cb->strict_check, &filter, cb->extack);if (err <0 && cb->strict_check)return err; + err =0 ; s_t = cb->args[0 ];
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 48/48 netpoll: Use rcu_access_pointer() in __netpoll_setup
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit c69c5e10adb903ae2438d4f9c16eccf43d1fcbc1 ]
The ndev->npinfo pointer in __netpoll_setup() is RCU-protected but is being accessed directly for a NULL check. While no RCU read lock is held in this context, we should still use proper RCU primitives for consistency and correctness.
Replace the direct NULL check with rcu_access_pointer(), which is the appropriate primitive when only checking for NULL without dereferencing the pointer. This function provides the necessary ordering guarantees without requiring RCU read-side protection.
--- net/core/netpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/netpoll.c +1 -1
@@ -636,7 +636,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) goto out; } -if (!ndev->npinfo) { +if (!rcu_access_pointer (ndev->npinfo)) { npinfo =kmalloc (sizeof (*npinfo),GFP_KERNEL );if (!npinfo) { err = -ENOMEM ;
Signature · 1 line
2.43.0
RE: [PATCH AUTOSEL 6.1 35/48] net: enetc: remove ERR050089 workaround for i.MX95
In reply to Sasha LevinQuoted 158 lines
From: Vladimir Oltean <[email protected]>
[ Upstream commit
86831a3f4cd4c924dd78cf0d6e4d73acacfe1b11]The ERR050089 workaround causes performance degradation and potential functional issues (e.g., RCU stalls) under certain workloads. Since new SoCs like i.MX95 do not require this workaround, use a static key to compile out
enetc_lock_mdio()andenetc_unlock_mdio()at runtime, improving performance and avoiding unnecessary logic.Signed-off-by Vladimir Oltean <[email protected]>Signed-off-by Wei Fang <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- .../net/ethernet/freescale/enetc/enetc_hw.h | 34 +++++++++++++------ .../ethernet/freescale/enetc/enetc_pci_mdio.c | 28 +++++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-)drivers/net/ethernet/freescale/enetc/enetc_hw.h +6
-2@@ -372,18 +372,22 @@ struct enetc_hw {*/ extern rwlock_t enetc_mdio_lock; +DECLARE_STATIC_KEY_FALSE (enetc_has_err050089); +/* use this locking primitive only on the fast datapath to * group together multiple non-MDIO register accesses to * minimize the overhead of the lock */ static inline void enetc_lock_mdio (void ) { -read_lock (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +read_lock (&enetc_mdio_lock); }static inline void enetc_unlock_mdio (void ) { -read_unlock (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +read_unlock (&enetc_mdio_lock); }/* use these accessors only on the fast datapath under @@ -392,14 +396,16 @@ static inline void enetc_unlock_mdio(void) */ static inline u32
enetc_rd_reg_hot(void __iomem *reg){drivers/net/ethernet/freescale/enetc/enetc_hw.h +11
-5-lockdep_assert_held (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +lockdep_assert_held (&enetc_mdio_lock);return ioread32 (reg); }static inline void enetc_wr_reg_hot (void __iomem *reg,u32 val) { -lockdep_assert_held (&enetc_mdio_lock); +if (static_branch_unlikely (&enetc_has_err050089)) +lockdep_assert_held (&enetc_mdio_lock);iowrite32 (val, reg); }@@ -428,9 +434,13 @@ static inline u32 _enetc_rd_mdio_reg_wa(void __iomem *reg)unsigned long flags;u32 val; -write_lock_irqsave (&enetc_mdio_lock, flags); - val =ioread32 (reg); -write_unlock_irqrestore (&enetc_mdio_lock, flags); +if (static_branch_unlikely (&enetc_has_err050089)) { +write_lock_irqsave (&enetc_mdio_lock, flags); + val =ioread32 (reg); +write_unlock_irqrestore (&enetc_mdio_lock, flags); + }else { + val =ioread32 (reg); + }return val;}
drivers/net/ethernet/freescale/enetc/enetc_hw.h +7
-3@@ -439,9 +449,13 @@ static inline void _enetc_wr_mdio_reg_wa(void __iomem *reg, u32 val) {unsigned long flags; -write_lock_irqsave (&enetc_mdio_lock, flags); -iowrite32 (val, reg); -write_unlock_irqrestore (&enetc_mdio_lock, flags); +if (static_branch_unlikely (&enetc_has_err050089)) { +write_lock_irqsave (&enetc_mdio_lock, flags); +iowrite32 (val, reg); +write_unlock_irqrestore (&enetc_mdio_lock, flags); + }else { +iowrite32 (val, reg); + } }#ifdef ioread64drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c +26
-0@@ -9,6 +9,28 @@#define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus"#define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver" +DEFINE_STATIC_KEY_FALSE (enetc_has_err050089); +EXPORT_SYMBOL_GPL (enetc_has_err050089); + +static void enetc_emdio_enable_err050089 (struct pci_dev *pdev) { +if (pdev->vendor ==PCI_VENDOR_ID_FREESCALE && + pdev->device ==ENETC_MDIO_DEV_ID ) { +static_branch_inc (&enetc_has_err050089); +dev_info (&pdev->dev,"Enabled ERR050089 workaround\n" ); + } +} + +static void enetc_emdio_disable_err050089 (struct pci_dev *pdev) { +if (pdev->vendor ==PCI_VENDOR_ID_FREESCALE && + pdev->device ==ENETC_MDIO_DEV_ID ) { +static_branch_dec (&enetc_has_err050089); +if (!static_key_enabled (&enetc_has_err050089.key)) +dev_info (&pdev->dev,"Disabled ERR050089 workaround\n" ); + } +} +static int enetc_pci_mdio_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {@@ -60,6 +82,8 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev, goto err_pci_mem_reg; } +enetc_emdio_enable_err050089 (pdev); + err =of_mdiobus_register (bus, dev->of_node);if (err) goto err_mdiobus_reg;@@ -69,6 +93,7 @@ static int enetc_pci_mdio_probe(struct pci_dev *pdev,return 0 ; err_mdiobus_reg: +enetc_emdio_disable_err050089 (pdev);pci_release_region (pdev,0 ); err_pci_mem_reg:pci_disable_device (pdev);@@ -86,6 +111,9 @@ static void enetc_pci_mdio_remove(struct pci_dev *pdev)struct enetc_mdio_priv *mdio_priv;mdiobus_unregister (bus); + +enetc_emdio_disable_err050089 (pdev); + mdio_priv = bus->priv;iounmap (mdio_priv->hw->port);
Quoted 3 lines
pci_release_region(pdev, 0);
--
2.43.0
Hi Sasha,
This patch does not need to be backported, because i.MX95 NETC is only supported in the latest kernel (should be 6.13, Linus tree). For the old kernel, only LS1028A NETC is supported, so this problem does not exist.