6.6.23-rc1 review
Subsystems (12)
Sasha Levin
maintainerPATCH 263/638 net: mctp: copy skb ext data when fragmenting
In reply to Sasha LevinFrom: Jeremy Kerr <[email protected]>
[ Upstream commit 1394c1dec1c619a46867ed32791a29695372bff8 ]
If we're fragmenting on local output, the original packet may contain ext data for the MCTP flows. We'll want this in the resulting fragment skbs too.
So, do a skb_ext_copy() in the fragmentation path, and implement the MCTP-specific parts of an ext copy operation.
--- net/core/skbuff.c | 8 ++++++++ net/mctp/route.c | 3 +++ 2 files changed, 11 insertions(+)
net/core/skbuff.c +8 -0
@@ -6659,6 +6659,14 @@ static struct skb_ext *skb_ext_maybe_cow(struct skb_ext *old,for (i =0 ; i < sp->len; i++) xfrm_state_hold(sp->xvec[i]); } +#endif +#ifdef CONFIG_MCTP_FLOWS +if (old_active & (1 <<SKB_EXT_MCTP )) { +struct mctp_flow *flow =skb_ext_get_ptr (old,SKB_EXT_MCTP ); + +if (flow->key) +refcount_inc (&flow->key->refs); + }#endif __skb_ext_put (old);return new;
net/mctp/route.c +3 -0
@@ -843,6 +843,9 @@ static int mctp_do_fragment_route(struct mctp_route *rt, struct sk_buff *skb,/* copy message payload */ skb_copy_bits (skb, pos,skb_transport_header (skb2), size); +/* we need to copy the extensions, for MCTP flow data */ +skb_ext_copy (skb2, skb); +/* do route */ rc = rt->output (rt, skb2);if (rc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 264/638 pstore: inode: Convert mutex usage to guard(mutex)
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit e2eeddefb046dbc771a6fa426f7f98fb25adfe68 ]
Replace open-coded mutex handling with cleanup.h guard(mutex) and scoped_guard(mutex, ...).
Stable-dep-of: a43e0fc5e913 ("pstore: inode: Only d_invalidate() is needed")
--- fs/pstore/inode.c | 76 +++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 45 deletions(-)
fs/pstore/inode.c +31 -45
@@ -182,25 +182,21 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) {struct pstore_private *p =d_inode (dentry)->i_private;struct pstore_record *record = p->record; -int rc =0 ;if (!record->psi->erase)return -EPERM ;/* Make sure we can't race while removing this file. */ -mutex_lock (&records_list_lock); -if (!list_empty (&p->list)) -list_del_init (&p->list); -else - rc = -ENOENT ; - p->dentry =NULL ; -mutex_unlock (&records_list_lock); -if (rc) -return rc; - -mutex_lock (&record->psi->read_mutex); - record->psi->erase (record); -mutex_unlock (&record->psi->read_mutex); + scoped_guard(mutex, &records_list_lock) { +if (!list_empty (&p->list)) +list_del_init (&p->list); +else +return -ENOENT ; + p->dentry =NULL ; + } + +scoped_guard (mutex, &record->psi->read_mutex) + record->psi->erase(record);return simple_unlink (dir, dentry); }
@@ -292,19 +288,16 @@ static struct dentry *psinfo_lock_root(void) {struct dentry *root; -mutex_lock (&pstore_sb_lock); +guard (mutex)(&pstore_sb_lock);/* * Having no backend is fine -- no records appear. * Not being mounted is fine -- nothing to do. */ -if (!psinfo || !pstore_sb) { -mutex_unlock (&pstore_sb_lock); +if (!psinfo || !pstore_sb)return NULL ; - } root = pstore_sb->s_root;inode_lock (d_inode (root)); -mutex_unlock (&pstore_sb_lock);return root; }
@@ -319,19 +312,19 @@ int pstore_put_backend_records(struct pstore_info *psi)if (!root)return 0 ; -mutex_lock (&records_list_lock); -list_for_each_entry_safe (pos, tmp, &records_list, list) { -if (pos->record->psi == psi) { -list_del_init (&pos->list); - rc =simple_unlink (d_inode (root), pos->dentry); -if (WARN_ON (rc)) -break ; -d_drop (pos->dentry); -dput (pos->dentry); - pos->dentry =NULL ; + scoped_guard(mutex, &records_list_lock) { +list_for_each_entry_safe (pos, tmp, &records_list, list) { +if (pos->record->psi == psi) { +list_del_init (&pos->list); + rc =simple_unlink (d_inode (root), pos->dentry); +if (WARN_ON (rc)) +break ; +d_drop (pos->dentry); +dput (pos->dentry); + pos->dentry =NULL ; + } } } -mutex_unlock (&records_list_lock);inode_unlock (d_inode (root));
@@ -355,20 +348,20 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)if (WARN_ON (!inode_is_locked (d_inode (root))))return -EINVAL ; - rc = -EEXIST ; +guard (mutex)(&records_list_lock); +/* Skip records that are already present in the filesystem. */ -mutex_lock (&records_list_lock);list_for_each_entry (pos, &records_list, list) {if (pos->record->type == record->type && pos->record->id == record->id && pos->record->psi == record->psi) - goto fail; +return -EEXIST ; } rc = -ENOMEM ; inode =pstore_get_inode (root->d_sb);if (!inode) - goto fail; +return -ENOMEM ; inode->i_mode =S_IFREG |0444 ; inode->i_fop = &pstore_file_operations; scnprintf(name, sizeof(name), "%s-%s-%llu%s",
@@ -395,7 +388,6 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)d_add (dentry, inode);list_add (&private->list, &records_list); -mutex_unlock (&records_list_lock);return 0 ;
@@ -403,8 +395,6 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)free_pstore_private (private); fail_inode:iput (inode); -fail: -mutex_unlock (&records_list_lock);return rc; }
@@ -450,9 +440,8 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)if (!sb->s_root)return -ENOMEM ; -mutex_lock (&pstore_sb_lock); - pstore_sb = sb; -mutex_unlock (&pstore_sb_lock); +scoped_guard (mutex, &pstore_sb_lock) + pstore_sb = sb;pstore_get_records (0 );
@@ -467,17 +456,14 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,static void pstore_kill_sb (struct super_block *sb) { -mutex_lock (&pstore_sb_lock); +guard (mutex)(&pstore_sb_lock);WARN_ON (pstore_sb && pstore_sb != sb);kill_litter_super (sb); pstore_sb =NULL ; -mutex_lock (&records_list_lock); +guard (mutex)(&records_list_lock);INIT_LIST_HEAD (&records_list); -mutex_unlock (&records_list_lock); - -mutex_unlock (&pstore_sb_lock); }static struct file_system_type pstore_fs_type = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 265/638 pstore: inode: Only d_invalidate() is needed
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit a43e0fc5e9134a46515de2f2f8d4100b74e50de3 ]
Unloading a modular pstore backend with records in pstorefs would trigger the dput() double-drop warning:
WARNING: CPU: 0 PID: 2569 at fs/dcache.c:762 dput.part.0+0x3f3/0x410
Using the combo of d_drop()/dput() (as mentioned in Documentation/filesystems/vfs.rst) isn't the right approach here, and leads to the reference counting problem seen above. Use d_invalidate() and update the code to not bother checking for error codes that can never happen.
--- fs/pstore/inode.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
fs/pstore/inode.c +3 -7
@@ -306,7 +306,6 @@ int pstore_put_backend_records(struct pstore_info *psi) {struct pstore_private *pos, *tmp;struct dentry *root; -int rc =0 ; root =psinfo_lock_root ();if (!root)
@@ -316,11 +315,8 @@ int pstore_put_backend_records(struct pstore_info *psi)list_for_each_entry_safe (pos, tmp, &records_list, list) {if (pos->record->psi == psi) {list_del_init (&pos->list); - rc =simple_unlink (d_inode (root), pos->dentry); -if (WARN_ON (rc)) -break ; -d_drop (pos->dentry); -dput (pos->dentry); +d_invalidate (pos->dentry); +simple_unlink (d_inode (root), pos->dentry); pos->dentry =NULL ; } }
@@ -328,7 +324,7 @@ int pstore_put_backend_records(struct pstore_info *psi)inode_unlock (d_inode (root)); -return rc; +return 0 ; }/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 266/638 arm64: dts: allwinner: h6: Add RX DMA channel for SPDIF
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 7b59348c11f3355e284d77bbe3d33632ddadcfc2 ]
The SPDIF hardware found on the H6 supports both transmit and receive functions. However it is missing the RX DMA channel.
Add the SPDIF hardware block's RX DMA channel. Also remove the by-default pinmux, since the end device can choose to implement either or both functionalities.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 2 ++ arch/arm64/boot/dts/allwinner/sun50i-h6-tanix.dtsi | 2 ++ arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 7 +++---- 3 files changed, 7 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +2 -0
@@ -291,6 +291,8 @@ sw { }; &spdif { + pinctrl-names = "default"; + pinctrl-0 = <&spdif_tx_pin>; status = "okay"; };
arch/arm64/boot/dts/allwinner/sun50i-h6-tanix.dtsi +2 -0
@@ -166,6 +166,8 @@ &r_ir { }; &spdif { + pinctrl-names = "default"; + pinctrl-0 = <&spdif_tx_pin>; status = "okay"; };
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +3 -4
@@ -406,6 +406,7 @@ spi1_cs_pin: spi1-cs-pin { function = "spi1"; }; + /omit-if-no-ref/ spdif_tx_pin: spdif-tx-pin { pins = "PH7"; function = "spdif";
@@ -655,10 +656,8 @@ spdif: spdif@5093000 { clocks = <&ccu CLK_BUS_SPDIF>, <&ccu CLK_SPDIF>; clock-names = "apb", "spdif"; resets = <&ccu RST_BUS_SPDIF>; - dmas = <&dma 2>; - dma-names = "tx"; - pinctrl-names = "default"; - pinctrl-0 = <&spdif_tx_pin>; + dmas = <&dma 2>, <&dma 2>; + dma-names = "rx", "tx"; status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 267/638 ARM: dts: imx6dl-yapp4: Fix typo in the QCA switch register address
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
[ Upstream commit 023bd910d3ab735459f84b22bb99fb9e00bd9d76 ]
This change does not have any functional effect. The switch works just fine without this patch as it has full access to all the addresses on the bus. This is simply a clean-up to set the node name address and reg address to the same value.
--- arch/arm/boot/dts/nxp/imx/imx6dl-yapp4-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nxp/imx/imx6dl-yapp4-common.dtsi +1 -1
@@ -127,7 +127,7 @@ phy_port3: phy@2 { switch@10 { compatible = "qca,qca8334"; - reg = <10>; + reg = <0x10>; reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; switch_ports: ports {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 268/638 ARM: dts: imx6dl-yapp4: Move the internal switch PHYs under the switch node
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
[ Upstream commit 79978bff2e4b8e05ebdf5fc3ee6b794002393484 ]
We identified that the PHYs actually do not work since commit 7da7b84fee58 ("ARM: dts: imx6dl-yapp4: Move phy reset into switch node") as a coincidence of several circumstances.
The reset signal is kept asserted by a pull-down resistor on the board unless it is deasserted by GPIO from the SoC. This is to keep the switch dead until it is configured properly by the kernel and user space.
Prior to the referenced commit the switch was reset by the FEC driver and the reset GPIO was actively deasserted. The mdio-bus was scanned and the attached switch and its PHYs were found and configured.
With the referenced commit the switch is reset by the qca8k driver. Because of another bug in the qca8k driver, functionality of the reset pin depends on its pre-kernel configuration. See commit c44fc98f0a8f ("net: dsa: qca8k: fix illegal usage of GPIO")
The problem did not appear until we removed support for the switch and configuration of its reset pin from the bootloader.
To fix that, properly describe the internal mdio-bus configuration of the qca8334 switch. The PHYs are internal to the switch and sit on its internal mdio-bus.
--- .../boot/dts/nxp/imx/imx6dl-yapp4-common.dtsi | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-)
arch/arm/boot/dts/nxp/imx/imx6dl-yapp4-common.dtsi +15 -8
@@ -117,14 +117,6 @@ mdio { #address-cells = <1>; #size-cells = <0>; - phy_port2: phy@1 { - reg = <1>; - }; - - phy_port3: phy@2 { - reg = <2>; - }; - switch@10 { compatible = "qca,qca8334"; reg = <0x10>;
@@ -149,15 +141,30 @@ fixed-link { eth2: port@2 { reg = <2>; label = "eth2"; + phy-mode = "internal"; phy-handle = <&phy_port2>; }; eth1: port@3 { reg = <3>; label = "eth1"; + phy-mode = "internal"; phy-handle = <&phy_port3>; }; }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + phy_port2: ethernet-phy@1 { + reg = <1>; + }; + + phy_port3: ethernet-phy@2 { + reg = <2>; + }; + }; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 269/638 arm64: dts: imx8mp: Set SPI NOR to max 40 MHz on Data Modul i.MX8M Plus eDM SBC
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 13ab6f174a6b577bd7d09124b47ec8ace2682e42 ]
The SPI NOR bus routing on this board cannot go above 50 MHz, set the clock frequency to maximum of 40 MHz to be within a safe margin. Remove the comment as well.
--- arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-data-modul-edm-sbc.dts +1 -1
@@ -121,7 +121,7 @@ &ecspi1 { flash@0 { /* W25Q128JVEI */ compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <100000000>; /* Up to 133 MHz */ + spi-max-frequency = <40000000>; spi-tx-bus-width = <1>; spi-rx-bus-width = <1>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 270/638 arm64: dts: imx8mp-evk: Fix hdmi@3d node
In reply to Sasha LevinFrom: Liu Ying <[email protected]>
[ Upstream commit 0ff08803eca417dfa9372194bebf3d1b1f501f98 ]
The hdmi@3d node's compatible string is "adi,adv7535" instead of "adi,adv7533" or "adi,adv751*".
Fix the hdmi@3d node by means of:
* Use default register addresses for "cec", "edid" and "packet", because there is no need to use a non-default address map.
* Add missing interrupt related properties.
* Drop "adi,input-*" properties which are only valid for adv751*.
* Add VEXT_3V3 fixed regulator.
* Add "*-supply" properties, since most are required.
* Fix label names - s/adv7533/adv7535/.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 33 +++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +21 -12
@@ -23,7 +23,7 @@ hdmi-connector { port { hdmi_connector_in: endpoint { - remote-endpoint = <&adv7533_out>; + remote-endpoint = <&adv7535_out>; }; }; };
@@ -107,6 +107,13 @@ reg_usdhc2_vmmc: regulator-usdhc2 { enable-active-high; }; + reg_vext_3v3: regulator-vext-3v3 { + compatible = "regulator-fixed"; + regulator-name = "VEXT_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + sound { compatible = "simple-audio-card"; simple-audio-card,name = "wm8960-audio";
@@ -342,7 +349,7 @@ BUCK4 { regulator-always-on; }; - BUCK5 { + reg_buck5: BUCK5 { regulator-name = "BUCK5"; regulator-min-microvolt = <1650000>; regulator-max-microvolt = <1950000>;
@@ -393,14 +400,16 @@ &i2c2 { hdmi@3d { compatible = "adi,adv7535"; - reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>; - reg-names = "main", "cec", "edid", "packet"; + reg = <0x3d>; + interrupt-parent = <&gpio1>; + interrupts = <9 IRQ_TYPE_EDGE_FALLING>; adi,dsi-lanes = <4>; - adi,input-depth = <8>; - adi,input-colorspace = "rgb"; - adi,input-clock = "1x"; - adi,input-style = <1>; - adi,input-justification = "evenly"; + avdd-supply = <®_buck5>; + dvdd-supply = <®_buck5>; + pvdd-supply = <®_buck5>; + a2vdd-supply = <®_buck5>; + v3p3-supply = <®_vext_3v3>; + v1p2-supply = <®_buck5>; ports { #address-cells = <1>;
@@ -409,7 +418,7 @@ ports { port@0 { reg = <0>; - adv7533_in: endpoint { + adv7535_in: endpoint { remote-endpoint = <&dsi_out>; }; };
@@ -417,7 +426,7 @@ adv7533_in: endpoint { port@1 { reg = <1>; - adv7533_out: endpoint { + adv7535_out: endpoint { remote-endpoint = <&hdmi_connector_in>; }; };
@@ -502,7 +511,7 @@ port@1 { reg = <1>; dsi_out: endpoint { - remote-endpoint = <&adv7533_in>; + remote-endpoint = <&adv7535_in>; data-lanes = <1 2 3 4>; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 271/638 regulator: userspace-consumer: add module device table
In reply to Sasha LevinFrom: John Keeping <[email protected]>
[ Upstream commit 531a0c0cdbff9cecf41073220a826f8b1132f9ab ]
The userspace consumer can be built as a module but it cannot be automatically probed as there is no device table to match it up with device tree nodes.
Add the missing macro so that the module can load automatically.
--- drivers/regulator/userspace-consumer.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/userspace-consumer.c +1 -0
@@ -210,6 +210,7 @@ static const struct of_device_id regulator_userspace_consumer_of_match[] = { { .compatible = "regulator-output", }, {}, }; +MODULE_DEVICE_TABLE (of, regulator_userspace_consumer_of_match);static struct platform_driver regulator_userspace_consumer_driver = { .probe = regulator_userspace_consumer_probe,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 272/638 gpiolib: Pass consumer device through to core in devm_fwnode_gpiod_get_index()
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit 0d776cfd5e5b559fdf2e38285c2aea4b7048acbd ]
This devm API takes a consumer device as an argument to setup the devm action, but throws it away when calling further into gpiolib. This leads to odd debug messages like this:
(NULL device *): using DT '/gpio-keys/switch-pen-insert' for '(null)' GPIO lookup
Let's pass the consumer device down, by directly calling what fwnode_gpiod_get_index() calls but pass the device used for devm. This changes the message to look like this instead:
gpio-keys gpio-keys: using DT '/gpio-keys/switch-pen-insert' for '(null)' GPIO lookup
Note that callers of fwnode_gpiod_get_index() will still see the NULL device pointer debug message, but there's not much we can do about that because the API doesn't take a struct device.
--- drivers/gpio/gpiolib-devres.c | 2 +- drivers/gpio/gpiolib.c | 14 +++++++------- drivers/gpio/gpiolib.h | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-)
drivers/gpio/gpiolib-devres.c +1 -1
@@ -158,7 +158,7 @@ struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,if (!dr)return ERR_PTR (-ENOMEM ); - desc =fwnode_gpiod_get_index (fwnode, con_id, index, flags, label); + desc =gpiod_find_and_request (dev, fwnode, con_id, index, flags, label, false);if (IS_ERR (desc)) {devres_free (dr);return desc;
drivers/gpio/gpiolib.c +7 -7
@@ -4021,13 +4021,13 @@ static struct gpio_desc *gpiod_find_by_fwnode(struct fwnode_handle *fwnode,return desc; } -static struct gpio_desc *gpiod_find_and_request (struct device *consumer, -struct fwnode_handle *fwnode, -const char *con_id, -unsigned int idx, -enum gpiod_flags flags, -const char *label, -bool platform_lookup_allowed) +struct gpio_desc *gpiod_find_and_request (struct device *consumer, +struct fwnode_handle *fwnode, +const char *con_id, +unsigned int idx, +enum gpiod_flags flags, +const char *label, +bool platform_lookup_allowed) {unsigned long lookupflags =GPIO_LOOKUP_FLAGS_DEFAULT ;struct gpio_desc *desc;
drivers/gpio/gpiolib.h +8 -0
@@ -207,6 +207,14 @@ static inline int gpiod_request_user(struct gpio_desc *desc, const char *label)return ret; } +struct gpio_desc *gpiod_find_and_request (struct device *consumer, +struct fwnode_handle *fwnode, +const char *con_id, +unsigned int idx, +enum gpiod_flags flags, +const char *label, +bool platform_lookup_allowed); +int gpiod_configure_flags (struct gpio_desc *desc,const char *con_id,unsigned long lflags,enum gpiod_flags dflags);int gpio_set_debounce_timeout (struct gpio_desc *desc,unsigned int debounce);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 273/638 arm64: dts: marvell: reorder crypto interrupts on Armada SoCs
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit ec55a22149d64f9ac41845d923b884d4a666bf4d ]
Match order specified in binding documentation. It says "mem" should be the last interrupt.
This fixes:arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:0: 'ring0' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:1: 'ring1' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:2: 'ring2' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:3: 'ring3' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:4: 'eip' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#arch/arm64/boot/dts/marvell/armada-3720-db.dtb: crypto@90000: interrupt-names:5: 'mem' was expected
from schema $id: http://devicetree.org/schemas/crypto/inside-secure,safexcel.yaml#
--- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 10 +++++----- arch/arm64/boot/dts/marvell/armada-cp11x.dtsi | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +5 -5
@@ -431,14 +431,14 @@ xor11 { crypto: crypto@90000 { compatible = "inside-secure,safexcel-eip97ies"; reg = <0x90000 0x20000>; - interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "mem", "ring0", "ring1", - "ring2", "ring3", "eip"; + <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "ring0", "ring1", "ring2", + "ring3", "eip", "mem"; clocks = <&nb_periph_clk 15>; };
arch/arm64/boot/dts/marvell/armada-cp11x.dtsi +5 -5
@@ -511,14 +511,14 @@ CP11X_LABEL(sdhci0): mmc@780000 { CP11X_LABEL(crypto): crypto@800000 { compatible = "inside-secure,safexcel-eip197b"; reg = <0x800000 0x200000>; - interrupts = <87 IRQ_TYPE_LEVEL_HIGH>, - <88 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <88 IRQ_TYPE_LEVEL_HIGH>, <89 IRQ_TYPE_LEVEL_HIGH>, <90 IRQ_TYPE_LEVEL_HIGH>, <91 IRQ_TYPE_LEVEL_HIGH>, - <92 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "mem", "ring0", "ring1", - "ring2", "ring3", "eip"; + <92 IRQ_TYPE_LEVEL_HIGH>, + <87 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "ring0", "ring1", "ring2", "ring3", + "eip", "mem"; clock-names = "core", "reg"; clocks = <&CP11X_LABEL(clk) 1 26>, <&CP11X_LABEL(clk) 1 17>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 274/638 ACPI: resource: Add Infinity laptops to irq1_edge_low_force_override
In reply to Sasha LevinFrom: David McFarland <[email protected]>
[ Upstream commit e2605d4039a42a03000856b3229932455717b48b ]
A user reported a keyboard problem similar to ones reported with other Zen laptops, on an Infinity E15-5A165-BM.
Add board name matches for this model and one (untested) close relative to irq1_edge_low_force_override.
Stable-dep-of: 021a67d09615 ("ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override")
--- drivers/acpi/resource.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/resource.c +12 -0
@@ -550,6 +550,18 @@ static const struct dmi_system_id pcspecialist_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "GM6BG0Q"), }, }, + { +/* Infinity E15-5A165-BM */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GM5RG1E0009COM"), + }, + }, + { +/* Infinity E15-5A305-1M */ + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GM5RGEE0016COM"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 275/638 ACPI: resource: Do IRQ override on Lunnen Ground laptops
In reply to Sasha LevinFrom: "Alexey I. Froloff" <[email protected]>
[ Upstream commit e23ad54fef186aa66007895be1382c88f1ee2bf7 ]
The Lunnen Ground 15 and 16 needs IRQ overriding for the keyboard to work.
Adding an entries for these laptops to the override_table makes the internal keyboard functional.
Stable-dep-of: 021a67d09615 ("ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override")
--- drivers/acpi/resource.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/acpi/resource.c +14 -0
@@ -562,6 +562,20 @@ static const struct dmi_system_id pcspecialist_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "GM5RGEE0016COM"), }, }, + { + /* Lunnen Ground 15 / AMD Ryzen 5 5500U */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"), + DMI_MATCH(DMI_BOARD_NAME, "LLL5DAW"), + }, + }, + { +/* Lunnen Ground 16 / AMD Ryzen 7 5800U */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"), + DMI_MATCH(DMI_BOARD_NAME, "LL6FA"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 276/638 ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override
In reply to Sasha LevinFrom: Maxim Kudinov <[email protected]>
[ Upstream commit 021a67d096154893cd1d883c7be0097e2ee327fd ]
A known issue on some Zen laptops, keyboard stopped working due to commit 9946e39fe8d0 [email protected]("ACPI: resource: skip IRQ override on AMD Zen platforms") on kernel 5.19.10.
The ACPI IRQ override is required for this board due to buggy DSDT, thus adding the board vendor and name to irq1_edge_low_force_override fixes the issue.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -576,6 +576,13 @@ static const struct dmi_system_id pcspecialist_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "LL6FA"), }, }, + { + /* MAIBENBEN X577 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MAIBENBEN"), + DMI_MATCH(DMI_BOARD_NAME, "X577"), + }, + }, { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 277/638 ACPI: scan: Fix device check notification handling
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 793551c965116d9dfaf0550dacae1396a20efa69 ]
It is generally invalid to fail a Device Check notification if the scan handler has not been attached to the given device after a bus rescan, because there may be valid reasons for the scan handler to refuse attaching to the device (for example, the device is not ready).
For this reason, modify acpi_scan_device_check() to return 0 in that case without printing a warning.
While at it, reduce the log level of the "already enumerated" message in the same function, because it is only interesting when debugging notification handling
--- drivers/acpi/scan.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/acpi/scan.c +2 -6
@@ -314,18 +314,14 @@ static int acpi_scan_device_check(struct acpi_device *adev)* again). */ if (adev->handler) { -dev_warn (&adev->dev,"Already enumerated\n" ); -return -EALREADY ; +dev_dbg (&adev->dev,"Already enumerated\n" ); +return 0 ; } error =acpi_bus_scan (adev->handle);if (error) {dev_warn (&adev->dev,"Namespace scan failure\n" );return error; } -if (!adev->handler) { -dev_warn (&adev->dev,"Enumeration failure\n" ); - error = -ENODEV ; - } }else { error =acpi_scan_device_not_present (adev); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 278/638 arm64: dts: rockchip: add missing interrupt-names for rk356x vdpu
In reply to Sasha LevinFrom: Heiko Stuebner <[email protected]>
[ Upstream commit d1c44d9afa6f89aa0e10a191f30868eb12cd719f ]
The video-codec@fdea0400 was missing the interrupt-names property that is part of the binding. Add it.
--- arch/arm64/boot/dts/rockchip/rk356x.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +1 -0
@@ -597,6 +597,7 @@ vpu: video-codec@fdea0400 { compatible = "rockchip,rk3568-vpu"; reg = <0x0 0xfdea0000 0x0 0x800>; interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vdpu"; clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; clock-names = "aclk", "hclk"; iommus = <&vdpu_mmu>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 279/638 arm64: dts: rockchip: fix reset-names for rk356x i2s2 controller
In reply to Sasha LevinFrom: Heiko Stuebner <[email protected]>
[ Upstream commit 0fc19ab75acde78558bd0f6fe3e5f63cf8ee88b0 ]
The dtbscheck reports a warning for a wrong reset-names property for the i2s2 controller on rk356x socs.
The other controllers on the soc provide tx and rx directions and hence two resets and separate clocks for each direction, while i2s2 only provides one reset. This was so far named just "m" which isn't part of the binding.
The clock-names the controller uses all end in "tx", so use the matching "tx-m" reset-name for the i2s controller.
--- arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +1 -1
@@ -1117,7 +1117,7 @@ i2s2_2ch: i2s@fe420000 { dmas = <&dmac1 4>, <&dmac1 5>; dma-names = "tx", "rx"; resets = <&cru SRST_M_I2S2_2CH>; - reset-names = "m"; + reset-names = "tx-m"; rockchip,grf = <&grf>; pinctrl-names = "default"; pinctrl-0 = <&i2s2m0_sclktx
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 280/638 arm64: dts: rockchip: drop rockchip,trcm-sync-tx-only from rk3588 i2s
In reply to Sasha LevinFrom: Heiko Stuebner <[email protected]>
[ Upstream commit a8037ceb89649659831e86a87a9329d1bb43c735 ]
The rockchip,trcm-sync-tx-only property is at this time only documented for the tdm variant of Rockchip i2s controllers.
While there was a series [0] adding code and binding for the property, it doesn't seem to have gone forward back in 2021.
So for now fix the devicetree check by removing the property from rk3588 i2s controllers until support for it gets merged.
[0] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
--- arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588s.dtsi +0 -2
@@ -1542,7 +1542,6 @@ i2s2_2ch: i2s@fe490000 { dmas = <&dmac1 0>, <&dmac1 1>; dma-names = "tx", "rx"; power-domains = <&power RK3588_PD_AUDIO>; - rockchip,trcm-sync-tx-only; pinctrl-names = "default"; pinctrl-0 = <&i2s2m1_lrck &i2s2m1_sclk
@@ -1563,7 +1562,6 @@ i2s3_2ch: i2s@fe4a0000 { dmas = <&dmac1 2>, <&dmac1 3>; dma-names = "tx", "rx"; power-domains = <&power RK3588_PD_AUDIO>; - rockchip,trcm-sync-tx-only; pinctrl-names = "default"; pinctrl-0 = <&i2s3_lrck &i2s3_sclk
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 281/638 iommu/arm-smmu-v3: Check that the RID domain is S1 in SVA
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit ae91f6552c301e5e8569667e9d5440d5f75a90c4 ]
The SVA code only works if the RID domain is a S1 domain and has already installed the cdtable.
Originally the check for this was in arm_smmu_sva_bind() but when the op was removed the test didn't get copied over to the new arm_smmu_sva_set_dev_pasid().
Without the test wrong usage usually will hit a WARN_ON() in arm_smmu_write_ctx_desc() due to a missing ctx table.
However, the next patches wil change things so that an IDENTITY domain is not a struct arm_smmu_domain and this will get into memory corruption if the struct is wrongly casted.
Fail in arm_smmu_sva_set_dev_pasid() if the STE does not have a S1, which is a proxy for the STE having a pointer to the CD table. Write it in a way that will be compatible with the next patches.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +7 -1
@@ -352,7 +352,13 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)struct arm_smmu_bond *bond;struct arm_smmu_master *master =dev_iommu_priv_get (dev);struct iommu_domain *domain =iommu_get_domain_for_dev (dev); -struct arm_smmu_domain *smmu_domain =to_smmu_domain (domain); +struct arm_smmu_domain *smmu_domain; + +if (!(domain->type & __IOMMU_DOMAIN_PAGING)) +return -ENODEV ; + smmu_domain =to_smmu_domain (domain); +if (smmu_domain->stage !=ARM_SMMU_DOMAIN_S1 ) +return -ENODEV ;if (!master || !master->sva_enabled)return ERR_PTR (-ENODEV );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 282/638 objtool: Fix UNWIND_HINT_{SAVE,RESTORE} across basic blocks
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 10b4c4bce3f5541f54bcc2039720b11d2bc96d79 ]
If SAVE and RESTORE unwind hints are in different basic blocks, and objtool sees the RESTORE before the SAVE, it errors out with:
vmlinux.o: warning: objtool: vmw_port_hb_in+0x242: objtool isn't smart enough to handle this CFI save/restore combo
In such a case, defer following the RESTORE block until the straight-line path gets followed later.
--- tools/objtool/check.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/objtool/check.c +12 -0
@@ -3604,6 +3604,18 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, }if (!save_insn->visited) { +/* +* If the restore hint insn is at the +* beginning of a basic block and was +* branched to from elsewhere, and the +* save insn hasn't been visited yet, +* defer following this branch for now. +* It will be seen later via the +* straight-line path. +*/ +if (!prev_insn) +return 0 ; +WARN_INSN (insn,"objtool isn't smart enough to handle this CFI save/restore combo" );return 1 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 283/638 x86, relocs: Ignore relocations in .notes section
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit aaa8736370db1a78f0e8434344a484f9fd20be3b ]
When building with CONFIG_XEN_PV=y, .text symbols are emitted into the .notes section so that Xen can find the "startup_xen" entry point. This information is used prior to booting the kernel, so relocations are not useful. In fact, performing relocations against the .notes section means that the KASLR base is exposed since /sys/kernel/notes is world-readable.
To avoid leaking the KASLR base without breaking unprivileged tools that are expecting to read /sys/kernel/notes, skip performing relocations in the .notes section. The values readable in .notes are then identical to those found in System.map.
--- arch/x86/tools/relocs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/tools/relocs.c +8 -0
@@ -653,6 +653,14 @@ static void print_absolute_relocs(void)if (!(sec_applies->shdr.sh_flags &SHF_ALLOC )) {continue ; } +/* +* Do not perform relocations in .notes section; any +* values there are meant for pre-boot consumption (e.g. +* startup_xen). +*/ +if (sec_applies->shdr.sh_type ==SHT_NOTE ) { +continue ; + } sh_symtab = sec_symtab->symtab; sym_strtab = sec_symtab->link->strtab;for (j =0 ; j < sec->shdr.sh_size/sizeof (Elf_Rel); j++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 284/638 SUNRPC: fix a memleak in gss_import_v2_context
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit e67b652d8e8591d3b1e569dbcdfcee15993e91fa ]
The ctx->mech_used.data allocated by kmemdup is not freed in neither gss_import_v2_context nor it only caller gss_krb5_import_sec_context, which frees ctx on error.
Thus, this patch reform the last call of gss_import_v2_context to the gss_krb5_import_ctx_v2, preventing the memleak while keepping the return formation.
--- net/sunrpc/auth_gss/gss_krb5_mech.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_krb5_mech.c +10 -1
@@ -398,6 +398,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,u64 seq_send64;int keylen;u32 time32; +int ret; p =simple_get_bytes (p, end, &ctx->flags,sizeof (ctx->flags));if (IS_ERR (p))
@@ -450,8 +451,16 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx, } ctx->mech_used.len = gss_kerberos_mech.gm_oid.len; -return gss_krb5_import_ctx_v2 (ctx, gfp_mask); + ret =gss_krb5_import_ctx_v2 (ctx, gfp_mask); +if (ret) { + p =ERR_PTR (ret); + goto out_free; + } +return 0 ; + +out_free: +kfree (ctx->mech_used.data); out_err:return PTR_ERR (p); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 285/638 SUNRPC: fix some memleaks in gssx_dec_option_array
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 3cfcfc102a5e57b021b786a755a38935e357797d ]
The creds and oa->data need to be freed in the error-handling paths after their allocation. So this patch add these deallocations in the corresponding paths.
--- net/sunrpc/auth_gss/gss_rpc_xdr.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
net/sunrpc/auth_gss/gss_rpc_xdr.c +19 -8
@@ -250,8 +250,8 @@ static int gssx_dec_option_array(struct xdr_stream *xdr, creds =kzalloc (sizeof (struct svc_cred ),GFP_KERNEL );if (!creds) { -kfree (oa->data); -return -ENOMEM ; + err = -ENOMEM ; + goto free_oa; } oa->data[0 ].option.data =CREDS_VALUE ;
@@ -265,29 +265,40 @@ static int gssx_dec_option_array(struct xdr_stream *xdr,/* option buffer */ p =xdr_inline_decode (xdr,4 ); -if (unlikely (p ==NULL )) -return -ENOSPC ; +if (unlikely (p ==NULL )) { + err = -ENOSPC ; + goto free_creds; + } length =be32_to_cpup (p); p =xdr_inline_decode (xdr, length); -if (unlikely (p ==NULL )) -return -ENOSPC ; +if (unlikely (p ==NULL )) { + err = -ENOSPC ; + goto free_creds; + }if (length ==sizeof (CREDS_VALUE ) &&memcmp (p,CREDS_VALUE ,sizeof (CREDS_VALUE )) ==0 ) {/* We have creds here. parse them */ err =gssx_dec_linux_creds (xdr, creds);if (err) -return err; + goto free_creds; oa->data[0 ].value.len =1 ;/* presence */ }else {/* consume uninteresting buffer */ err =gssx_dec_buffer (xdr, &dummy);if (err) -return err; + goto free_creds; } }return 0 ; + +free_creds: +kfree (creds); +free_oa: +kfree (oa->data); + oa->data =NULL ; +return err; } static int gssx_dec_status(struct xdr_stream *xdr,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 286/638 arm64: dts: qcom: sm8550: Fix SPMI channels size
In reply to Sasha LevinFrom: Abel Vesa <[email protected]>
[ Upstream commit 77dd1e50ffcba33c3195ae4fc78f354368ddacb2 ]
The actual size of the channels registers region is 4MB, according to the documentation. This issue was not caught until now because the driver was supposed to allow same regions being mapped multiple times for supporting multiple buses. Thie driver is using platform_get_resource_byname() and devm_ioremap() towards that purpose, which intentionally avoids devm_request_mem_region() altogether.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +1 -1
@@ -3017,7 +3017,7 @@ sram@c3f0000 { spmi_bus: spmi@c400000 { compatible = "qcom,spmi-pmic-arb"; reg = <0 0x0c400000 0 0x3000>, - <0 0x0c500000 0 0x4000000>, + <0 0x0c500000 0 0x400000>, <0 0x0c440000 0 0x80000>, <0 0x0c4c0000 0 0x20000>, <0 0x0c42d000 0 0x4000>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 287/638 mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ae5004a40a262d329039b99b62bd3fe7645b66ad ]
This looks strange to call release_mem_region() in a remove function without any request_mem_region() in the probe or "struct resource" somewhere.
So remove the corresponding code.
--- drivers/mmc/host/wmt-sdmmc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mmc/host/wmt-sdmmc.c +0 -4
@@ -883,7 +883,6 @@ static void wmt_mci_remove(struct platform_device *pdev) {struct mmc_host *mmc;struct wmt_mci_priv *priv; -struct resource *res;u32 reg_tmp; mmc =platform_get_drvdata (pdev);
@@ -911,9 +910,6 @@ static void wmt_mci_remove(struct platform_device *pdev)clk_disable_unprepare (priv->clk_sdmmc);clk_put (priv->clk_sdmmc); - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,resource_size (res)); -mmc_free_host (mmc);dev_info (&pdev->dev,"WMT MCI device removed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 288/638 ACPI: CPPC: enable AMD CPPC V2 support for family 17h processors
In reply to Sasha LevinFrom: Perry Yuan <[email protected]>
[ Upstream commit a51ab63b297ce9e26e3ffb9be896018a42d5f32f ]
As there are some AMD processors which only support CPPC V2 firmware and BIOS implementation, the amd_pstate driver will be failed to load when system booting with below kernel warning message:
[ 0.477523] amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
To make the amd_pstate driver can be loaded on those TR40 processors, it needs to match x86_model from 0x30 to 0x7F for family 17H. With the change, the system can load amd_pstate driver as expected.
--- arch/x86/kernel/acpi/cppc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/acpi/cppc.c +1 -1
@@ -20,7 +20,7 @@ bool cpc_supported_by_cpu(void) (boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f)))return true; else if (boot_cpu_data.x86 == 0x17 && - boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f) + boot_cpu_data.x86_model >= 0x30 && boot_cpu_data.x86_model <= 0x7f) return true;return boot_cpu_has (X86_FEATURE_CPPC ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 289/638 wifi: rtw88: 8821cu: Fix firmware upload fail
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 41a7acb7dde8395f52a707bbba7712a898dfafb0 ]
RTL8822CU, RTL8822BU, and RTL8821CU need an extra register write after reading and writing certain addresses.
Without this, the firmware upload fails approximately more than 50% of the time.
Tested with RTL8811CU (Tenda U9 V2.0) which is the same as RTL8821CU but without Bluetooth.
--- drivers/net/wireless/realtek/rtw88/usb.c | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/net/wireless/realtek/rtw88/usb.c +40 -0
@@ -33,6 +33,36 @@ static void rtw_usb_fill_tx_checksum(struct rtw_usb *rtwusb,rtw_tx_fill_txdesc_checksum (rtwdev, &pkt_info, skb->data); } +static void rtw_usb_reg_sec (struct rtw_dev *rtwdev,u32 addr,__le32 *data) +{ +struct rtw_usb *rtwusb =rtw_get_usb_priv (rtwdev); +struct usb_device *udev = rtwusb->udev; +bool reg_on_section = false; +u16 t_reg =0x4e0 ; +u8 t_len =1 ; +int status; + +/* There are three sections: +* 1. on (0x00~0xFF; 0x1000~0x10FF): this section is always powered on +* 2. off (< 0xFE00, excluding "on" section): this section could be +* powered off +* 3. local (>= 0xFE00): usb specific registers section +*/ +if (addr <=0xff || (addr >=0x1000 && addr <=0x10ff )) + reg_on_section = true; + +if (!reg_on_section) +return ; + + status =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ), +RTW_USB_CMD_REQ ,RTW_USB_CMD_WRITE , + t_reg,0 , data, t_len,500 ); + +if (status != t_len && status != -ENODEV ) +rtw_err (rtwdev,"%s: reg 0x%x, usb write %u fail, status: %d\n" , + __func__, t_reg, t_len, status); +} +static u32 rtw_usb_read (struct rtw_dev *rtwdev,u32 addr,u16 len) {struct rtw_usb *rtwusb =rtw_get_usb_priv (rtwdev);
@@ -58,6 +88,11 @@ static u32 rtw_usb_read(struct rtw_dev *rtwdev, u32 addr, u16 len)rtw_err (rtwdev,"read register 0x%x failed with %d\n" , addr, ret); +if (rtwdev->chip->id ==RTW_CHIP_TYPE_8822C || + rtwdev->chip->id ==RTW_CHIP_TYPE_8822B || + rtwdev->chip->id ==RTW_CHIP_TYPE_8821C ) +rtw_usb_reg_sec (rtwdev, addr, data); +return le32_to_cpu (*data); }
@@ -102,6 +137,11 @@ static void rtw_usb_write(struct rtw_dev *rtwdev, u32 addr, u32 val, int len)if (ret <0 && ret != -ENODEV && count++ <4 )rtw_err (rtwdev,"write register 0x%x failed with %d\n" , addr, ret); + +if (rtwdev->chip->id ==RTW_CHIP_TYPE_8822C || + rtwdev->chip->id ==RTW_CHIP_TYPE_8822B || + rtwdev->chip->id ==RTW_CHIP_TYPE_8821C ) +rtw_usb_reg_sec (rtwdev, addr, data); }static void rtw_usb_write8 (struct rtw_dev *rtwdev,u32 addr,u8 val)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 290/638 wifi: rtw88: 8821c: Fix beacon loss and disconnect
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit e1dfa21427baeb813f9a2f9ceab6b7d32c3ca425 ]
Tenda U9 V2.0, which contains RTL8811CU, is practically unusable because of frequent disconnections:
Feb 23 14:46:45 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:46:46 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
Feb 23 14:46:52 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-CONNECTED - Connection to 90:55:de:__:__:__ completed [id=0 id_str=] Feb 23 14:46:54 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:46:55 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
Feb 23 14:47:01 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-CONNECTED - Connection to 90:55:de:__:__:__ completed [id=0 id_str=] Feb 23 14:47:04 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-BEACON-LOSS Feb 23 14:47:05 ideapad2 wpa_supplicant[427]: wlp3s0f3u2: CTRL-EVENT-DISCONNECTED bssid=90:55:de:__:__:__ reason=4 locally_generated=1
This is caused by a mistake in the chip initialisation. This version of the chip requires loading an extra AGC table right after the main one, but the extra table is being loaded at the wrong time, in rtw_chip_board_info_setup().
Move the extra AGC table loading to the right place, in rtw_phy_load_tables().
The rtw_chip_board_info_setup() can only do "software" things, and rtw_phy_load_tables() can really do IO.
--- drivers/net/wireless/realtek/rtw88/main.c | 2 -- drivers/net/wireless/realtek/rtw88/phy.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +0 -2
@@ -2027,8 +2027,6 @@ static int rtw_chip_board_info_setup(struct rtw_dev *rtwdev)rtw_phy_setup_phy_cond (rtwdev, hal->pkg_type);rtw_phy_init_tx_power (rtwdev); -if (rfe_def->agc_btg_tbl) -rtw_load_table (rtwdev, rfe_def->agc_btg_tbl);rtw_load_table (rtwdev, rfe_def->phy_pg_tbl);rtw_load_table (rtwdev, rfe_def->txpwr_lmt_tbl);rtw_phy_tx_power_by_rate_config (hal);
drivers/net/wireless/realtek/rtw88/phy.c +3 -0
@@ -1761,12 +1761,15 @@ static void rtw_load_rfk_table(struct rtw_dev *rtwdev)void rtw_phy_load_tables (struct rtw_dev *rtwdev) { +const struct rtw_rfe_def *rfe_def =rtw_get_rfe_def (rtwdev);const struct rtw_chip_info *chip = rtwdev->chip;u8 rf_path;rtw_load_table (rtwdev, chip->mac_tbl);rtw_load_table (rtwdev, chip->bb_tbl);rtw_load_table (rtwdev, chip->agc_tbl); +if (rfe_def->agc_btg_tbl) +rtw_load_table (rtwdev, rfe_def->agc_btg_tbl);rtw_load_rfk_table (rtwdev);for (rf_path =0 ; rf_path < rtwdev->hal.rf_path_num; rf_path++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 291/638 wifi: rtw88: 8821c: Fix false alarm count
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit c238adbc578eeb70cbc8fdd1bef3666b0f585b13 ]
total_fa_cnt is supposed to include cck_fa_cnt and ofdm_fa_cnt, not just ofdm_fa_cnt.
--- drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/rtw8821c.c +1 -1
@@ -706,9 +706,9 @@ static void rtw8821c_false_alarm_statistics(struct rtw_dev *rtwdev) dm_info->cck_fa_cnt = cck_fa_cnt; dm_info->ofdm_fa_cnt = ofdm_fa_cnt; + dm_info->total_fa_cnt = ofdm_fa_cnt;if (cck_enable) dm_info->total_fa_cnt += cck_fa_cnt; - dm_info->total_fa_cnt = ofdm_fa_cnt; crc32_cnt =rtw_read32 (rtwdev,REG_CRC_CCK ); dm_info->cck_ok_cnt =FIELD_GET (GENMASK (15 ,0 ), crc32_cnt);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 292/638 wifi: brcm80211: handle pmk_op allocation failure
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit b4152222e04cb8afeeca239c90e3fcaf4c553b42 ]
The kzalloc() in brcmf_pmksa_v3_op() will return null if the physical memory has run out. As a result, if we dereference the null value, the null pointer dereference bug will happen.
Return -ENOMEM from brcmf_pmksa_v3_op() if kzalloc() fails for pmk_op.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +3 -0
@@ -4323,6 +4323,9 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp, struct cfg80211_pmksa *pmksa,int ret; pmk_op =kzalloc (sizeof (*pmk_op),GFP_KERNEL ); +if (!pmk_op) +return -ENOMEM ; + pmk_op->version =cpu_to_le16 (BRCMF_PMKSA_VER_3 );if (!pmksa) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 293/638 PCI: Make pci_dev_is_disconnected() helper public for other drivers
In reply to Sasha LevinFrom: Ethan Zhao <[email protected]>
[ Upstream commit 39714fd73c6b60a8d27bcc5b431afb0828bf4434 ]
Make pci_dev_is_disconnected() public so that it can be called from Intel VT-d driver to quickly fix/workaround the surprise removal unplug hang issue for those ATS capable devices on PCIe switch downstream hotplug capable ports.
Beside pci_device_is_present() function, this one has no config space space access, so is light enough to optimize the normal pure surprise removal and safe removal flow.
Stable-dep-of: 4fc82cd907ac ("iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected")
--- drivers/pci/pci.h | 5 ----- include/linux/pci.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci.h +0 -5
@@ -363,11 +363,6 @@ static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)return 0 ; } -static inline bool pci_dev_is_disconnected (const struct pci_dev *dev) -{ -return dev->error_state == pci_channel_io_perm_failure; -} -/* pci_dev priv_flags */ #define PCI_DEV_ADDED 0#define PCI_DPC_RECOVERED 1
include/linux/pci.h +5 -0
@@ -2477,6 +2477,11 @@ static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)return NULL ; } +static inline bool pci_dev_is_disconnected (const struct pci_dev *dev) +{ +return dev->error_state == pci_channel_io_perm_failure; +} +void pci_request_acs (void );bool pci_acs_enabled (struct pci_dev *pdev,u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 294/638 iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected
In reply to Sasha LevinFrom: Ethan Zhao <[email protected]>
[ Upstream commit 4fc82cd907ac075648789cc3a00877778aa1838b ]
For those endpoint devices connect to system via hotplug capable ports, users could request a hot reset to the device by flapping device's link through setting the slot's link control register, as pciehp_ist() DLLSC interrupt sequence response, pciehp will unload the device driver and then power it off. thus cause an IOMMU device-TLB invalidation (Intel VT-d spec, or ATS Invalidation in PCIe spec r6.1) request for non-existence target device to be sent and deadly loop to retry that request after ITE fault triggered in interrupt context.
That would cause following continuous hard lockup warning and system hang
[ 4211.433662] pcieport 0000:17:01.0: pciehp: Slot(108): Link Down
[ 4211.433664] pcieport 0000:17:01.0: pciehp: Slot(108): Card not present
[ 4223.822591] NMI watchdog: Watchdog detected hard LOCKUP on cpu 144
[ 4223.822622] CPU: 144 PID: 1422 Comm: irq/57-pciehp Kdump: loaded Tainted: G S
OE kernel version xxxx
[ 4223.822623] Hardware name: vendorname xxxx 666-106,
BIOS 01.01.02.03.01 05/15/2023
[ 4223.822623] RIP: 0010:qi_submit_sync+0x2c0/0x490
[ 4223.822624] Code: 48 be 00 00 00 00 00 08 00 00 49 85 74 24 20 0f 95 c1 48 8b
57 10 83 c1 04 83 3c 1a 03 0f 84 a2 01 00 00 49 8b 04 24 8b 70 34 <40> f6 c6 1
0 74 17 49 8b 04 24 8b 80 80 00 00 00 89 c2 d3 fa 41 39
[ 4223.822624] RSP: 0018:ffffc4f074f0bbb8 EFLAGS: 00000093
[ 4223.822625] RAX: ffffc4f040059000 RBX: 0000000000000014 RCX: 0000000000000005
[ 4223.822625] RDX: ffff9f3841315800 RSI: 0000000000000000 RDI: ffff9f38401a8340
[ 4223.822625] RBP: ffff9f38401a8340 R08: ffffc4f074f0bc00 R09: 0000000000000000
[ 4223.822626] R10: 0000000000000010 R11: 0000000000000018 R12: ffff9f384005e200
[ 4223.822626] R13: 0000000000000004 R14: 0000000000000046 R15: 0000000000000004
[ 4223.822626] FS: 0000000000000000(0000) GS:ffffa237ae400000(0000)
knlGS:0000000000000000
[ 4223.822627] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4223.822627] CR2: 00007ffe86515d80 CR3: 000002fd3000a001 CR4: 0000000000770ee0
[ 4223.822627] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 4223.822628] DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
[ 4223.822628] PKRU: 55555554
[ 4223.822628] Call Trace:
[ 4223.822628] qi_flush_dev_iotlb+0xb1/0xd0
[ 4223.822628] __dmar_remove_one_dev_info+0x224/0x250
[ 4223.822629] dmar_remove_one_dev_info+0x3e/0x50
[ 4223.822629] intel_iommu_release_device+0x1f/0x30
[ 4223.822629] iommu_release_device+0x33/0x60
[ 4223.822629] iommu_bus_notifier+0x7f/0x90
[ 4223.822630] blocking_notifier_call_chain+0x60/0x90
[ 4223.822630] device_del+0x2e5/0x420
[ 4223.822630] pci_remove_bus_device+0x70/0x110
[ 4223.822630] pciehp_unconfigure_device+0x7c/0x130
[ 4223.822631] pciehp_disable_slot+0x6b/0x100
[ 4223.822631] pciehp_handle_presence_or_link_change+0xd8/0x320
[ 4223.822631] pciehp_ist+0x176/0x180
[ 4223.822631] ? irq_finalize_oneshot.part.50+0x110/0x110
[ 4223.822632] irq_thread_fn+0x19/0x50
[ 4223.822632] irq_thread+0x104/0x190
[ 4223.822632] ? irq_forced_thread_fn+0x90/0x90
[ 4223.822632] ? irq_thread_check_affinity+0xe0/0xe0
[ 4223.822633] kthread+0x114/0x130
[ 4223.822633] ? __kthread_cancel_work+0x40/0x40
[ 4223.822633] ret_from_fork+0x1f/0x30
[ 4223.822633] Kernel panic - not syncing: Hard LOCKUP
[ 4223.822634] CPU: 144 PID: 1422 Comm: irq/57-pciehp Kdump: loaded Tainted: G S
OE kernel version xxxx
[ 4223.822634] Hardware name: vendorname xxxx 666-106,
BIOS 01.01.02.03.01 05/15/2023
[ 4223.822634] Call Trace:
[ 4223.822634] <NMI>
[ 4223.822635] dump_stack+0x6d/0x88
[ 4223.822635] panic+0x101/0x2d0
[ 4223.822635] ? ret_from_fork+0x11/0x30
[ 4223.822635] nmi_panic.cold.14+0xc/0xc
[ 4223.822636] watchdog_overflow_callback.cold.8+0x6d/0x81
[ 4223.822636] __perf_event_overflow+0x4f/0xf0
[ 4223.822636] handle_pmi_common+0x1ef/0x290
[ 4223.822636] ? __set_pte_vaddr+0x28/0x40
[ 4223.822637] ? flush_tlb_one_kernel+0xa/0x20
[ 4223.822637] ? __native_set_fixmap+0x24/0x30
[ 4223.822637] ? ghes_copy_tofrom_phys+0x70/0x100
[ 4223.822637] ? __ghes_peek_estatus.isra.16+0x49/0xa0
[ 4223.822637] intel_pmu_handle_irq+0xba/0x2b0
[ 4223.822638] perf_event_nmi_handler+0x24/0x40
[ 4223.822638] nmi_handle+0x4d/0xf0
[ 4223.822638] default_do_nmi+0x49/0x100
[ 4223.822638] exc_nmi+0x134/0x180
[ 4223.822639] end_repeat_nmi+0x16/0x67
[ 4223.822639] RIP: 0010:qi_submit_sync+0x2c0/0x490
[ 4223.822639] Code: 48 be 00 00 00 00 00 08 00 00 49 85 74 24 20 0f 95 c1 48 8b
57 10 83 c1 04 83 3c 1a 03 0f 84 a2 01 00 00 49 8b 04 24 8b 70 34 <40> f6 c6 10
74 17 49 8b 04 24 8b 80 80 00 00 00 89 c2 d3 fa 41 39
[ 4223.822640] RSP: 0018:ffffc4f074f0bbb8 EFLAGS: 00000093
[ 4223.822640] RAX: ffffc4f040059000 RBX: 0000000000000014 RCX: 0000000000000005
[ 4223.822640] RDX: ffff9f3841315800 RSI: 0000000000000000 RDI: ffff9f38401a8340
[ 4223.822641] RBP: ffff9f38401a8340 R08: ffffc4f074f0bc00 R09: 0000000000000000
[ 4223.822641] R10: 0000000000000010 R11: 0000000000000018 R12: ffff9f384005e200
[ 4223.822641] R13: 0000000000000004 R14: 0000000000000046 R15: 0000000000000004
[ 4223.822641] ? qi_submit_sync+0x2c0/0x490
[ 4223.822642] ? qi_submit_sync+0x2c0/0x490
[ 4223.822642] </NMI>
[ 4223.822642] qi_flush_dev_iotlb+0xb1/0xd0
[ 4223.822642] __dmar_remove_one_dev_info+0x224/0x250
[ 4223.822643] dmar_remove_one_dev_info+0x3e/0x50
[ 4223.822643] intel_iommu_release_device+0x1f/0x30
[ 4223.822643] iommu_release_device+0x33/0x60
[ 4223.822643] iommu_bus_notifier+0x7f/0x90
[ 4223.822644] blocking_notifier_call_chain+0x60/0x90
[ 4223.822644] device_del+0x2e5/0x420
[ 4223.822644] pci_remove_bus_device+0x70/0x110
[ 4223.822644] pciehp_unconfigure_device+0x7c/0x130
[ 4223.822644] pciehp_disable_slot+0x6b/0x100
[ 4223.822645] pciehp_handle_presence_or_link_change+0xd8/0x320
[ 4223.822645] pciehp_ist+0x176/0x180
[ 4223.822645] ? irq_finalize_oneshot.part.50+0x110/0x110
[ 4223.822645] irq_thread_fn+0x19/0x50
[ 4223.822646] irq_thread+0x104/0x190
[ 4223.822646] ? irq_forced_thread_fn+0x90/0x90
[ 4223.822646] ? irq_thread_check_affinity+0xe0/0xe0
[ 4223.822646] kthread+0x114/0x130
[ 4223.822647] ? __kthread_cancel_work+0x40/0x40
[ 4223.822647] ret_from_fork+0x1f/0x30
[ 4223.822647] Kernel Offset: 0x6400000 from 0xffffffff81000000 (relocationrange: 0xffffffff80000000-0xffffffffbfffffff)
Such issue could be triggered by all kinds of regular surprise removal hotplug operation. like:
1. pull EP(endpoint device) out directly.
2. turn off EP's power.
3. bring the link down.
etc.
this patch aims to work for regular safe removal and surprise removal unplug. these hot unplug handling process could be optimized for fix the ATS Invalidation hang issue by calling pci_dev_is_disconnected() in function devtlb_invalidation_with_pasid() to check target device state to avoid sending meaningless ATS Invalidation request to iommu when device is gone. (see IMPLEMENTATION NOTE in PCIe spec r6.1 section 10.3.1)
For safe removal, device wouldn't be removed until the whole software handling process is done, it wouldn't trigger the hard lock up issue caused by too long ATS Invalidation timeout wait. In safe removal path, device state isn't set to pci_channel_io_perm_failure in pciehp_unconfigure_device() by checking 'presence' parameter, calling pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will return false there, wouldn't break the function.
For surprise removal, device state is set to pci_channel_io_perm_failure in pciehp_unconfigure_device(), means device is already gone (disconnected) call pci_dev_is_disconnected() in devtlb_invalidation_with_pasid() will return true to break the function not to send ATS Invalidation request to the disconnected device blindly, thus avoid to trigger further ITE fault, and ITE fault will block all invalidation request to be handled. furthermore retry the timeout request could trigger hard lockup.
safe removal (present) & surprise removal (not present)
pciehp_ist()
pciehp_handle_presence_or_link_change()
pciehp_disable_slot()
remove_board()
pciehp_unconfigure_device(presence) {
if (!presence)
pci_walk_bus(parent, pci_dev_set_disconnected, NULL);
}this patch works for regular safe removal and surprise removal of ATS capable endpoint on PCIe switch downstream ports.
--- drivers/iommu/intel/pasid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/intel/pasid.c +3 -0
@@ -428,6 +428,9 @@ devtlb_invalidation_with_pasid(struct intel_iommu *iommu,if (!info || !info->ats_enabled)return ; +if (pci_dev_is_disconnected (to_pci_dev (dev))) +return ; + sid = info->bus <<8 | info->devfn; qdep = info->ats_qdep; pfsid = info->pfsid;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 295/638 igc: Fix missing time sync events
In reply to Sasha LevinFrom: Vinicius Costa Gomes <[email protected]>
[ Upstream commit 244ae992e3e80e5c9c272c77324c831148457f95 ]
Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed.
The IGC_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1.
The following flow was used:
1. read IGC_TSIRC into 'tsicr';
2. handle the interrupts present in 'tsirc' and mark them in 'ack';
3. write 'ack' into IGC_TSICR;
As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed.
Remove the extra clear in (3).
--- drivers/net/ethernet/intel/igc/igc_main.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -11
@@ -5304,25 +5304,22 @@ igc_features_check(struct sk_buff *skb, struct net_device *dev,static void igc_tsync_interrupt (struct igc_adapter *adapter) { -u32 ack, tsauxc, sec, nsec, tsicr;struct igc_hw *hw = &adapter->hw; +u32 tsauxc, sec, nsec, tsicr;struct ptp_clock_event event;struct timespec64 ts; tsicr =rd32 (IGC_TSICR ); - ack =0 ;if (tsicr &IGC_TSICR_SYS_WRAP ) { event.type =PTP_CLOCK_PPS ;if (adapter->ptp_caps.pps)ptp_clock_event (adapter->ptp_clock, &event); - ack |=IGC_TSICR_SYS_WRAP ; }if (tsicr &IGC_TSICR_TXTS ) {/* retrieve hardware timestamp */ igc_ptp_tx_tstamp_event (adapter); - ack |=IGC_TSICR_TXTS ; }if (tsicr &IGC_TSICR_TT0 ) {
@@ -5336,7 +5333,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)wr32 (IGC_TSAUXC , tsauxc); adapter->perout[0 ].start = ts;spin_unlock (&adapter->tmreg_lock); - ack |=IGC_TSICR_TT0 ; }if (tsicr &IGC_TSICR_TT1 ) {
@@ -5350,7 +5346,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter)wr32 (IGC_TSAUXC , tsauxc); adapter->perout[1 ].start = ts;spin_unlock (&adapter->tmreg_lock); - ack |=IGC_TSICR_TT1 ; }if (tsicr &IGC_TSICR_AUTT0 ) {
@@ -5360,7 +5355,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) event.index =0 ; event.timestamp = sec *NSEC_PER_SEC + nsec;ptp_clock_event (adapter->ptp_clock, &event); - ack |=IGC_TSICR_AUTT0 ; }if (tsicr &IGC_TSICR_AUTT1 ) {
@@ -5370,11 +5364,7 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) event.index =1 ; event.timestamp = sec *NSEC_PER_SEC + nsec;ptp_clock_event (adapter->ptp_clock, &event); - ack |=IGC_TSICR_AUTT1 ; } - -/* acknowledge the interrupts */ -wr32 (IGC_TSICR , ack); }/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 296/638 igb: Fix missing time sync events
In reply to Sasha LevinFrom: Vinicius Costa Gomes <[email protected]>
[ Upstream commit ee14cc9ea19ba9678177e2224a9c58cce5937c73 ]
Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed.
The E1000_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1.
The following flow was used:
1. read E1000_TSIRC into 'tsicr';
2. handle the interrupts present into 'tsirc' and mark them in 'ack';
3. write 'ack' into E1000_TSICR;
As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed.
Remove the extra clear in (3).
--- drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +5 -18
@@ -6985,44 +6985,31 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)static void igb_tsync_interrupt (struct igb_adapter *adapter) {struct e1000_hw *hw = &adapter->hw; -u32 ack =0 , tsicr =rd32 (E1000_TSICR ); +u32 tsicr =rd32 (E1000_TSICR );struct ptp_clock_event event;if (tsicr &TSINTR_SYS_WRAP ) { event.type =PTP_CLOCK_PPS ;if (adapter->ptp_caps.pps)ptp_clock_event (adapter->ptp_clock, &event); - ack |=TSINTR_SYS_WRAP ; }if (tsicr &E1000_TSICR_TXTS ) {/* retrieve hardware timestamp */ schedule_work (&adapter->ptp_tx_work); - ack |=E1000_TSICR_TXTS ; } -if (tsicr &TSINTR_TT0 ) { +if (tsicr &TSINTR_TT0 )igb_perout (adapter,0 ); - ack |=TSINTR_TT0 ; - } -if (tsicr &TSINTR_TT1 ) { +if (tsicr &TSINTR_TT1 )igb_perout (adapter,1 ); - ack |=TSINTR_TT1 ; - } -if (tsicr &TSINTR_AUTT0 ) { +if (tsicr &TSINTR_AUTT0 )igb_extts (adapter,0 ); - ack |=TSINTR_AUTT0 ; - } -if (tsicr &TSINTR_AUTT1 ) { +if (tsicr &TSINTR_AUTT1 )igb_extts (adapter,1 ); - ack |=TSINTR_AUTT1 ; - } - -/* acknowledge the interrupts */ -wr32 (E1000_TSICR , ack); }static irqreturn_t igb_msix_other (int irq,void *data)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 297/638 ice: fix stats being updated by way too large values
In reply to Sasha LevinFrom: Przemek Kitszel <[email protected]>
[ Upstream commit 257310e998700e60382fbd3f4fd275fdbd9b2aaf ]
Simplify stats accumulation logic to fix the case where we don't take previous stat value into account, we should always respect it.
Main netdev stats of our PF (Tx/Rx packets/bytes) were reported orders of magnitude too big during OpenStack reconfiguration events, possibly other reconfiguration cases too.
The regression was reported to be between 6.1 and 6.2, so I was almost certain that on of the two "preserve stats over reset" commits were the culprit. While reading the code, it was found that in some cases we will increase the stats by arbitrarily large number (thanks to ignoring "-prev" part of condition, after zeroing it).
Note that this fixes also the case where we were around limits of u64, but that was not the regression reported.
Full disclosure: I remember suggesting this particular piece of code to Ben a few years ago, so blame on me.
--- drivers/net/ethernet/intel/ice/ice_main.c | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +11 -13
@@ -6557,6 +6557,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) {struct rtnl_link_stats64 *net_stats, *stats_prev;struct rtnl_link_stats64 *vsi_stats; +struct ice_pf *pf = vsi->back;u64 pkts, bytes;int i;
@@ -6602,21 +6603,18 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) net_stats = &vsi->net_stats; stats_prev = &vsi->net_stats_prev; -/* clear prev counters after reset */ -if (vsi_stats->tx_packets < stats_prev->tx_packets || - vsi_stats->rx_packets < stats_prev->rx_packets) { - stats_prev->tx_packets =0 ; - stats_prev->tx_bytes =0 ; - stats_prev->rx_packets =0 ; - stats_prev->rx_bytes =0 ; +/* Update netdev counters, but keep in mind that values could start at +* random value after PF reset. And as we increase the reported stat by +* diff of Prev-Cur, we need to be sure that Prev is valid. If it's not, +* let's skip this round. +*/ +if (likely (pf->stat_prev_loaded)) { + net_stats->tx_packets += vsi_stats->tx_packets - stats_prev->tx_packets; + net_stats->tx_bytes += vsi_stats->tx_bytes - stats_prev->tx_bytes; + net_stats->rx_packets += vsi_stats->rx_packets - stats_prev->rx_packets; + net_stats->rx_bytes += vsi_stats->rx_bytes - stats_prev->rx_bytes; } -/* update netdev counters */ - net_stats->tx_packets += vsi_stats->tx_packets - stats_prev->tx_packets; - net_stats->tx_bytes += vsi_stats->tx_bytes - stats_prev->tx_bytes; - net_stats->rx_packets += vsi_stats->rx_packets - stats_prev->rx_packets; - net_stats->rx_bytes += vsi_stats->rx_bytes - stats_prev->rx_bytes; - stats_prev->tx_packets = vsi_stats->tx_packets; stats_prev->tx_bytes = vsi_stats->tx_bytes; stats_prev->rx_packets = vsi_stats->rx_packets;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 298/638 Bluetooth: Remove HCI_POWER_OFF_TIMEOUT
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit 968667f2e0345a67a6eea5a502f4659085666564 ]
With commit cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED"), the power off sequence got refactored so that this timeout was no longer necessary, let's remove the leftover define from the header too.
--- include/net/bluetooth/hci.h | 1 - 1 file changed, 1 deletion(-)
include/net/bluetooth/hci.h +0 -1
@@ -437,7 +437,6 @@ enum {#define HCI_NCMD_TIMEOUT msecs_to_jiffies(4000)/* 4 seconds */ #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000)/* 45 seconds */ #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000)/* 2 seconds */ -#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000)/* 5 seconds */ #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000)/* 20 seconds */ #define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000)/* 4 seconds */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 299/638 Bluetooth: mgmt: Remove leftover queuing of power_off work
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit fee054b7579fe252f8b9e6c17b9c5bfdaa84dd7e ]
Queuing of power_off work was introduced in these functions with commits 8b064a3ad377 ("Bluetooth: Clean up HCI state when doing power off") and c9910d0fb4fc ("Bluetooth: Fix disconnecting connections in non-connected states") in an effort to clean up state and do things like disconnecting devices before actually powering off the device.
After that, commit a3172b7eb4a2 ("Bluetooth: Add timer to force power off") introduced a timeout to ensure that the device actually got powered off, even if some of the cleanup work would never complete.
This code later got refactored with commit cf75ad8b41d2 ("Bluetooth:hci_sync: Convert MGMT_SET_POWERED"), which made powering off the device synchronous and removed the need for initiating the power_off work from other places. The timeout mentioned above got removed too, because we now also made use of the command timeout during power on/off.
These days the power_off work still exists, but it only seems to only be used for HCI_AUTO_OFF functionality, which is why we never noticed those two leftover places where we queue power_off work. So let's remove that code.
--- net/bluetooth/mgmt.c | 16 ---------------- 1 file changed, 16 deletions(-)
net/bluetooth/mgmt.c +0 -16
@@ -9766,14 +9766,6 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,struct mgmt_ev_device_disconnected ev;struct sock *sk =NULL ; -/* The connection is still in hci_conn_hash so test for 1 -* instead of 0 to know if this is the last one. -*/ -if (mgmt_powering_down (hdev) &&hci_conn_count (hdev) ==1 ) { -cancel_delayed_work (&hdev->power_off); -queue_work (hdev->req_workqueue, &hdev->power_off.work); - } -if (!mgmt_connected)return ;
@@ -9830,14 +9822,6 @@ void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, {struct mgmt_ev_connect_failed ev; -/* The connection is still in hci_conn_hash so test for 1 -* instead of 0 to know if this is the last one. -*/ -if (mgmt_powering_down (hdev) &&hci_conn_count (hdev) ==1 ) { -cancel_delayed_work (&hdev->power_off); -queue_work (hdev->req_workqueue, &hdev->power_off.work); - } -bacpy (&ev.addr.bdaddr, bdaddr); ev.addr.type =link_to_bdaddr (link_type, addr_type); ev.status =mgmt_status (status);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 300/638 Bluetooth: Remove superfluous call to hci_conn_check_pending()
In reply to Sasha LevinFrom: Jonas Dreßler <[email protected]>
[ Upstream commit 78e3639fc8031275010c3287ac548c0bc8de83b1 ]
The "pending connections" feature was originally introduced with commit 4c67bc74f016 ("[Bluetooth] Support concurrent connect requests") and 6bd57416127e ("[Bluetooth] Handling pending connect attempts after inquiry") to handle controllers supporting only a single connection request at a time. Later things were extended to also cancel ongoing inquiries on connect() with commit 89e65975fea5 ("Bluetooth: Cancel Inquiry before Create Connection").
With commit a9de9248064b ("[Bluetooth] Switch from OGF+OCF to using only opcodes"), hci_conn_check_pending() was introduced as a helper to consolidate a few places where we check for pending connections (indicated by the BT_CONNECT2 flag) and then try to connect.
This refactoring commit also snuck in two more calls to hci_conn_check_pending():
- One is in the failure callback of hci_cs_inquiry(), this one probably makes sense: If we send an "HCI Inquiry" command and then immediately after a "Create Connection" command, the "Create Connection" command might fail before the "HCI Inquiry" command, and then we want to retry the "Create Connection" on failure of the "HCI Inquiry".
- The other added call to hci_conn_check_pending() is in the event handler for the "Remote Name" event, this seems unrelated and is possibly a copy-paste error, so remove that one.
--- net/bluetooth/hci_event.c | 2 -- 1 file changed, 2 deletions(-)
net/bluetooth/hci_event.c +0 -2
@@ -3556,8 +3556,6 @@ static void hci_remote_name_evt(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"status 0x%2.2x" , ev->status); -hci_conn_check_pending (hdev); -hci_dev_lock (hdev); conn =hci_conn_hash_lookup_ba (hdev,ACL_LINK , &ev->bdaddr);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 301/638 Bluetooth: Remove BT_HS
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit e7b02296fb400ee64822fbdd81a0718449066333 ]
High Speed, Alternate MAC and PHY (AMP) extension, has been removed from Bluetooth Core specification on 5.3:
https://www.bluetooth.com/blog/new-core-specification-v5-3-feature-enhancements/
--- include/net/bluetooth/hci.h | 1 - include/net/bluetooth/l2cap.h | 42 -- net/bluetooth/Kconfig | 8 - net/bluetooth/Makefile | 1 - net/bluetooth/a2mp.c | 1054 -------------------------------- net/bluetooth/a2mp.h | 154 ----- net/bluetooth/amp.c | 590 ------------------ net/bluetooth/amp.h | 60 -- net/bluetooth/hci_conn.c | 4 - net/bluetooth/hci_event.c | 2 - net/bluetooth/l2cap_core.c | 1069 +-------------------------------- net/bluetooth/l2cap_sock.c | 18 +- net/bluetooth/mgmt.c | 73 +-- 13 files changed, 20 insertions(+), 3056 deletions(-) delete mode 100644 net/bluetooth/a2mp.c delete mode 100644 net/bluetooth/a2mp.h delete mode 100644 net/bluetooth/amp.c delete mode 100644 net/bluetooth/amp.h
include/net/bluetooth/hci.h +0 -1
@@ -393,7 +393,6 @@ enum {HCI_LIMITED_PRIVACY ,HCI_RPA_EXPIRED ,HCI_RPA_RESOLVING , -HCI_HS_ENABLED ,HCI_LE_ENABLED ,HCI_ADVERTISING , HCI_ADVERTISING_CONNECTABLE,
include/net/bluetooth/l2cap.h +0 -42
90 lines not on this page · raw message
net/bluetooth/Kconfig +0 -8
@@ -62,14 +62,6 @@ source "net/bluetooth/cmtp/Kconfig" source "net/bluetooth/hidp/Kconfig" -config BT_HS - bool "Bluetooth High Speed (HS) features" - depends on BT_BREDR - help - Bluetooth High Speed includes support for off-loading - Bluetooth connections via 802.11 (wifi) physical layer - available with Bluetooth version 3.0 or later. - config BT_LE bool "Bluetooth Low Energy (LE) features" depends on BT
net/bluetooth/Makefile +0 -1
@@ -21,7 +21,6 @@ bluetooth-$(CONFIG_DEV_COREDUMP) += coredump.o bluetooth-$(CONFIG_BT_BREDR) += sco.o bluetooth-$(CONFIG_BT_LE) += iso.o -bluetooth-$(CONFIG_BT_HS) += a2mp.o amp.o bluetooth-$(CONFIG_BT_LEDS) += leds.o bluetooth-$(CONFIG_BT_MSFTEXT) += msft.o bluetooth-$(CONFIG_BT_AOSPEXT) += aosp.o
net/bluetooth/a2mp.c deleted +0 -1054
1,054 lines not on this page · raw message
net/bluetooth/a2mp.h deleted +0 -154
154 lines not on this page · raw message
net/bluetooth/amp.c deleted +0 -590
590 lines not on this page · raw message
net/bluetooth/amp.h deleted +0 -60
60 lines not on this page · raw message
net/bluetooth/hci_conn.c +0 -4
@@ -36,7 +36,6 @@#include "hci_request.h" #include "smp.h" -#include "a2mp.h" #include "eir.h" struct sco_param {
@@ -1146,9 +1145,6 @@ void hci_conn_del(struct hci_conn *conn) } } -if (conn->amp_mgr) -amp_mgr_put (conn->amp_mgr); -skb_queue_purge (&conn->data_q);/* Remove the connection from the list and cleanup its remaining
net/bluetooth/hci_event.c +0 -2
@@ -36,8 +36,6 @@#include "hci_request.h" #include "hci_debugfs.h" #include "hci_codec.h" -#include "a2mp.h" -#include "amp.h" #include "smp.h" #include "msft.h" #include "eir.h"
net/bluetooth/l2cap_core.c +18 -1051
1,000 lines not on this page · raw message
net/bluetooth/mgmt.c +1 -72
73 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
Sasha Levin
maintainerPATCH 302/638 Bluetooth: hci_event: Fix not indicating new connection for BIG Sync
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit eeda1bf97bb500a901f7a9ee5615bad2160f2378 ]
BIG Sync (aka. Broadcast sink) requires to inform that the device is connected when a data path is active otherwise userspace could attempt to free resources allocated to the device object while scanning.
--- net/bluetooth/hci_event.c | 21 ++++++++++++++------- net/bluetooth/mgmt.c | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-)
net/bluetooth/hci_event.c +14 -7
@@ -2524,9 +2524,7 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,* Only those in BT_CONFIG or BT_CONNECTED states can be * considered connected. */ -if (conn && - (conn->state ==BT_CONFIG || conn->state ==BT_CONNECTED ) && - !test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) +if (conn && (conn->state ==BT_CONFIG || conn->state ==BT_CONNECTED ))mgmt_device_connected (hdev, conn, name, name_len);if (discov->state ==DISCOVERY_STOPPED )
@@ -3758,8 +3756,9 @@ static void hci_remote_features_evt(struct hci_dev *hdev, void *data,bacpy (&cp.bdaddr, &conn->dst); cp.pscan_rep_mode =0x02 ;hci_send_cmd (hdev,HCI_OP_REMOTE_NAME_REQ ,sizeof (cp), &cp); - }else if (!test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) + }else {mgmt_device_connected (hdev, conn,NULL ,0 ); + }if (!hci_outgoing_auth_needed (hdev, conn)) { conn->state =BT_CONNECTED ;
@@ -3932,6 +3931,11 @@ static u8 hci_cc_le_setup_iso_path(struct hci_dev *hdev, void *data,* last. */ hci_connect_cfm (conn, rp->status); + +/* Notify device connected in case it is a BIG Sync */ +if (!rp->status &&test_bit (HCI_CONN_BIG_SYNC , &conn->flags)) +mgmt_device_connected (hdev, conn,NULL ,0 ); +break ; }
@@ -5006,8 +5010,9 @@ static void hci_remote_ext_features_evt(struct hci_dev *hdev, void *data,bacpy (&cp.bdaddr, &conn->dst); cp.pscan_rep_mode =0x02 ;hci_send_cmd (hdev,HCI_OP_REMOTE_NAME_REQ ,sizeof (cp), &cp); - }else if (!test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) + }else {mgmt_device_connected (hdev, conn,NULL ,0 ); + }if (!hci_outgoing_auth_needed (hdev, conn)) { conn->state =BT_CONNECTED ;
@@ -5980,8 +5985,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, goto unlock; } -if (!test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) -mgmt_device_connected (hdev, conn,NULL ,0 ); +mgmt_device_connected (hdev, conn,NULL ,0 ); conn->sec_level =BT_SECURITY_LOW ; conn->state =BT_CONFIG ;
@@ -7220,6 +7224,9 @@ static void hci_le_big_info_adv_report_evt(struct hci_dev *hdev, void *data,/* Notify iso layer */ hci_connect_cfm (pa_sync,0x00 ); +/* Notify MGMT layer */ +mgmt_device_connected (hdev, pa_sync,NULL ,0 ); + unlock:hci_dev_unlock (hdev); }
net/bluetooth/mgmt.c +4 -0
@@ -3118,6 +3118,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,static u8 link_to_bdaddr (u8 link_type,u8 addr_type) {switch (link_type) { +case ISO_LINK :case LE_LINK :switch (addr_type) {case ADDR_LE_DEV_PUBLIC :
@@ -9610,6 +9611,9 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,u16 eir_len =0 ;u32 flags =0 ; +if (test_and_set_bit (HCI_CONN_MGMT_CONNECTED , &conn->flags)) +return ; +/* allocate buff for LE or BR/EDR adv */ if (conn->le_adv_data_len >0 ) skb = mgmt_alloc_skb(hdev, MGMT_EV_DEVICE_CONNECTED,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 303/638 Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
In reply to Sasha LevinFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 56d074d26c5828773b00b2185dd7e1d08273b8e8 ]
The optional variants for the gpiod_get() family of functions return NULL if the GPIO in question is not associated with this device. They return ERR_PTR() on any other error. NULL descriptors are graciously handled by GPIOLIB and can be safely passed to any of the GPIO consumer interfaces as they will return 0 and act as if the function succeeded. If one is using the optional variant, then there's no point in checking for NULL.
--- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_qca.c +3 -3
@@ -2295,7 +2295,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (qcadev->bt_en) && +if (IS_ERR (qcadev->bt_en) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 )) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" );
@@ -2304,7 +2304,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); -if (IS_ERR_OR_NULL (qcadev->sw_ctrl) && +if (IS_ERR (qcadev->sw_ctrl) && (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || data->soc_type ==QCA_WCN7850 ))
@@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)default : qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (IS_ERR_OR_NULL (qcadev->bt_en)) { +if (IS_ERR (qcadev->bt_en)) {dev_warn (&serdev->dev,"failed to acquire enable gpio\n" ); power_ctrl_enabled = false; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 304/638 Bluetooth: hci_core: Cancel request on command timeout
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 63298d6e752fc0ec7f5093860af8bc9f047b30c8 ]
If command has timed out call __hci_cmd_sync_cancel to notify the hci_req since it will inevitably cause a timeout.
This also rework the code around __hci_cmd_sync_cancel since it was wrongly assuming it needs to cancel timer as well, but sometimes the timers have not been started or in fact they already had timed out in which case they don't need to be cancel yet again.
Stable-dep-of: 2615fd9a7c25 ("Bluetooth: hci_sync: Fix overwriting request callback")
--- include/net/bluetooth/hci_sync.h | 2 +- net/bluetooth/hci_core.c | 84 ++++++++++++++++++++++---------- net/bluetooth/hci_request.c | 2 +- net/bluetooth/hci_sync.c | 20 ++++---- net/bluetooth/mgmt.c | 2 +- 5 files changed, 71 insertions(+), 39 deletions(-)
include/net/bluetooth/hci_sync.h +1 -1
@@ -42,7 +42,7 @@ int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen,void hci_cmd_sync_init (struct hci_dev *hdev);void hci_cmd_sync_clear (struct hci_dev *hdev);void hci_cmd_sync_cancel (struct hci_dev *hdev,int err); -void __hci_cmd_sync_cancel (struct hci_dev *hdev,int err); +void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err);int hci_cmd_sync_submit (struct hci_dev *hdev,hci_cmd_sync_work_func_t func,void *data,hci_cmd_sync_work_destroy_t destroy);
net/bluetooth/hci_core.c +57 -27
116 lines not on this page · raw message
net/bluetooth/hci_request.c +1 -1
@@ -895,7 +895,7 @@ void hci_request_setup(struct hci_dev *hdev)void hci_request_cancel_all (struct hci_dev *hdev) { -__hci_cmd_sync_cancel (hdev,ENODEV ); +hci_cmd_sync_cancel_sync (hdev,ENODEV );cancel_interleave_scan (hdev); }
net/bluetooth/hci_sync.c +11 -9
@@ -652,7 +652,7 @@ void hci_cmd_sync_clear(struct hci_dev *hdev)mutex_unlock (&hdev->cmd_sync_work_lock); } -void __hci_cmd_sync_cancel (struct hci_dev *hdev,int err) +void hci_cmd_sync_cancel (struct hci_dev *hdev,int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err);
@@ -660,15 +660,17 @@ void __hci_cmd_sync_cancel(struct hci_dev *hdev, int err) hdev->req_result = err; hdev->req_status =HCI_REQ_CANCELED ; -cancel_delayed_work_sync (&hdev->cmd_timer); -cancel_delayed_work_sync (&hdev->ncmd_timer); -atomic_set (&hdev->cmd_cnt,1 ); - -wake_up_interruptible (&hdev->req_wait_q); +queue_work (hdev->workqueue, &hdev->cmd_sync_cancel_work); } } +EXPORT_SYMBOL (hci_cmd_sync_cancel); -void hci_cmd_sync_cancel (struct hci_dev *hdev,int err) +/* Cancel ongoing command request synchronously: +* +* - Set result and mark status to HCI_REQ_CANCELED +* - Wakeup command sync thread +*/ +void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err);
@@ -676,10 +678,10 @@ void hci_cmd_sync_cancel(struct hci_dev *hdev, int err) hdev->req_result = err; hdev->req_status =HCI_REQ_CANCELED ; -queue_work (hdev->workqueue, &hdev->cmd_sync_cancel_work); +wake_up_interruptible (&hdev->req_wait_q); } } -EXPORT_SYMBOL (hci_cmd_sync_cancel); +EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);/* Submit HCI command to be run in as cmd_sync_work: *
net/bluetooth/mgmt.c +1 -1
@@ -1404,7 +1404,7 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,/* Cancel potentially blocking sync operation before power off */ if (cp->val ==0x00 ) { -__hci_cmd_sync_cancel (hdev, -EHOSTDOWN ); +hci_cmd_sync_cancel_sync (hdev, -EHOSTDOWN ); err =hci_cmd_sync_queue (hdev, set_powered_sync, cmd, mgmt_set_powered_complete); }else {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 305/638 Bluetooth: hci_sync: Fix overwriting request callback
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 2615fd9a7c2507eb3be3fbe49dcec88a2f56454a ]
In a few cases the stack may generate commands as responses to events which would happen to overwrite the sent_cmd, so this attempts to store the request in req_skb so even if sent_cmd is replaced with a new command the pending request will remain in stored in req_skb.
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_conn.c | 2 +- net/bluetooth/hci_core.c | 46 ++++++++++++++++++++++---------- net/bluetooth/hci_event.c | 18 ++++++------- net/bluetooth/hci_sync.c | 21 ++++++++++++--- 5 files changed, 61 insertions(+), 27 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -553,6 +553,7 @@ struct hci_dev {__u32 req_status;__u32 req_result;struct sk_buff *req_skb; +struct sk_buff *req_rsp;void *smp_data;void *smp_bredr_data;
net/bluetooth/hci_conn.c +1 -1
@@ -2936,7 +2936,7 @@ int hci_abort_conn(struct hci_conn *conn, u8 reason)case HCI_EV_LE_CONN_COMPLETE :case HCI_EV_LE_ENHANCED_CONN_COMPLETE :case HCI_EVT_LE_CIS_ESTABLISHED : -hci_cmd_sync_cancel (hdev, -ECANCELED ); +hci_cmd_sync_cancel (hdev,ECANCELED );break ; } }
net/bluetooth/hci_core.c +32 -14
92 lines not on this page · raw message
net/bluetooth/hci_event.c +9 -9
@@ -4381,7 +4381,7 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, void *data,* (since for this kind of commands there will not be a command * complete event). */ -if (ev->status || (hdev->sent_cmd && !hci_skb_event (hdev->sent_cmd))) { +if (ev->status || (hdev->req_skb && !hci_skb_event (hdev->req_skb))) {hci_req_cmd_complete (hdev, *opcode, ev->status, req_complete, req_complete_skb);if (hci_dev_test_flag (hdev,HCI_CMD_PENDING )) {
@@ -7337,10 +7337,10 @@ static void hci_le_meta_evt(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"subevent 0x%2.2x" , ev->subevent);/* Only match event if command OGF is for LE */ -if (hdev->sent_cmd && -hci_opcode_ogf (hci_skb_opcode (hdev->sent_cmd)) ==0x08 && -hci_skb_event (hdev->sent_cmd) == ev->subevent) { - *opcode =hci_skb_opcode (hdev->sent_cmd); +if (hdev->req_skb && +hci_opcode_ogf (hci_skb_opcode (hdev->req_skb)) ==0x08 && +hci_skb_event (hdev->req_skb) == ev->subevent) { + *opcode =hci_skb_opcode (hdev->req_skb);hci_req_cmd_complete (hdev, *opcode,0x00 , req_complete, req_complete_skb); }
@@ -7727,10 +7727,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) }/* Only match event if command OGF is not for LE */ -if (hdev->sent_cmd && -hci_opcode_ogf (hci_skb_opcode (hdev->sent_cmd)) !=0x08 && -hci_skb_event (hdev->sent_cmd) == event) { -hci_req_cmd_complete (hdev,hci_skb_opcode (hdev->sent_cmd), +if (hdev->req_skb && +hci_opcode_ogf (hci_skb_opcode (hdev->req_skb)) !=0x08 && +hci_skb_event (hdev->req_skb) == event) { +hci_req_cmd_complete (hdev,hci_skb_opcode (hdev->req_skb), status, &req_complete, &req_complete_skb); req_evt = event; }
net/bluetooth/hci_sync.c +18 -3
@@ -32,6 +32,10 @@ static void hci_cmd_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode, hdev->req_result = result; hdev->req_status =HCI_REQ_DONE ; +/* Free the request command so it is not used as response */ +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; +if (skb) {struct sock *sk =hci_skb_sk (skb);
@@ -39,7 +43,7 @@ static void hci_cmd_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,if (sk)sock_put (sk); - hdev->req_skb =skb_get (skb); + hdev->req_rsp =skb_get (skb); }wake_up_interruptible (&hdev->req_wait_q);
@@ -187,8 +191,8 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen, hdev->req_status =0 ; hdev->req_result =0 ; - skb = hdev->req_skb; - hdev->req_skb =NULL ; + skb = hdev->req_rsp; + hdev->req_rsp =NULL ;bt_dev_dbg (hdev,"end: err %d" , err);
@@ -4904,6 +4908,11 @@ int hci_dev_open_sync(struct hci_dev *hdev) hdev->sent_cmd =NULL ; } +if (hdev->req_skb) { +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; + } +clear_bit (HCI_RUNNING , &hdev->flags);hci_sock_dev_event (hdev,HCI_DEV_CLOSE );
@@ -5065,6 +5074,12 @@ int hci_dev_close_sync(struct hci_dev *hdev) hdev->sent_cmd =NULL ; } +/* Drop last request */ +if (hdev->req_skb) { +kfree_skb (hdev->req_skb); + hdev->req_skb =NULL ; + } +clear_bit (HCI_RUNNING , &hdev->flags);hci_sock_dev_event (hdev,HCI_DEV_CLOSE );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 306/638 Bluetooth: hci_h5: Add ability to allocate memory for private data
In reply to Sasha LevinFrom: Andrey Skvortsov <[email protected]>
[ Upstream commit 7a6d793e9ca8bc0c1d2f0aa0a02ec380d1124c74 ]
In some cases uart-base drivers may need to use priv data. For example, to store information needed for devcoredump.
--- drivers/bluetooth/hci_h5.c | 4 +++- drivers/bluetooth/hci_serdev.c | 9 +++++---- drivers/bluetooth/hci_uart.h | 12 +++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/bluetooth/hci_h5.c +3 -1
@@ -113,6 +113,7 @@ struct h5_vnd {int (*suspend)(struct h5 *h5);int (*resume)(struct h5 *h5);const struct acpi_gpio_mapping *acpi_gpio_map; +int sizeof_priv; };struct h5_device_data {
@@ -863,7 +864,8 @@ static int h5_serdev_probe(struct serdev_device *serdev)if (IS_ERR (h5->device_wake_gpio))return PTR_ERR (h5->device_wake_gpio); -return hci_uart_register_device (&h5->serdev_hu, &h5p); +return hci_uart_register_device_priv (&h5->serdev_hu, &h5p, + h5->vnd->sizeof_priv); }static void h5_serdev_remove (struct serdev_device *serdev)
drivers/bluetooth/hci_serdev.c +5 -4
@@ -300,8 +300,9 @@ static const struct serdev_device_ops hci_serdev_client_ops = { .write_wakeup = hci_uart_write_wakeup, }; -int hci_uart_register_device (struct hci_uart *hu, -const struct hci_uart_proto *p) +int hci_uart_register_device_priv (struct hci_uart *hu, +const struct hci_uart_proto *p, +int sizeof_priv) {int err;struct hci_dev *hdev;
@@ -325,7 +326,7 @@ int hci_uart_register_device(struct hci_uart *hu,set_bit (HCI_UART_PROTO_READY , &hu->flags);/* Initialize and register HCI device */ - hdev =hci_alloc_dev (); + hdev =hci_alloc_dev_priv (sizeof_priv);if (!hdev) {BT_ERR ("Can't allocate HCI device" ); err = -ENOMEM ;
@@ -394,7 +395,7 @@ int hci_uart_register_device(struct hci_uart *hu,percpu_free_rwsem (&hu->proto_lock);return err; } -EXPORT_SYMBOL_GPL (hci_uart_register_device); +EXPORT_SYMBOL_GPL (hci_uart_register_device_priv);void hci_uart_unregister_device (struct hci_uart *hu) {
drivers/bluetooth/hci_uart.h +11 -1
@@ -97,7 +97,17 @@ struct hci_uart {int hci_uart_register_proto (const struct hci_uart_proto *p);int hci_uart_unregister_proto (const struct hci_uart_proto *p); -int hci_uart_register_device (struct hci_uart *hu,const struct hci_uart_proto *p); + +int hci_uart_register_device_priv (struct hci_uart *hu, +const struct hci_uart_proto *p, +int sizeof_priv); + +static inline int hci_uart_register_device (struct hci_uart *hu, +const struct hci_uart_proto *p) +{ +return hci_uart_register_device_priv (hu, p,0 ); +} +void hci_uart_unregister_device (struct hci_uart *hu);int hci_uart_tx_wakeup (struct hci_uart *hu);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 307/638 Bluetooth: btrtl: fix out of bounds memory access
In reply to Sasha LevinFrom: Andrey Skvortsov <[email protected]>
[ Upstream commit de4e88ec58c4202efd1f02eebb4939bbf6945358 ]
The problem is detected by KASAN.
btrtl driver uses private hci data to store 'struct btrealtek_data'. If btrtl driver is used with btusb, then memory for private hci data is allocated in btusb. But no private data is allocated after hci_dev, when btrtl is used with hci_h5.
This commit adds memory allocation for hci_h5 case.
==================================================================
BUG: KASAN: slab-out-of-bounds in btrtl_initialize+0x6cc/0x958 [btrtl] Write of size 8 at addr ffff00000f5a5748 by task kworker/u9:0/76 Hardware name: Pine64 PinePhone (1.2) (DT) Workqueue: hci0 hci_power_on [bluetooth] Call trace: dump_backtrace+0x9c/0x128 show_stack+0x20/0x38 dump_stack_lvl+0x48/0x60 print_report+0xf8/0x5d8 kasan_report+0x90/0xd0 __asan_store8+0x9c/0xc0 [btrtl] h5_btrtl_setup+0xd0/0x2f8 [hci_uart] h5_setup+0x50/0x80 [hci_uart] hci_uart_setup+0xd4/0x260 [hci_uart] hci_dev_open_sync+0x1cc/0xf68 [bluetooth] hci_dev_do_open+0x34/0x90 [bluetooth] hci_power_on+0xc4/0x3c8 [bluetooth] process_one_work+0x328/0x6f0 worker_thread+0x410/0x778 kthread+0x168/0x178 ret_from_fork+0x10/0x20 Allocated by task 53: kasan_save_stack+0x3c/0x68 kasan_save_track+0x20/0x40 kasan_save_alloc_info+0x68/0x78 __kasan_kmalloc+0xd4/0xd8 __kmalloc+0x1b4/0x3b0 hci_alloc_dev_priv+0x28/0xa58 [bluetooth] hci_uart_register_device+0x118/0x4f8 [hci_uart] h5_serdev_probe+0xf4/0x178 [hci_uart] serdev_drv_probe+0x54/0xa0 really_probe+0x254/0x588 __driver_probe_device+0xc4/0x210 driver_probe_device+0x64/0x160 __driver_attach_async_helper+0x88/0x158 async_run_entry_fn+0xd0/0x388 process_one_work+0x328/0x6f0 worker_thread+0x410/0x778 kthread+0x168/0x178 ret_from_fork+0x10/0x20 Last potentially related work creation: kasan_save_stack+0x3c/0x68 __kasan_record_aux_stack+0xb0/0x150 kasan_record_aux_stack_noalloc+0x14/0x20 __queue_work+0x33c/0x960 queue_work_on+0x98/0xc0 hci_recv_frame+0xc8/0x1e8 [bluetooth] h5_complete_rx_pkt+0x2c8/0x800 [hci_uart] h5_rx_payload+0x98/0xb8 [hci_uart] h5_recv+0x158/0x3d8 [hci_uart] hci_uart_receive_buf+0xa0/0xe8 [hci_uart] ttyport_receive_buf+0xac/0x178 flush_to_ldisc+0x130/0x2c8 process_one_work+0x328/0x6f0 worker_thread+0x410/0x778 kthread+0x168/0x178 ret_from_fork+0x10/0x20 Second to last potentially related work creation: kasan_save_stack+0x3c/0x68 __kasan_record_aux_stack+0xb0/0x150 kasan_record_aux_stack_noalloc+0x14/0x20 __queue_work+0x788/0x960 queue_work_on+0x98/0xc0 __hci_cmd_sync_sk+0x23c/0x7a0 [bluetooth] __hci_cmd_sync+0x24/0x38 [bluetooth] btrtl_initialize+0x760/0x958 [btrtl] h5_btrtl_setup+0xd0/0x2f8 [hci_uart] h5_setup+0x50/0x80 [hci_uart] hci_uart_setup+0xd4/0x260 [hci_uart] hci_dev_open_sync+0x1cc/0xf68 [bluetooth] hci_dev_do_open+0x34/0x90 [bluetooth] hci_power_on+0xc4/0x3c8 [bluetooth] process_one_work+0x328/0x6f0 worker_thread+0x410/0x778 kthread+0x168/0x178 ret_from_fork+0x10/0x20 ==================================================================
--- drivers/bluetooth/hci_h5.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/hci_h5.c +1 -0
@@ -1072,6 +1072,7 @@ static struct h5_vnd rtl_vnd = { .suspend = h5_btrtl_suspend, .resume = h5_btrtl_resume, .acpi_gpio_map = acpi_btrtl_gpios, + .sizeof_priv = sizeof(struct btrealtek_data), };static const struct h5_device_data h5_data_rtl8822cs = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 308/638 Bluetooth: hci_core: Fix possible buffer overflow
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 81137162bfaa7278785b24c1fd2e9e74f082e8e4 ]
struct hci_dev_info has a fixed size name[8] field so in the event that hdev->name is bigger than that strcpy would attempt to write past its size, so this fixes this problem by switching to use strscpy.
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -908,7 +908,7 @@ int hci_get_dev_info(void __user *arg)else flags = hdev->flags; -strcpy (di.name, hdev->name); +strscpy (di.name, hdev->name,sizeof (di.name)); di.bdaddr = hdev->bdaddr; di.type = (hdev->bus &0x0f ) | ((hdev->dev_type &0x03 ) <<4 ); di.flags = flags;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 309/638 Bluetooth: msft: __hci_cmd_sync() doesn't return NULL
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 41c56aa94c647a0f84c5c33fffb3f283e6f0e5bf ]
The __hci_cmd_sync() function doesn't return NULL. Checking for NULL doesn't make the code safer, it just confuses people.
When a function returns both error pointers and NULL then generally the NULL is a kind of success case. For example, maybe we look up an item then errors mean we ran out of memory but NULL means the item is not found. Or if we request a feature, then error pointers mean that there was an error but NULL means that the feature has been deliberately turned off.
In this code it's different. The NULL is handled as if there is a bug in __hci_cmd_sync() where it accidentally returns NULL instead of a proper error code. This was done consistently until commit 9e14606d8f38 ("Bluetooth: msft: Extended monitor tracking by address filter") which deleted the work around for the potential future bug and treated NULL as success.
Predicting potential future bugs is complicated, but we should just fix them instead of working around them. Instead of debating whether NULL is failure or success, let's just say it's currently impossible and delete the dead code.
Stable-dep-of: a6e06258f4c3 ("Bluetooth: msft: Fix memory leak")
--- net/bluetooth/msft.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
net/bluetooth/msft.c +7 -13
@@ -150,10 +150,7 @@ static bool read_supported_features(struct hci_dev *hdev, skb =__hci_cmd_sync (hdev, hdev->msft_opcode,sizeof (cp), &cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { -if (!skb) - skb =ERR_PTR (-EIO ); - +if (IS_ERR (skb)) {bt_dev_err (hdev,"Failed to read MSFT supported features (%ld)" ,PTR_ERR (skb));return false;
@@ -353,7 +350,7 @@ static void msft_remove_addr_filters_sync(struct hci_dev *hdev, u8 handle) skb =__hci_cmd_sync (hdev, hdev->msft_opcode,sizeof (cp), &cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { +if (IS_ERR (skb)) {kfree (address_filter);continue ; }
@@ -442,11 +439,8 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev, skb =__hci_cmd_sync (hdev, hdev->msft_opcode,sizeof (cp), &cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { -if (!skb) -return -EIO ; +if (IS_ERR (skb))return PTR_ERR (skb); - }return msft_le_cancel_monitor_advertisement_cb (hdev, hdev->msft_opcode, monitor, skb);
@@ -559,7 +553,7 @@ static int msft_add_monitor_sync(struct hci_dev *hdev, skb =__hci_cmd_sync (hdev, hdev->msft_opcode, total_size, cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { +if (IS_ERR (skb)) { err =PTR_ERR (skb); goto out_free; }
@@ -740,10 +734,10 @@ static int msft_cancel_address_filter_sync(struct hci_dev *hdev, void *data) skb =__hci_cmd_sync (hdev, hdev->msft_opcode,sizeof (cp), &cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { +if (IS_ERR (skb)) {bt_dev_err (hdev,"MSFT: Failed to cancel address (%pMR) filter" , &address_filter->bdaddr); - err = -EIO ; + err =PTR_ERR (skb); goto done; }kfree_skb (skb);
@@ -893,7 +887,7 @@ static int msft_add_address_filter_sync(struct hci_dev *hdev, void *data) skb =__hci_cmd_sync (hdev, hdev->msft_opcode, size, cp,HCI_CMD_TIMEOUT ); -if (IS_ERR_OR_NULL (skb)) { +if (IS_ERR (skb)) {bt_dev_err (hdev,"Failed to enable address %pMR filter" , &address_filter->bdaddr); skb =NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 310/638 Bluetooth: msft: Fix memory leak
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit a6e06258f4c31eba0fcd503e19828b5f8fe7b08b ]
Fix leaking buffer allocated to send MSFT_OP_LE_MONITOR_ADVERTISEMENT.
--- net/bluetooth/msft.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/msft.c +3 -0
@@ -875,6 +875,7 @@ static int msft_add_address_filter_sync(struct hci_dev *hdev, void *data) remove = true; goto done; } + cp->sub_opcode =MSFT_OP_LE_MONITOR_ADVERTISEMENT ; cp->rssi_high = address_filter->rssi_high; cp->rssi_low = address_filter->rssi_low;
@@ -887,6 +888,8 @@ static int msft_add_address_filter_sync(struct hci_dev *hdev, void *data) skb =__hci_cmd_sync (hdev, hdev->msft_opcode, size, cp,HCI_CMD_TIMEOUT ); +kfree (cp); +if (IS_ERR (skb)) {bt_dev_err (hdev,"Failed to enable address %pMR filter" , &address_filter->bdaddr);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 311/638 Bluetooth: btusb: Fix memory leak
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 79f4127a502c5905f04da1f20a7bbe07103fb77c ]
This checks if CONFIG_DEV_COREDUMP is enabled before attempting to clone the skb and also make sure btmtk_process_coredump frees the skb passed following the same logic.
--- drivers/bluetooth/btmtk.c | 4 +++- drivers/bluetooth/btusb.c | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/bluetooth/btmtk.c +3 -1
@@ -372,8 +372,10 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)struct btmediatek_data *data =hci_get_priv (hdev);int err; -if (!IS_ENABLED (CONFIG_DEV_COREDUMP )) +if (!IS_ENABLED (CONFIG_DEV_COREDUMP )) { +kfree_skb (skb);return 0 ; + }switch (data->cd_info.state) {case HCI_DEVCOREDUMP_IDLE :
drivers/bluetooth/btusb.c +6 -4
@@ -3267,7 +3267,6 @@ static int btusb_recv_acl_mtk(struct hci_dev *hdev, struct sk_buff *skb) {struct btusb_data *data =hci_get_drvdata (hdev);u16 handle =le16_to_cpu (hci_acl_hdr (skb)->handle); -struct sk_buff *skb_cd;switch (handle) {case 0xfc6f :/* Firmware dump from device */
@@ -3280,9 +3279,12 @@ static int btusb_recv_acl_mtk(struct hci_dev *hdev, struct sk_buff *skb)* for backward compatibility, so we have to clone the packet * extraly for the in-kernel coredump support. */ - skb_cd =skb_clone (skb,GFP_ATOMIC ); -if (skb_cd) -btmtk_process_coredump (hdev, skb_cd); +if (IS_ENABLED (CONFIG_DEV_COREDUMP )) { +struct sk_buff *skb_cd =skb_clone (skb,GFP_ATOMIC ); + +if (skb_cd) +btmtk_process_coredump (hdev, skb_cd); + } fallthrough;case 0x05ff :/* Firmware debug logging 1 */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 312/638 Bluetooth: af_bluetooth: Fix deadlock
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit f7b94bdc1ec107c92262716b073b3e816d4784fb ]
Attemting to do sock_lock on .recvmsg may cause a deadlock as shown bellow, so instead of using sock_sock this uses sk_receive_queue.lock on bt_sock_ioctl to avoid the UAF:
INFO: task kworker/u9:1:121 blocked for more than 30 seconds.
Not tainted 6.7.6-lemon #183
Workqueue: hci0 hci_rx_work
Call Trace:
<TASK>
__schedule+0x37d/0xa00
schedule+0x32/0xe0
__lock_sock+0x68/0xa0
? __pfx_autoremove_wake_function+0x10/0x10
lock_sock_nested+0x43/0x50
l2cap_sock_recv_cb+0x21/0xa0
l2cap_recv_frame+0x55b/0x30a0
? psi_task_switch+0xeb/0x270
? finish_task_switch.isra.0+0x93/0x2a0
hci_rx_work+0x33a/0x3f0
process_one_work+0x13a/0x2f0
worker_thread+0x2f0/0x410
? __pfx_worker_thread+0x10/0x10
kthread+0xe0/0x110
? __pfx_kthread+0x10/0x10
ret_from_fork+0x2c/0x50
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
</TASK>--- net/bluetooth/af_bluetooth.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
net/bluetooth/af_bluetooth.c +3 -7
@@ -309,14 +309,11 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,if (flags &MSG_OOB )return -EOPNOTSUPP ; -lock_sock (sk); - skb =skb_recv_datagram (sk, flags, &err);if (!skb) {if (sk->sk_shutdown &RCV_SHUTDOWN ) err =0 ; -release_sock (sk);return err; }
@@ -346,8 +343,6 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,skb_free_datagram (sk, skb); -release_sock (sk); -if (flags &MSG_TRUNC ) copied = skblen;
@@ -570,10 +565,11 @@ int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)if (sk->sk_state ==BT_LISTEN )return -EINVAL ; -lock_sock (sk); +spin_lock (&sk->sk_receive_queue.lock); skb =skb_peek (&sk->sk_receive_queue); amount = skb ? skb->len :0 ; -release_sock (sk); +spin_unlock (&sk->sk_receive_queue.lock); + err =put_user (amount, (int __user *)arg);break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 313/638 Bluetooth: fix use-after-free in accessing skb after sending it
In reply to Sasha LevinFrom: Pauli Virtanen <[email protected]>
[ Upstream commit 947ec0d002dce8577b655793dcc6fc78d67b7cb6 ]
hci_send_cmd_sync first sends skb and then tries to clone it. However, the driver may have already freed the skb at that point.
Fix by cloning the sent_cmd cloned just above, instead of the original.
Log:
================================================================
BUG: KASAN: slab-use-after-free in __copy_skb_header+0x1a/0x240 ... Call Trace: .. __skb_clone+0x59/0x2c0 hci_cmd_work+0x3b3/0x3d0 [bluetooth] process_one_work+0x459/0x900 ... Allocated by task 129: ... __alloc_skb+0x1ae/0x220 __hci_cmd_sync_sk+0x44c/0x7a0 [bluetooth] __hci_cmd_sync_status+0x24/0xb0 [bluetooth] set_cig_params_sync+0x778/0x7d0 [bluetooth] ... Freed by task 0: ... kmem_cache_free+0x157/0x3c0 __usb_hcd_giveback_urb+0x11e/0x1e0 usb_giveback_urb_bh+0x1ad/0x2a0 tasklet_action_common.isra.0+0x259/0x4a0 __do_softirq+0x15b/0x5a7 ================================================================
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -4185,7 +4185,7 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)if (hci_req_status_pend (hdev) && !hci_dev_test_and_set_flag (hdev,HCI_CMD_PENDING )) {kfree_skb (hdev->req_skb); - hdev->req_skb =skb_clone (skb,GFP_KERNEL ); + hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL ); }atomic_dec (&hdev->cmd_cnt);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 314/638 sr9800: Add check for usbnet_get_endpoints
In reply to Sasha LevinFrom: Chen Ni <[email protected]>
[ Upstream commit 07161b2416f740a2cb87faa5566873f401440a61 ]
Add check for usbnet_get_endpoints() and return the error if it fails in order to transfer the error.
--- drivers/net/usb/sr9800.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/sr9800.c +3 -1
@@ -737,7 +737,9 @@ static int sr9800_bind(struct usbnet *dev, struct usb_interface *intf) data->eeprom_len =SR9800_EEPROM_LEN ; -usbnet_get_endpoints (dev, intf); + ret =usbnet_get_endpoints (dev, intf); +if (ret) + goto out;/* LED Setting Rule : * AABB:CCDD
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 315/638 s390/cache: prevent rebuild of shared_cpu_list
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit cb0cd4ee11142339f2d47eef6db274290b7a482d ]
With commit 36bbc5b4ffab ("cacheinfo: Allow early detection and population of cache attributes") the shared cpu list for each cache level higher than L1 is rebuilt even if the list already has been set up.
This is caused by the removal of the cpumask_empty() check within cache_shared_cpu_map_setup().
However architectures can enforce that the shared cpu list is not rebuilt by simply setting cpu_map_populated of the per cpu cache info structure to true, which is also the fix for this problem.
Before:
$ cat /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list 0-7
After:
$ cat /sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list 1
--- arch/s390/kernel/cache.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/cache.c +1 -0
@@ -166,5 +166,6 @@ int populate_cache_leaves(unsigned int cpu)ci_leaf_init (this_leaf++, pvt, ctype, level, cpu); } } + this_cpu_ci->cpu_map_populated = true;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 316/638 bpf: Fix DEVMAP_HASH overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 281d464a34f540de166cee74b723e97ac2515ec3 ]
The devmap code allocates a number hash buckets equal to the next power of two of the max_entries value provided when creating the map. When rounding up to the next power of two, the 32-bit variable storing the number of buckets can overflow, and the code checks for overflow by checking if the truncated 32-bit value is equal to 0. However, on 32-bit arches the rounding up itself can overflow mid-way through, because it ends up doing a left-shift of 32 bits on an unsigned long value. If the size of an unsigned long is four bytes, this is undefined behaviour, so there is no guarantee that we'll end up with a nice and tidy 0-value at the end.
Syzbot managed to turn this into a crash on arm32 by creating a DEVMAP_HASH with max_entries > 0x80000000 and then trying to update it. Fix this by moving the overflow check to before the rounding up operation.
Message-ID: <[email protected]>
--- kernel/bpf/devmap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/bpf/devmap.c +6 -5
@@ -130,13 +130,14 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr)bpf_map_init_from_attr (&dtab->map, attr);if (attr->map_type ==BPF_MAP_TYPE_DEVMAP_HASH ) { - dtab->n_buckets =roundup_pow_of_two (dtab->map.max_entries); - -if (!dtab->n_buckets)/* Overflow check */ +/* hash table size must be power of 2; roundup_pow_of_two() can +* overflow into UB on 32-bit arches, so check that first +*/ +if (dtab->map.max_entries >1UL <<31 )return -EINVAL ; - } -if (attr->map_type ==BPF_MAP_TYPE_DEVMAP_HASH ) { + dtab->n_buckets =roundup_pow_of_two (dtab->map.max_entries); + dtab->dev_index_head =dev_map_create_hash (dtab->n_buckets, dtab->map.numa_node);if (!dtab->dev_index_head)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 317/638 bpf: Fix hashtab overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 6787d916c2cf9850c97a0a3f73e08c43e7d973b1 ]
The hashtab code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code. So apply the same fix to hashtab, by moving the overflow check to before the roundup.
Message-ID: <[email protected]>
--- kernel/bpf/hashtab.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/bpf/hashtab.c +9 -5
@@ -498,7 +498,13 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) num_possible_cpus()); } -/* hash table size must be power of 2 */ +/* hash table size must be power of 2; roundup_pow_of_two() can overflow +* into UB on 32-bit arches, so check that first +*/ + err = -E2BIG ; +if (htab->map.max_entries >1UL <<31 ) + goto free_htab; + htab->n_buckets =roundup_pow_of_two (htab->map.max_entries); htab->elem_size = sizeof(struct htab_elem) +
@@ -508,10 +514,8 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr)else htab->elem_size +=round_up (htab->map.value_size,8 ); - err = -E2BIG ; -/* prevent zero size kmalloc and check for u32 overflow */ -if (htab->n_buckets ==0 || - htab->n_buckets >U32_MAX /sizeof (struct bucket )) +/* check for u32 overflow */ +if (htab->n_buckets >U32_MAX /sizeof (struct bucket )) goto free_htab; err =bpf_map_init_elem_count (&htab->map);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 318/638 bpf: Fix stackmap overflow check on 32-bit arches
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 7a4b21250bf79eef26543d35bd390448646c536b ]
The stackmap code relies on roundup_pow_of_two() to compute the number of hash buckets, and contains an overflow check by checking if the resulting value is 0. However, on 32-bit arches, the roundup code itself can overflow by doing a 32-bit left-shift of an unsigned long value, which is undefined behaviour, so it is not guaranteed to truncate neatly. This was triggered by syzbot on the DEVMAP_HASH type, which contains the same check, copied from the hashtab code.
The commit in the fixes tag actually attempted to fix this, but the fix did not account for the UB, so the fix only works on CPUs where an overflow does result in a neat truncation to zero, which is not guaranteed. Checking the value before rounding does not have this problem.
Message-ID: <[email protected]>
--- kernel/bpf/stackmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/stackmap.c +6 -3
@@ -91,11 +91,14 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) }else if (value_size /8 > sysctl_perf_event_max_stack)return ERR_PTR (-EINVAL ); -/* hash table size must be power of 2 */ - n_buckets =roundup_pow_of_two (attr->max_entries); -if (!n_buckets) +/* hash table size must be power of 2; roundup_pow_of_two() can overflow +* into UB on 32-bit arches, so check that first +*/ +if (attr->max_entries >1UL <<31 )return ERR_PTR (-E2BIG ); + n_buckets =roundup_pow_of_two (attr->max_entries); + cost = n_buckets *sizeof (struct stack_map_bucket *) +sizeof (*smap); smap =bpf_map_area_alloc (cost,bpf_map_attr_numa_node (attr));if (!smap)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 319/638 iommu: Fix compilation without CONFIG_IOMMU_INTEL
In reply to Sasha LevinFrom: Bert Karwatzki <[email protected]>
[ Upstream commit 70bad345e622c23bb530016925c936ab04a646ac ]
When the kernel is comiled with CONFIG_IRQ_REMAP=y but without CONFIG_IOMMU_INTEL compilation fails since commit def054b01a8678 with an undefined reference to device_rbtree_find(). This patch makes sure that intel specific code is only compiled with CONFIG_IOMMU_INTEL=y.
--- drivers/iommu/Kconfig | 2 +- drivers/iommu/intel/Makefile | 2 ++ drivers/iommu/irq_remapping.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/Kconfig +1 -1
@@ -191,7 +191,7 @@ source "drivers/iommu/iommufd/Kconfig" config IRQ_REMAP bool "Support for Interrupt Remapping" depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI - select DMAR_TABLE + select DMAR_TABLE if INTEL_IOMMU help Supports Interrupt remapping for IO-APIC and MSI devices. To use x2apic mode in the CPU's which support x2APIC enhancements or
drivers/iommu/intel/Makefile +2 -0
@@ -5,5 +5,7 @@ obj-$(CONFIG_DMAR_TABLE) += trace.o cap_audit.o obj-$(CONFIG_DMAR_PERF) += perf.o obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += debugfs.o obj-$(CONFIG_INTEL_IOMMU_SVM) += svm.o +ifdef CONFIG_INTEL_IOMMU obj-$(CONFIG_IRQ_REMAP) += irq_remapping.o +endif obj-$(CONFIG_INTEL_IOMMU_PERF_EVENTS) += perfmon.o
drivers/iommu/irq_remapping.c +2 -1
@@ -99,7 +99,8 @@ int __init irq_remapping_prepare(void)if (disable_irq_remap)return -ENOSYS ; -if (intel_irq_remap_ops.prepare () ==0 ) +if (IS_ENABLED (CONFIG_INTEL_IOMMU ) && + intel_irq_remap_ops.prepare () ==0 ) remap_ops = &intel_irq_remap_ops;else if (IS_ENABLED (CONFIG_AMD_IOMMU ) && amd_iommu_irq_ops.prepare () ==0 )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 320/638 ipv6: fib6_rules: flush route cache when rule is changed
In reply to Sasha LevinFrom: Shiming Cheng <[email protected]>
[ Upstream commit c4386ab4f6c600f75fdfd21143f89bac3e625d0d ]
When rule policy is changed, ipv6 socket cache is not refreshed. The sock's skb still uses a outdated route cache and was sent to a wrong interface.
To avoid this error we should update fib node's version when rule is changed. Then skb's route will be reroute checked as route cache version is already different with fib node version. The route cache is refreshed to match the latest rule.
--- net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ipv6/fib6_rules.c +6 -0
@@ -449,6 +449,11 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule) +nla_total_size (16 );/* src */ } +static void fib6_rule_flush_cache (struct fib_rules_ops *ops) +{ +rt_genid_bump_ipv6 (ops->fro_net); +} +static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { .family =AF_INET6 , .rule_size =sizeof (struct fib6_rule ),
@@ -461,6 +466,7 @@ static const struct fib_rules_ops __net_initconst fib6_rules_ops_template = { .compare = fib6_rule_compare, .fill = fib6_rule_fill, .nlmsg_payload = fib6_rule_nlmsg_payload, + .flush_cache = fib6_rule_flush_cache, .nlgroup = RTNLGRP_IPV6_RULE, .owner = THIS_MODULE, .fro_net = &init_net,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 321/638 net: ip_tunnel: make sure to pull inner header in ip_tunnel_rcv()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit b0ec2abf98267f14d032102551581c833b0659d3 ]
Apply the same fix than ones found in :
8d975c15c0cd ("ip6_tunnel: make sure to pull inner header in __ip6_tnl_rcv()") 1ca1ba465e55 ("geneve: make sure to pull inner header in geneve_rx()")
We have to save skb->network_header in a temporary variable in order to be able to recompute the network_header pointer after a pskb_inet_may_pull() call.
pskb_inet_may_pull() makes sure the needed headers are in skb->head.
syzbot reported:
BUG: KMSAN: uninit-value in __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] BUG: KMSAN: uninit-value in INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] BUG: KMSAN: uninit-value in IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] BUG: KMSAN: uninit-value in ip_tunnel_rcv+0xed9/0x2ed0 net/ipv4/ip_tunnel.c:409 __INET_ECN_decapsulate include/net/inet_ecn.h:253 [inline] INET_ECN_decapsulate include/net/inet_ecn.h:275 [inline] IP_ECN_decapsulate include/net/inet_ecn.h:302 [inline] ip_tunnel_rcv+0xed9/0x2ed0 net/ipv4/ip_tunnel.c:409 __ipgre_rcv+0x9bc/0xbc0 net/ipv4/ip_gre.c:389 ipgre_rcv net/ipv4/ip_gre.c:411 [inline] gre_rcv+0x423/0x19f0 net/ipv4/ip_gre.c:447 gre_rcv+0x2a4/0x390 net/ipv4/gre_demux.c:163 ip_protocol_deliver_rcu+0x264/0x1300 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2b8/0x440 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:461 [inline] ip_rcv_finish net/ipv4/ip_input.c:449 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] ip_rcv+0x46f/0x760 net/ipv4/ip_input.c:569 __netif_receive_skb_one_core net/core/dev.c:5534 [inline] __netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5648 netif_receive_skb_internal net/core/dev.c:5734 [inline] netif_receive_skb+0x58/0x660 net/core/dev.c:5793 tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1556 tun_get_user+0x53b9/0x66e0 drivers/net/tun.c:2009 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2055 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xb6b/0x1520 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
__alloc_pages+0x9a6/0xe00 mm/page_alloc.c:4590 alloc_pages_mpol+0x62b/0x9d0 mm/mempolicy.c:2133 alloc_pages+0x1be/0x1e0 mm/mempolicy.c:2204 skb_page_frag_refill+0x2bf/0x7c0 net/core/sock.c:2909 tun_build_skb drivers/net/tun.c:1686 [inline] tun_get_user+0xe0a/0x66e0 drivers/net/tun.c:1826 tun_chr_write_iter+0x3af/0x5d0 drivers/net/tun.c:2055 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xb6b/0x1520 fs/read_write.c:590 ksys_write+0x20f/0x4c0 fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __x64_sys_write+0x93/0xd0 fs/read_write.c:652 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
--- net/ipv4/ip_tunnel.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/ipv4/ip_tunnel.c +14 -1
@@ -378,7 +378,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, bool log_ecn_error) {const struct iphdr *iph =ip_hdr (skb); -int err; +int nh, err;#ifdef CONFIG_NET_IPGRE_BROADCAST if (ipv4_is_multicast (iph->daddr)) {
@@ -404,8 +404,21 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, tunnel->i_seqno =ntohl (tpi->seq) +1 ; } +/* Save offset of outer header relative to skb->head, +* because we are going to reset the network header to the inner header +* and might change skb->head. +*/ + nh =skb_network_header (skb) - skb->head; +skb_set_network_header (skb, (tunnel->dev->type ==ARPHRD_ETHER ) ?ETH_HLEN :0 ); +if (!pskb_inet_may_pull (skb)) { +DEV_STATS_INC (tunnel->dev, rx_length_errors); +DEV_STATS_INC (tunnel->dev, rx_errors); + goto drop; + } + iph = (struct iphdr *)(skb->head + nh); + err =IP_ECN_decapsulate (iph, skb);if (unlikely (err)) {if (log_ecn_error)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 322/638 net: phy: fix phy_get_internal_delay accessing an empty array
In reply to Sasha LevinFrom: Kévin L'hôpital <[email protected]>
[ Upstream commit 4469c0c5b14a0919f5965c7ceac96b523eb57b79 ]
The phy_get_internal_delay function could try to access to an empty array in the case that the driver is calling phy_get_internal_delay without defining delay_values and rx-internal-delay-ps or tx-internal-delay-ps is defined to 0 in the device-tree. This will lead to "unable to handle kernel NULL pointer dereference at virtual address 0". To avoid this kernel oops, the test should be delay
Quoted 1 line
= 0. As there is already delay < 0 test just before, the test could
only be size == 0.
--- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
@@ -2954,7 +2954,7 @@ s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev,if (delay <0 )return delay; -if (delay && size ==0 ) +if (size ==0 )return delay;if (delay < delay_values[0 ] || delay > delay_values[size -1 ]) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 323/638 net: hns3: fix wrong judgment condition issue
In reply to Sasha LevinFrom: Jijie Shao <[email protected]>
[ Upstream commit 07a1d6dc90baedcf5d713e2b003b9e387130ee30 ]
In hns3_dcbnl_ieee_delapp, should check ieee_delapp not ieee_setapp. This path fix the wrong judgment.
--- drivers/net/ethernet/hisilicon/hns3/hns3_dcbnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_dcbnl.c +1 -1
@@ -76,7 +76,7 @@ static int hns3_dcbnl_ieee_delapp(struct net_device *ndev, struct dcb_app *app)if (hns3_nic_resetting (ndev))return -EBUSY ; -if (h->kinfo.dcb_ops->ieee_setapp) +if (h->kinfo.dcb_ops->ieee_delapp)return h->kinfo.dcb_ops->ieee_delapp (h, app);return -EOPNOTSUPP ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 324/638 net: hns3: fix kernel crash when 1588 is received on HIP08 devices
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit 0fbcf2366ba9888cf02eda23e35fde7f7fcc07c3 ]
The HIP08 devices does not register the ptp devices, so the hdev->ptp is NULL, but the hardware can receive 1588 messages, and set the HNS3_RXD_TS_VLD_B bit, so, if match this case, the access of hdev->ptp->flags will cause a kernel crash:
[ 5888.946472] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 [ 5888.946475] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 ... [ 5889.266118] pc : hclge_ptp_get_rx_hwts+0x40/0x170 [hclge] [ 5889.272612] lr : hclge_ptp_get_rx_hwts+0x34/0x170 [hclge] [ 5889.279101] sp : ffff800012c3bc50 [ 5889.283516] x29: ffff800012c3bc50 x28: ffff2040002be040 [ 5889.289927] x27: ffff800009116484 x26: 0000000080007500 [ 5889.296333] x25: 0000000000000000 x24: ffff204001c6f000 [ 5889.302738] x23: ffff204144f53c00 x22: 0000000000000000 [ 5889.309134] x21: 0000000000000000 x20: ffff204004220080 [ 5889.315520] x19: ffff204144f53c00 x18: 0000000000000000 [ 5889.321897] x17: 0000000000000000 x16: 0000000000000000 [ 5889.328263] x15: 0000004000140ec8 x14: 0000000000000000 [ 5889.334617] x13: 0000000000000000 x12: 00000000010011df [ 5889.340965] x11: bbfeff4d22000000 x10: 0000000000000000 [ 5889.347303] x9 : ffff800009402124 x8 : 0200f78811dfbb4d [ 5889.353637] x7 : 2200000000191b01 x6 : ffff208002a7d480 [ 5889.359959] x5 : 0000000000000000 x4 : 0000000000000000 [ 5889.366271] x3 : 0000000000000000 x2 : 0000000000000000 [ 5889.372567] x1 : 0000000000000000 x0 : ffff20400095c080 [ 5889.378857] Call trace: [ 5889.382285] hclge_ptp_get_rx_hwts+0x40/0x170 [hclge] [ 5889.388304] hns3_handle_bdinfo+0x324/0x410 [hns3] [ 5889.394055] hns3_handle_rx_bd+0x60/0x150 [hns3] [ 5889.399624] hns3_clean_rx_ring+0x84/0x170 [hns3] [ 5889.405270] hns3_nic_common_poll+0xa8/0x220 [hns3] [ 5889.411084] napi_poll+0xcc/0x264 [ 5889.415329] net_rx_action+0xd4/0x21c [ 5889.419911] __do_softirq+0x130/0x358 [ 5889.424484] irq_exit+0x134/0x154 [ 5889.428700] __handle_domain_irq+0x88/0xf0 [ 5889.433684] gic_handle_irq+0x78/0x2c0 [ 5889.438319] el1_irq+0xb8/0x140 [ 5889.442354] arch_cpu_idle+0x18/0x40 [ 5889.446816] default_idle_call+0x5c/0x1c0 [ 5889.451714] cpuidle_idle_call+0x174/0x1b0 [ 5889.456692] do_idle+0xc8/0x160 [ 5889.460717] cpu_startup_entry+0x30/0xfc [ 5889.465523] secondary_start_kernel+0x158/0x1ec [ 5889.470936] Code: 97ffab78 f9411c14 91408294 f9457284 (f9400c80) [ 5889.477950] SMP: stopping secondary CPUs [ 5890.514626] SMP: failed to stop secondary CPUs 0-69,71-95 [ 5890.522951] Starting crashdump kernel...
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c +1 -1
@@ -108,7 +108,7 @@ void hclge_ptp_get_rx_hwts(struct hnae3_handle *handle, struct sk_buff *skb,u64 ns = nsec;u32 sec_h; -if (!test_bit (HCLGE_PTP_FLAG_RX_EN , &hdev->ptp->flags)) +if (!hdev->ptp || !test_bit (HCLGE_PTP_FLAG_RX_EN , &hdev->ptp->flags))return ;/* Since the BD does not have enough space for the higher 16 bits of
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 325/638 net: hns3: fix port duplex configure error in IMP reset
In reply to Sasha LevinFrom: Jie Wang <[email protected]>
[ Upstream commit 11d80f79dd9f871a52feba4bf24b5ac39f448eb7 ]
Currently, the mac port is fixed to configured as full dplex mode in hclge_mac_init() when driver initialization or reset restore. Users may change the mode to half duplex with ethtool, so it may cause the user configuration dropped after reset.
To fix it, don't change the duplex mode when resetting.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +4 -1
@@ -2892,7 +2892,10 @@ static int hclge_mac_init(struct hclge_dev *hdev)int ret; hdev->support_sfp_query = true; - hdev->hw.mac.duplex =HCLGE_MAC_FULL ; + +if (!test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) + hdev->hw.mac.duplex =HCLGE_MAC_FULL ; + ret =hclge_cfg_mac_speed_dup_hw (hdev, hdev->hw.mac.speed, hdev->hw.mac.duplex, hdev->hw.mac.lane_num);if (ret)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 326/638 Bluetooth: Fix eir name length
In reply to Sasha LevinFrom: Frédéric Danis <[email protected]>
[ Upstream commit 2ab3e8d67fc1d4a7638b769cf83023ec209fc0a9 ]
According to Section 1.2 of Core Specification Supplement Part A the complete or short name strings are defined as utf8s, which should not include the trailing NULL for variable length array as defined in Core Specification Vol1 Part E Section 2.9.3.
Removing the trailing NULL allows PTS to retrieve the random address based on device name, e.g. for SM/PER/KDU/BV-02-C, SM/PER/KDU/BV-08-C or GAP/BROB/BCST/BV-03-C.
--- net/bluetooth/eir.c | 29 +++++++---------------------- net/bluetooth/mgmt.c | 2 +- 2 files changed, 8 insertions(+), 23 deletions(-)
net/bluetooth/eir.c +7 -22
@@ -13,48 +13,33 @@#define PNP_INFO_SVCLASS_ID 0x1200 -static u8 eir_append_name (u8 *eir,u16 eir_len,u8 type,u8 *data,u8 data_len) -{ -u8 name[HCI_MAX_SHORT_NAME_LENGTH +1 ]; - -/* If data is already NULL terminated just pass it directly */ -if (data[data_len -1 ] =='\0' ) -return eir_append_data (eir, eir_len, type, data, data_len); - -memcpy (name, data,HCI_MAX_SHORT_NAME_LENGTH ); - name[HCI_MAX_SHORT_NAME_LENGTH ] ='\0' ; - -return eir_append_data (eir, eir_len, type, name,sizeof (name)); -} -u8 eir_append_local_name (struct hci_dev *hdev,u8 *ptr,u8 ad_len) {size_t short_len;size_t complete_len; -/* no space left for name (+ NULL + type + len) */ -if ((max_adv_len (hdev) - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +3 ) +/* no space left for name (+ type + len) */ +if ((max_adv_len (hdev) - ad_len) <HCI_MAX_SHORT_NAME_LENGTH +2 )return ad_len;/* use complete name if present and fits */ complete_len =strnlen (hdev->dev_name,sizeof (hdev->dev_name));if (complete_len && complete_len <=HCI_MAX_SHORT_NAME_LENGTH ) -return eir_append_name (ptr, ad_len,EIR_NAME_COMPLETE , - hdev->dev_name, complete_len +1 ); +return eir_append_data (ptr, ad_len,EIR_NAME_COMPLETE , + hdev->dev_name, complete_len);/* use short name if present */ short_len =strnlen (hdev->short_name,sizeof (hdev->short_name));if (short_len) -return eir_append_name (ptr, ad_len,EIR_NAME_SHORT , +return eir_append_data (ptr, ad_len,EIR_NAME_SHORT , hdev->short_name, - short_len ==HCI_MAX_SHORT_NAME_LENGTH ? - short_len : short_len +1 ); + short_len);/* use shortened full name if present, we already know that name * is longer then HCI_MAX_SHORT_NAME_LENGTH */ if (complete_len) -return eir_append_name (ptr, ad_len,EIR_NAME_SHORT , +return eir_append_data (ptr, ad_len,EIR_NAME_SHORT , hdev->dev_name,HCI_MAX_SHORT_NAME_LENGTH );
net/bluetooth/mgmt.c +1 -1
@@ -8400,7 +8400,7 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,static u8 calculate_name_len (struct hci_dev *hdev) { -u8 buf[HCI_MAX_SHORT_NAME_LENGTH +3 ]; +u8 buf[HCI_MAX_SHORT_NAME_LENGTH +2 ];/* len + type + name */ return eir_append_local_name (hdev, buf,0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 327/638 net: phy: dp83822: Fix RGMII TX delay configuration
In reply to Sasha LevinFrom: Tim Pambor <[email protected]>
[ Upstream commit c8a5c731fd1223090af57da33838c671a7fc6a78 ]
The logic for enabling the TX clock shift is inverse of enabling the RX clock shift. The TX clock shift is disabled when DP83822_TX_CLK_SHIFT is set. Correct the current behavior and always write the delay configuration to ensure consistent delay settings regardless of bootloader configuration.
Reference: https://www.ti.com/lit/ds/symlink/dp83822i.pdf p. 69
--- drivers/net/phy/dp83822.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/net/phy/dp83822.c +20 -17
@@ -380,7 +380,7 @@ static int dp83822_config_init(struct phy_device *phydev) {struct dp83822_private *dp83822 = phydev->priv;struct device *dev = &phydev->mdio.dev; -int rgmii_delay; +int rgmii_delay =0 ;s32 rx_int_delay;s32 tx_int_delay;int err =0 ;
@@ -390,30 +390,33 @@ static int dp83822_config_init(struct phy_device *phydev) rx_int_delay =phy_get_internal_delay (phydev, dev,NULL ,0 , true); -if (rx_int_delay <=0 ) - rgmii_delay =0 ; -else - rgmii_delay =DP83822_RX_CLK_SHIFT ; +/* Set DP83822_RX_CLK_SHIFT to enable rx clk internal delay */ +if (rx_int_delay >0 ) + rgmii_delay |=DP83822_RX_CLK_SHIFT ; tx_int_delay =phy_get_internal_delay (phydev, dev,NULL ,0 , false); + +/* Set DP83822_TX_CLK_SHIFT to disable tx clk internal delay */ if (tx_int_delay <=0 ) - rgmii_delay &= ~DP83822_TX_CLK_SHIFT ; -else rgmii_delay |=DP83822_TX_CLK_SHIFT ; -if (rgmii_delay) { - err =phy_set_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR , rgmii_delay); -if (err) -return err; - } + err =phy_modify_mmd (phydev,DP83822_DEVADDR ,MII_DP83822_RCSR , +DP83822_RX_CLK_SHIFT |DP83822_TX_CLK_SHIFT , rgmii_delay); +if (err) +return err; + + err =phy_set_bits_mmd (phydev,DP83822_DEVADDR , +MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); -phy_set_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); +if (err) +return err; }else { -phy_clear_bits_mmd (phydev,DP83822_DEVADDR , -MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); + err =phy_clear_bits_mmd (phydev,DP83822_DEVADDR , +MII_DP83822_RCSR ,DP83822_RGMII_MODE_EN ); + +if (err) +return err; }if (dp83822->fx_enabled) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 328/638 block: Provide bdev_open_* functions
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit e719b4d156749f02eafed31a3c515f2aa9dcc72a ]
Create struct bdev_handle that contains all parameters that need to be passed to blkdev_put() and provide bdev_open_* functions that return this structure instead of plain bdev pointer. This will eventually allow us to pass one more argument to blkdev_put() (renamed to bdev_release()) without too much hassle.
Stable-dep-of: 0f28be64d132 ("erofs: fix lockdep false positives on initializing erofs_pseudo_mnt")
--- block/bdev.c | 48 ++++++++++++++++++++++++++++++++++++++++++ include/linux/blkdev.h | 10 +++++++++ 2 files changed, 58 insertions(+)
block/bdev.c +48 -0
@@ -831,6 +831,25 @@ struct block_device *blkdev_get_by_dev(dev_t dev, blk_mode_t mode, void *holder, }EXPORT_SYMBOL (blkdev_get_by_dev); +struct bdev_handle *bdev_open_by_dev (dev_t dev,blk_mode_t mode,void *holder, +const struct blk_holder_ops *hops) +{ +struct bdev_handle *handle =kmalloc (sizeof (*handle),GFP_KERNEL ); +struct block_device *bdev; + +if (!handle) +return ERR_PTR (-ENOMEM ); + bdev =blkdev_get_by_dev (dev, mode, holder, hops); +if (IS_ERR (bdev)) { +kfree (handle); +return ERR_CAST (bdev); + } + handle->bdev = bdev; + handle->holder = holder; +return handle; +} +EXPORT_SYMBOL (bdev_open_by_dev); +/** * blkdev_get_by_path - open a block device by name * @path: path to the block device to open
@@ -869,6 +888,28 @@ struct block_device *blkdev_get_by_path(const char *path, blk_mode_t mode, }EXPORT_SYMBOL (blkdev_get_by_path); +struct bdev_handle *bdev_open_by_path (const char *path,blk_mode_t mode, +void *holder,const struct blk_holder_ops *hops) +{ +struct bdev_handle *handle; +dev_t dev; +int error; + + error =lookup_bdev (path, &dev); +if (error) +return ERR_PTR (error); + + handle =bdev_open_by_dev (dev, mode, holder, hops); +if (!IS_ERR (handle) && (mode &BLK_OPEN_WRITE ) && +bdev_read_only (handle->bdev)) { +bdev_release (handle); +return ERR_PTR (-EACCES ); + } + +return handle; +} +EXPORT_SYMBOL (bdev_open_by_path); +void blkdev_put (struct block_device *bdev,void *holder) {struct gendisk *disk = bdev->bd_disk;
@@ -905,6 +946,13 @@ void blkdev_put(struct block_device *bdev, void *holder) }EXPORT_SYMBOL (blkdev_put); +void bdev_release (struct bdev_handle *handle) +{ +blkdev_put (handle->bdev, handle->holder); +kfree (handle); +} +EXPORT_SYMBOL (bdev_release); +/** * lookup_bdev() - Look up a struct block_device by name. * @pathname: Name of the block device in the filesystem.
include/linux/blkdev.h +10 -0
@@ -1479,14 +1479,24 @@ extern const struct blk_holder_ops fs_holder_ops;#define sb_open_mode (flags) \ (BLK_OPEN_READ | (((flags) & SB_RDONLY) ? 0 : BLK_OPEN_WRITE)) +struct bdev_handle { +struct block_device *bdev; +void *holder; +}; +struct block_device *blkdev_get_by_dev (dev_t dev,blk_mode_t mode,void *holder,const struct blk_holder_ops *hops);struct block_device *blkdev_get_by_path (const char *path,blk_mode_t mode,void *holder,const struct blk_holder_ops *hops); +struct bdev_handle *bdev_open_by_dev (dev_t dev,blk_mode_t mode,void *holder, +const struct blk_holder_ops *hops); +struct bdev_handle *bdev_open_by_path (const char *path,blk_mode_t mode, +void *holder,const struct blk_holder_ops *hops);int bd_prepare_to_claim (struct block_device *bdev,void *holder,const struct blk_holder_ops *hops);void bd_abort_claiming (struct block_device *bdev,void *holder);void blkdev_put (struct block_device *bdev,void *holder); +void bdev_release (struct bdev_handle *handle);/* just for blk-cgroup, don't use elsewhere */ struct block_device *blkdev_get_no_open (dev_t dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 329/638 erofs: Convert to use bdev_open_by_path()
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 49845720080dff0afd5813eaebf0758b01b6312c ]
Convert erofs to use bdev_open_by_path() and pass the handle around.
Stable-dep-of: 0f28be64d132 ("erofs: fix lockdep false positives on initializing erofs_pseudo_mnt")
--- fs/erofs/data.c | 4 ++-- fs/erofs/internal.h | 2 +- fs/erofs/super.c | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-)
fs/erofs/data.c +2 -2
@@ -222,7 +222,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map)up_read (&devs->rwsem);return 0 ; } - map->m_bdev = dif->bdev; + map->m_bdev = dif->bdev_handle->bdev; map->m_daxdev = dif->dax_dev; map->m_dax_part_off = dif->dax_part_off; map->m_fscache = dif->fscache;
@@ -240,7 +240,7 @@ int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *map)if (map->m_pa >= startoff && map->m_pa < startoff + length) { map->m_pa -= startoff; - map->m_bdev = dif->bdev; + map->m_bdev = dif->bdev_handle->bdev; map->m_daxdev = dif->dax_dev; map->m_dax_part_off = dif->dax_part_off; map->m_fscache = dif->fscache;
fs/erofs/internal.h +1 -1
@@ -47,7 +47,7 @@ typedef u32 erofs_blk_t;struct erofs_device_info {char *path;struct erofs_fscache *fscache; -struct block_device *bdev; +struct bdev_handle *bdev_handle;struct dax_device *dax_dev;u64 dax_part_off;
fs/erofs/super.c +10 -10
@@ -174,7 +174,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,struct erofs_sb_info *sbi =EROFS_SB (sb);struct erofs_fscache *fscache;struct erofs_deviceslot *dis; -struct block_device *bdev; +struct bdev_handle *bdev_handle;void *ptr; ptr =erofs_read_metabuf (buf, sb,erofs_blknr (sb, *pos),EROFS_KMAP );
@@ -198,13 +198,13 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,return PTR_ERR (fscache); dif->fscache = fscache; }else if (!sbi->devs->flatdev) { - bdev =blkdev_get_by_path (dif->path,BLK_OPEN_READ , sb->s_type, -NULL ); -if (IS_ERR (bdev)) -return PTR_ERR (bdev); - dif->bdev = bdev; - dif->dax_dev =fs_dax_get_by_bdev (bdev, &dif->dax_part_off, -NULL ,NULL ); + bdev_handle =bdev_open_by_path (dif->path,BLK_OPEN_READ , + sb->s_type,NULL ); +if (IS_ERR (bdev_handle)) +return PTR_ERR (bdev_handle); + dif->bdev_handle = bdev_handle; + dif->dax_dev =fs_dax_get_by_bdev (bdev_handle->bdev, + &dif->dax_part_off,NULL ,NULL ); } dif->blocks =le32_to_cpu (dis->blocks);
@@ -750,8 +750,8 @@ static int erofs_release_device_info(int id, void *ptr, void *data)struct erofs_device_info *dif = ptr;fs_put_dax (dif->dax_dev,NULL ); -if (dif->bdev) -blkdev_put (dif->bdev, &erofs_fs_type); +if (dif->bdev_handle) +bdev_release (dif->bdev_handle);erofs_fscache_unregister_cookie (dif->fscache); dif->fscache =NULL ;kfree (dif->path);
Signature · 1 line
2.43.0
Re: [PATCH 6.6 329/638] erofs: Convert to use bdev_open_by_path()
Hi,
Quoted 15 lines · Sasha Levin
From: Jan Kara <[email protected]>
[ Upstream commit
49845720080dff0afd5813eaebf0758b01b6312c]Convert erofs to use
bdev_open_by_path()and pass the handle around.CC Gao Xiang <[email protected]>CC Chao Yu <[email protected]>Acked-by Gao Xiang <[email protected]>Reviewed-by Christian Brauner <[email protected]>Signed-off-by Jan Kara <[email protected]>Signed-off-by Christian Brauner <[email protected]>
Quoted 2 lines
Stable-dep-of:
0f28be64d132("erofs: fix lockdep false positives on initializingerofs_pseudo_mnt")Signed-off-by Sasha Levin <[email protected]>
I don't think it's necessary to be backported to v6.6 as well as the previous one "block: Provide bdev_open_* functions".
The patch
"erofs: fix lockdep false positives on initializing erofs_pseudo_mnt" should be manually backported instead.
Thanks,
Gao Xiang
Sasha Levin
maintainerPATCH 330/638 erofs: fix handling kern_mount() failure
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 2c88c16dc20e88dd54d2f6f4d01ae1dce6cc9654 ]
if you have a variable that holds NULL or a pointer to live struct mount, do not shove ERR_PTR() into it - not if you later treat "not NULL" as "holds a pointer to object".
Stable-dep-of: 0f28be64d132 ("erofs: fix lockdep false positives on initializing erofs_pseudo_mnt")
--- fs/erofs/fscache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/erofs/fscache.c +4 -3
@@ -381,11 +381,12 @@ static int erofs_fscache_init_domain(struct super_block *sb) goto out;if (!erofs_pseudo_mnt) { - erofs_pseudo_mnt =kern_mount (&erofs_fs_type); -if (IS_ERR (erofs_pseudo_mnt)) { - err =PTR_ERR (erofs_pseudo_mnt); +struct vfsmount *mnt =kern_mount (&erofs_fs_type); +if (IS_ERR (mnt)) { + err =PTR_ERR (mnt); goto out; } + erofs_pseudo_mnt = mnt; } domain->volume = sbi->volume;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 331/638 erofs: fix lockdep false positives on initializing erofs_pseudo_mnt
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit 0f28be64d132aaf95d06375c8002ad9ecea69d71 ]
Lockdep reported the following issue when mounting erofs with a domain_id:
============================================
WARNING: possible recursive locking detected 6.8.0-rc7-xfstests #521 Not tainted
--------------------------------------------
mount/396 is trying to acquire lock:ffff907a8aaaa0e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
but task is already holding lock:ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&type->s_umount_key#50/1);
lock(&type->s_umount_key#50/1);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by mount/396:
#0: ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3},
at: alloc_super+0xe3/0x3d0
#1: ffffffffc00e6f28 (erofs_domain_list_lock){+.+.}-{3:3},
at: erofs_fscache_register_fs+0x3d/0x270 [erofs]stack backtrace: CPU: 1 PID: 396 Comm: mount Not tainted 6.8.0-rc7-xfstests #521 Call Trace: <TASK> dump_stack_lvl+0x64/0xb0 validate_chain+0x5c4/0xa00 __lock_acquire+0x6a9/0xd50 lock_acquire+0xcd/0x2b0 down_write_nested+0x45/0xd0 alloc_super+0xe3/0x3d0 sget_fc+0x62/0x2f0 vfs_get_super+0x21/0x90 vfs_get_tree+0x2c/0xf0 fc_mount+0x12/0x40 vfs_kern_mount.part.0+0x75/0x90 kern_mount+0x24/0x40 erofs_fscache_register_fs+0x1ef/0x270 [erofs] erofs_fc_fill_super+0x213/0x380 [erofs]
This is because the file_system_type of both erofs and the pseudo-mount point of domain_id is erofs_fs_type, so two successive calls to alloc_super() are considered to be using the same lock and trigger the warning above.
Therefore add a nodev file_system_type called erofs_anon_fs_type in fscache.c to silence this complaint. Because kern_mount() takes a pointer to struct file_system_type, not its (string) name. So we don't need to call register_filesystem(). In addition, call init_pseudo() in erofs_anon_init_fs_context() as suggested by Al Viro, so that we can remove erofs_fc_fill_pseudo_super(), erofs_fc_anon_get_tree(), and erofs_anon_context_ops.
--- fs/erofs/fscache.c | 15 ++++++++++++++- fs/erofs/internal.h | 1 - fs/erofs/super.c | 30 +----------------------------- 3 files changed, 15 insertions(+), 31 deletions(-)
fs/erofs/fscache.c +14 -1
@@ -3,6 +3,7 @@* Copyright (C) 2022, Alibaba Cloud * Copyright (C) 2022, Bytedance Inc. All rights reserved. */ +#include <linux/pseudo_fs.h> #include <linux/fscache.h> #include "internal.h"
@@ -12,6 +13,18 @@ static LIST_HEAD(erofs_domain_list);static LIST_HEAD (erofs_domain_cookies_list);static struct vfsmount *erofs_pseudo_mnt; +static int erofs_anon_init_fs_context (struct fs_context *fc) +{ +return init_pseudo (fc,EROFS_SUPER_MAGIC ) ?0 : -ENOMEM ; +} + +static struct file_system_type erofs_anon_fs_type = { + .owner =THIS_MODULE , + .name ="pseudo_erofs" , + .init_fs_context = erofs_anon_init_fs_context, + .kill_sb = kill_anon_super, +}; +struct erofs_fscache_request {struct erofs_fscache_request *primary;struct netfs_cache_resources cache_resources;
@@ -381,7 +394,7 @@ static int erofs_fscache_init_domain(struct super_block *sb) goto out;if (!erofs_pseudo_mnt) { -struct vfsmount *mnt =kern_mount (&erofs_fs_type); +struct vfsmount *mnt =kern_mount (&erofs_anon_fs_type);if (IS_ERR (mnt)) { err =PTR_ERR (mnt); goto out;
fs/erofs/internal.h +0 -1
@@ -385,7 +385,6 @@ struct erofs_map_dev {unsigned int m_deviceid; }; -extern struct file_system_type erofs_fs_type;extern const struct super_operations erofs_sops;extern const struct address_space_operations erofs_raw_access_aops;
fs/erofs/super.c +1 -29
@@ -575,13 +575,6 @@ static const struct export_operations erofs_export_ops = { .get_parent = erofs_get_parent, }; -static int erofs_fc_fill_pseudo_super (struct super_block *sb,struct fs_context *fc) -{ -static const struct tree_descr empty_descr = {"" }; - -return simple_fill_super (sb,EROFS_SUPER_MAGIC , &empty_descr); -} -static int erofs_fc_fill_super (struct super_block *sb,struct fs_context *fc) {struct inode *inode;
@@ -708,11 +701,6 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)return 0 ; } -static int erofs_fc_anon_get_tree (struct fs_context *fc) -{ -return get_tree_nodev (fc, erofs_fc_fill_pseudo_super); -} -static int erofs_fc_get_tree (struct fs_context *fc) {struct erofs_fs_context *ctx = fc->fs_private;
@@ -785,20 +773,10 @@ static const struct fs_context_operations erofs_context_ops = { .free = erofs_fc_free, }; -static const struct fs_context_operations erofs_anon_context_ops = { - .get_tree = erofs_fc_anon_get_tree, -}; -static int erofs_init_fs_context (struct fs_context *fc) {struct erofs_fs_context *ctx; -/* pseudo mount for anon inodes */ -if (fc->sb_flags &SB_KERNMOUNT ) { - fc->ops = &erofs_anon_context_ops; -return 0 ; - } - ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );if (!ctx)return -ENOMEM ;
@@ -820,12 +798,6 @@ static void erofs_kill_sb(struct super_block *sb) {struct erofs_sb_info *sbi; -/* pseudo mount for anon inodes */ -if (sb->s_flags &SB_KERNMOUNT ) { -kill_anon_super (sb); -return ; - } -if (erofs_is_fscache_mode (sb))kill_anon_super (sb);else
@@ -864,7 +836,7 @@ static void erofs_put_super(struct super_block *sb)erofs_fscache_unregister_fs (sb); } -struct file_system_type erofs_fs_type = { +static struct file_system_type erofs_fs_type = { .owner =THIS_MODULE , .name ="erofs" , .init_fs_context = erofs_init_fs_context,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 332/638 OPP: debugfs: Fix warning around icc_get_name()
In reply to Sasha LevinFrom: Viresh Kumar <[email protected]>
[ Upstream commit 28330ceb953e39880ea77da4895bb902a1244860 ]
If the kernel isn't built with interconnect support, icc_get_name() returns NULL and we get following warning:
drivers/opp/debugfs.c: In function 'bw_name_read':drivers/opp/debugfs.c:43:42: error: '%.62s' directive argument is null [-Werror=format-overflow=]
i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
Fix it.
--- drivers/opp/debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/opp/debugfs.c +4 -2
@@ -37,10 +37,12 @@ static ssize_t bw_name_read(struct file *fp, char __user *userbuf, size_t count, loff_t *ppos) { struct icc_path *path = fp->private_data; +const char *name =icc_get_name (path);char buf[64 ]; -int i; +int i =0 ; - i =scnprintf (buf,sizeof (buf),"%.62s\n" ,icc_get_name (path)); +if (name) + i =scnprintf (buf,sizeof (buf),"%.62s\n" , name);return simple_read_from_buffer (userbuf, count, ppos, buf, i); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 333/638 tcp: fix incorrect parameter validation in the do_tcp_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 716edc9706deb3bb2ff56e2eeb83559cea8f22db ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +2 -2
@@ -3967,11 +3967,11 @@ int do_tcp_getsockopt(struct sock *sk, int level,if (copy_from_sockptr (&len, optlen,sizeof (int )))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case TCP_MAXSEG : val = tp->mss_cache;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 334/638 ipmr: fix incorrect parameter validation in the ip_mroute_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 5c3be3e0eb44b7f978bb6cbb20ad956adb93f736 ]
The 'olr' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'olr' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/ipmr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/ipmr.c +3 -1
@@ -1603,9 +1603,11 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, sockptr_t optval,if (copy_from_sockptr (&olr, optlen,sizeof (int )))return -EFAULT ; - olr = min_t(unsigned int, olr, sizeof(int));if (olr <0 )return -EINVAL ; + + olr = min_t(unsigned int, olr, sizeof(int)); +if (copy_to_sockptr (optlen, &olr,sizeof (int )))return -EFAULT ;if (copy_to_sockptr (optval, &val, olr))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 335/638 l2tp: fix incorrect parameter validation in the pppol2tp_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 955e9876ba4ee26eeaab1b13517f5b2c88e73d55 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ppp.c +2 -2
@@ -1356,11 +1356,11 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); + err = -ENOTCONN ;if (!sk->sk_user_data) goto end;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 336/638 udp: fix incorrect parameter validation in the udp_lib_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 4bb3ba7b74fceec6f558745b25a43c6521cf5506 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/ipv4/udp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/udp.c +2 -2
@@ -2779,11 +2779,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int)); -if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case UDP_CORK : val =udp_test_bit (CORK , sk);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 337/638 net: kcm: fix incorrect parameter validation in the kcm_getsockopt) function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit 3ed5f415133f9b7518fbe55ba9ae9a3f5e700929 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/kcm/kcmsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/kcm/kcmsock.c +2 -1
@@ -1152,10 +1152,11 @@ static int kcm_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen))return -EFAULT ; - len = min_t(unsigned int, len, sizeof(int));if (len <0 )return -EINVAL ; + len = min_t(unsigned int, len, sizeof(int)); +switch (optname) {case KCM_RECV_DISABLE : val = kcm->rx_disabled;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 338/638 net/x25: fix incorrect parameter validation in the x25_getsockopt() function
In reply to Sasha LevinFrom: Gavrilov Ilia <[email protected]>
[ Upstream commit d6eb8de2015f0c24822e47356f839167ebde2945 ]
The 'len' variable can't be negative when assigned the result of 'min_t' because all 'min_t' parameters are cast to unsigned int, and then the minimum one is chosen.
To fix the logic, check 'len' as read from 'optlen', where the types of relevant variables are (signed) int.
--- net/x25/af_x25.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/x25/af_x25.c +2 -2
@@ -460,12 +460,12 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,if (get_user (len, optlen)) goto out; - len = min_t(unsigned int, len, sizeof(int)); - rc = -EINVAL ;if (len <0 ) goto out; + len = min_t(unsigned int, len, sizeof(int)); + rc = -EFAULT ;if (put_user (len, optlen)) goto out;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 339/638 nfp: flower: handle acti_netdevs allocation failure
In reply to Sasha LevinFrom: Duoming Zhou <[email protected]>
[ Upstream commit 84e95149bd341705f0eca6a7fcb955c548805002 ]
The kmalloc_array() in nfp_fl_lag_do_work() will return null, if the physical memory has run out. As a result, if we dereference the acti_netdevs, the null pointer dereference bugs will happen.
This patch adds a check to judge whether allocation failure occurs. If it happens, the delayed work will be rescheduled and try again.
--- drivers/net/ethernet/netronome/nfp/flower/lag_conf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/netronome/nfp/flower/lag_conf.c +5 -0
@@ -338,6 +338,11 @@ static void nfp_fl_lag_do_work(struct work_struct *work) acti_netdevs =kmalloc_array (entry->slave_cnt,sizeof (*acti_netdevs),GFP_KERNEL ); +if (!acti_netdevs) { +schedule_delayed_work (&lag->work, +NFP_FL_LAG_DELAY ); +continue ; + }/* Include sanity check in the loop. It may be that a bond has * changed between processing the last notification and the
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 340/638 bpf: hardcode BPF_PROG_PACK_SIZE to 2MB * num_possible_nodes()
In reply to Sasha LevinFrom: Puranjay Mohan <[email protected]>
[ Upstream commit d6170e4aaf86424c24ce06e355b4573daa891b17 ]
On some architectures like ARM64, PMD_SIZE can be really large in some configurations. Like with CONFIG_ARM64_64K_PAGES=y the PMD_SIZE is 512MB.
Use 2MB * num_possible_nodes() as the size for allocations done through the prog pack allocator. On most architectures, PMD_SIZE will be equal to 2MB in case of 4KB pages and will be greater than 2MB for bigger page sizes.
Message-ID: <[email protected]>
--- kernel/bpf/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/bpf/core.c +6 -1
@@ -863,7 +863,12 @@ static LIST_HEAD(pack_list);* CONFIG_MMU=n. Use PAGE_SIZE in these cases. */ #ifdef PMD_SIZE -#define BPF_PROG_PACK_SIZE (PMD_SIZE * num_possible_nodes()) +/* PMD_SIZE is really big for some archs. It doesn't make sense to +* reserve too much memory in one allocation. Hardcode BPF_PROG_PACK_SIZE to +* 2MiB * num_possible_nodes(). On most architectures PMD_SIZE will be +* greater than or equal to 2MB. +*/ +#define BPF_PROG_PACK_SIZE (SZ_2M * num_possible_nodes())#else #define BPF_PROG_PACK_SIZE PAGE_SIZE#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 341/638 dm raid: fix false positive for requeue needed during reshape
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit b25b8f4b8ecef0f48c05f0c3572daeabefe16526 ]
An empty flush doesn't have a payload, so it should never be looked at when considering to possibly requeue a bio for the case when a reshape is in progress.
--- drivers/md/dm-raid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-raid.c +2 -2
@@ -3322,14 +3322,14 @@ static int raid_map(struct dm_target *ti, struct bio *bio)struct mddev *mddev = &rs->md;/* -* If we're reshaping to add disk(s)), ti->len and +* If we're reshaping to add disk(s), ti->len and * mddev->array_sectors will differ during the process * (ti->len > mddev->array_sectors), so we have to requeue * bios with addresses > mddev->array_sectors here or * there will occur accesses past EOD of the component * data images thus erroring the raid set. */ -if (unlikely (bio_end_sector (bio) > mddev->array_sectors)) +if (unlikely (bio_has_data (bio) &&bio_end_sector (bio) > mddev->array_sectors))return DM_MAPIO_REQUEUE ;md_handle_request (mddev, bio);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 342/638 dm: call the resume method on internal suspend
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 65e8fbde64520001abf1c8d0e573561b4746ef38 ]
There is this reported crash when experimenting with the lvm2 testsuite. The list corruption is caused by the fact that the postsuspend and resume methods were not paired correctly; there were two consecutive calls to the origin_postsuspend function. The second call attempts to remove the "hash_list" entry from a list, while it was already removed by the first call.
Fix __dm_internal_resume so that it calls the preresume and resume methods of the table's targets.
If a preresume method of some target fails, we are in a tricky situation. We can't return an error because dm_internal_resume isn't supposed to return errors. We can't return success, because then the "resume" and "postsuspend" methods would not be paired correctly. So, we set the DMF_SUSPENDED flag and we fake normal suspend - it may confuse userspace tools, but it won't cause a kernel crash.
------------[ cut here ]------------ kernel BUG at lib/list_debug.c:56! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 1 PID: 8343 Comm: dmsetup Not tainted 6.8.0-rc6 #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__list_del_entry_valid_or_report+0x77/0xc0 <snip> RSP: 0018:ffff8881b831bcc0 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff888143b6eb80 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff819053d0 RDI: 00000000ffffffff RBP: ffff8881b83a3400 R08: 00000000fffeffff R09: 0000000000000058 R10: 0000000000000000 R11: ffffffff81a24080 R12: 0000000000000001 R13: ffff88814538e000 R14: ffff888143bc6dc0 R15: ffffffffa02e4bb0 FS: 00000000f7c0f780(0000) GS:ffff8893f0a40000(0000) knlGS:0000000000000000 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 0000000057fb5000 CR3: 0000000143474000 CR4: 00000000000006b0 Call Trace: <TASK> ? die+0x2d/0x80 ? do_trap+0xeb/0xf0 ? __list_del_entry_valid_or_report+0x77/0xc0 ? do_error_trap+0x60/0x80 ? __list_del_entry_valid_or_report+0x77/0xc0 ? exc_invalid_op+0x49/0x60 ? __list_del_entry_valid_or_report+0x77/0xc0 ? asm_exc_invalid_op+0x16/0x20 ? table_deps+0x1b0/0x1b0 [dm_mod] ? __list_del_entry_valid_or_report+0x77/0xc0 origin_postsuspend+0x1a/0x50 [dm_snapshot] dm_table_postsuspend_targets+0x34/0x50 [dm_mod] dm_suspend+0xd8/0xf0 [dm_mod] dev_suspend+0x1f2/0x2f0 [dm_mod] ? table_deps+0x1b0/0x1b0 [dm_mod] ctl_ioctl+0x300/0x5f0 [dm_mod] dm_compat_ctl_ioctl+0x7/0x10 [dm_mod] __x64_compat_sys_ioctl+0x104/0x170 do_syscall_64+0x184/0x1b0 entry_SYSCALL_64_after_hwframe+0x46/0x4e RIP: 0033:0xf7e6aead <snip> ---[ end trace 0000000000000000 ]---
--- drivers/md/dm.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/md/dm.c +20 -6
@@ -2918,6 +2918,9 @@ static void __dm_internal_suspend(struct mapped_device *md, unsigned int suspendstatic void __dm_internal_resume (struct mapped_device *md) { +int r; +struct dm_table *map; +BUG_ON (!md->internal_suspend_count);if (--md->internal_suspend_count)
@@ -2926,12 +2929,23 @@ static void __dm_internal_resume(struct mapped_device *md)if (dm_suspended_md (md)) goto done;/* resume from nested suspend */ -/* -* NOTE: existing callers don't need to call dm_table_resume_targets -* (which may fail -- so best to avoid it for now by passing NULL map) -*/ - (void )__dm_resume (md,NULL ); - + map =rcu_dereference_protected (md->map,lockdep_is_held (&md->suspend_lock)); + r =__dm_resume (md, map); +if (r) { +/* +* If a preresume method of some target failed, we are in a +* tricky situation. We can't return an error to the caller. We +* can't fake success because then the "resume" and +* "postsuspend" methods would not be paired correctly, and it +* would break various targets, for example it would cause list +* corruption in the "origin" target. +* +* So, we fake normal suspend here, to make sure that the +* "resume" and "postsuspend" methods will be paired correctly. +*/ +DMERR ("Preresume method failed: %d" , r); +set_bit (DMF_SUSPENDED , &md->flags); + } done:clear_bit (DMF_SUSPENDED_INTERNALLY , &md->flags);smp_mb__after_atomic ();
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 343/638 drm/tegra: dsi: Add missing check for of_find_device_by_node
In reply to Sasha LevinFrom: Chen Ni <[email protected]>
[ Upstream commit afe6fcb9775882230cd29b529203eabd5d2a638d ]
Add check for the return value of of_find_device_by_node() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dsi.c +3 -1
@@ -1543,9 +1543,11 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) np =of_parse_phandle (dsi->dev->of_node,"nvidia,ganged-mode" ,0 );if (np) {struct platform_device *gangster =of_find_device_by_node (np); +of_node_put (np); +if (!gangster) +return -EPROBE_DEFER ; dsi->slave =platform_get_drvdata (gangster); -of_node_put (np);if (!dsi->slave) {put_device (&gangster->dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 344/638 drm/tegra: dpaux: Fix PM disable depth imbalance in tegra_dpaux_probe
In reply to Sasha LevinFrom: Zhang Shurong <[email protected]>
[ Upstream commit 0800880f4eb789b7d299db40f2e86e056bd33a4e ]
The pm_runtime_enable function increases the power disable depth, which means that we must perform a matching decrement on the error handling path to maintain balance within the given context. Additionally, we need to address the same issue for pm_runtime_get_sync. We fix this by invoking pm_runtime_disable and pm_runtime_put_sync when error returns.
--- drivers/gpu/drm/tegra/dpaux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +10 -4
@@ -522,7 +522,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)if (err <0 ) {dev_err (dpaux->dev,"failed to request IRQ#%u: %d\n" , dpaux->irq, err); -return err; + goto err_pm_disable; }disable_irq (dpaux->irq);
@@ -542,7 +542,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)*/ err =tegra_dpaux_pad_config (dpaux,DPAUX_PADCTL_FUNC_I2C );if (err <0 ) -return err; + goto err_pm_disable;#ifdef CONFIG_GENERIC_PINCONF dpaux->desc.name =dev_name (&pdev->dev);
@@ -555,7 +555,8 @@ static int tegra_dpaux_probe(struct platform_device *pdev) dpaux->pinctrl =devm_pinctrl_register (&pdev->dev, &dpaux->desc, dpaux);if (IS_ERR (dpaux->pinctrl)) {dev_err (&pdev->dev,"failed to register pincontrol\n" ); -return PTR_ERR (dpaux->pinctrl); + err =PTR_ERR (dpaux->pinctrl); + goto err_pm_disable; }#endif /* enable and clear all interrupts */
@@ -571,10 +572,15 @@ static int tegra_dpaux_probe(struct platform_device *pdev) err =devm_of_dp_aux_populate_ep_devices (&dpaux->aux);if (err <0 ) {dev_err (dpaux->dev,"failed to populate AUX bus: %d\n" , err); -return err; + goto err_pm_disable; }return 0 ; + +err_pm_disable: +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev); +return err; }static void tegra_dpaux_remove (struct platform_device *pdev)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 345/638 drm/tegra: dsi: Fix some error handling paths in tegra_dsi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 830c1ded356369cd1303e8bb87ce3fea6e744de8 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/dsi.c | 54 ++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 19 deletions(-)
drivers/gpu/drm/tegra/dsi.c +35 -19
@@ -1595,44 +1595,58 @@ static int tegra_dsi_probe(struct platform_device *pdev)if (!pdev->dev.pm_domain) { dsi->rst =devm_reset_control_get (&pdev->dev,"dsi" ); -if (IS_ERR (dsi->rst)) -return PTR_ERR (dsi->rst); +if (IS_ERR (dsi->rst)) { + err =PTR_ERR (dsi->rst); + goto remove; + } } dsi->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (dsi->clk)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk), -"cannot get DSI clock\n" ); +if (IS_ERR (dsi->clk)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk), +"cannot get DSI clock\n" ); + goto remove; + } dsi->clk_lp =devm_clk_get (&pdev->dev,"lp" ); -if (IS_ERR (dsi->clk_lp)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_lp), -"cannot get low-power clock\n" ); +if (IS_ERR (dsi->clk_lp)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_lp), +"cannot get low-power clock\n" ); + goto remove; + } dsi->clk_parent =devm_clk_get (&pdev->dev,"parent" ); -if (IS_ERR (dsi->clk_parent)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_parent), -"cannot get parent clock\n" ); +if (IS_ERR (dsi->clk_parent)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->clk_parent), +"cannot get parent clock\n" ); + goto remove; + } dsi->vdd =devm_regulator_get (&pdev->dev,"avdd-dsi-csi" ); -if (IS_ERR (dsi->vdd)) -return dev_err_probe (&pdev->dev,PTR_ERR (dsi->vdd), -"cannot get VDD supply\n" ); +if (IS_ERR (dsi->vdd)) { + err =dev_err_probe (&pdev->dev,PTR_ERR (dsi->vdd), +"cannot get VDD supply\n" ); + goto remove; + } err =tegra_dsi_setup_clocks (dsi);if (err <0 ) {dev_err (&pdev->dev,"cannot setup clocks\n" ); -return err; + goto remove; } regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dsi->regs =devm_ioremap_resource (&pdev->dev, regs); -if (IS_ERR (dsi->regs)) -return PTR_ERR (dsi->regs); +if (IS_ERR (dsi->regs)) { + err =PTR_ERR (dsi->regs); + goto remove; + } dsi->mipi =tegra_mipi_request (&pdev->dev, pdev->dev.of_node); -if (IS_ERR (dsi->mipi)) -return PTR_ERR (dsi->mipi); +if (IS_ERR (dsi->mipi)) { + err =PTR_ERR (dsi->mipi); + goto remove; + } dsi->host.ops = &tegra_dsi_host_ops; dsi->host.dev = &pdev->dev;
@@ -1663,6 +1677,8 @@ static int tegra_dsi_probe(struct platform_device *pdev)mipi_dsi_host_unregister (&dsi->host); mipi_free:tegra_mipi_free (dsi->mipi); +remove: +tegra_output_remove (&dsi->output);return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 346/638 drm/tegra: dsi: Fix missing pm_runtime_disable() in the error handling path of tegra_dsi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5286a9fc280c45b6b307ee1b07f7a997e042252c ]
If an error occurs after calling pm_runtime_enable(), pm_runtime_disable() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/dsi.c +1 -0
@@ -1674,6 +1674,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)return 0 ; unregister: +pm_runtime_disable (&pdev->dev);mipi_dsi_host_unregister (&dsi->host); mipi_free:tegra_mipi_free (dsi->mipi);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 347/638 drm/tegra: hdmi: Fix some error handling paths in tegra_hdmi_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 643ae131b8598fb2940c92c7d23fe62823a119c8 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/hdmi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/tegra/hdmi.c +13 -7
@@ -1854,12 +1854,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)return err; hdmi->regs =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (hdmi->regs)) -return PTR_ERR (hdmi->regs); +if (IS_ERR (hdmi->regs)) { + err =PTR_ERR (hdmi->regs); + goto remove; + } err =platform_get_irq (pdev,0 );if (err <0 ) -return err; + goto remove; hdmi->irq = err;
@@ -1868,18 +1870,18 @@ static int tegra_hdmi_probe(struct platform_device *pdev)if (err <0 ) {dev_err (&pdev->dev,"failed to request IRQ#%u: %d\n" , hdmi->irq, err); -return err; + goto remove; }platform_set_drvdata (pdev, hdmi); err =devm_pm_runtime_enable (&pdev->dev);if (err) -return err; + goto remove; err =devm_tegra_core_dev_init_opp_table_common (&pdev->dev);if (err) -return err; + goto remove;INIT_LIST_HEAD (&hdmi->client.list); hdmi->client.ops = &hdmi_client_ops;
@@ -1889,10 +1891,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)if (err <0 ) {dev_err (&pdev->dev,"failed to register host1x client: %d\n" , err); -return err; + goto remove; }return 0 ; + +remove: +tegra_output_remove (&hdmi->output); +return err; }static void tegra_hdmi_remove (struct platform_device *pdev)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 348/638 drm/tegra: rgb: Fix some error handling paths in tegra_dc_rgb_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bc456b5d93dbfdbd89f2a036f4f3d8026595f9e4 ]
If an error occurs after calling tegra_output_probe(), tegra_output_remove() should be called as already done in the remove function.
--- drivers/gpu/drm/tegra/rgb.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/tegra/rgb.c +11 -5
@@ -215,26 +215,28 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc) rgb->clk =devm_clk_get (dc->dev,NULL );if (IS_ERR (rgb->clk)) {dev_err (dc->dev,"failed to get clock\n" ); -return PTR_ERR (rgb->clk); + err =PTR_ERR (rgb->clk); + goto remove; } rgb->clk_parent =devm_clk_get (dc->dev,"parent" );if (IS_ERR (rgb->clk_parent)) {dev_err (dc->dev,"failed to get parent clock\n" ); -return PTR_ERR (rgb->clk_parent); + err =PTR_ERR (rgb->clk_parent); + goto remove; } err =clk_set_parent (rgb->clk, rgb->clk_parent);if (err <0 ) {dev_err (dc->dev,"failed to set parent clock: %d\n" , err); -return err; + goto remove; } rgb->pll_d_out0 =clk_get_sys (NULL ,"pll_d_out0" );if (IS_ERR (rgb->pll_d_out0)) { err =PTR_ERR (rgb->pll_d_out0);dev_err (dc->dev,"failed to get pll_d_out0: %d\n" , err); -return err; + goto remove; }if (dc->soc->has_pll_d2_out0) {
@@ -242,13 +244,17 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)if (IS_ERR (rgb->pll_d2_out0)) { err =PTR_ERR (rgb->pll_d2_out0);dev_err (dc->dev,"failed to get pll_d2_out0: %d\n" , err); -return err; + goto remove; } } dc->rgb = &rgb->output;return 0 ; + +remove: +tegra_output_remove (&rgb->output); +return err; }void tegra_dc_rgb_remove (struct tegra_dc *dc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 349/638 drm/tegra: rgb: Fix missing clk_put() in the error handling paths of tegra_dc_rgb_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 45c8034db47842b25a3ab6139d71e13b4e67b9b3 ]
If clk_get_sys(..., "pll_d2_out0") fails, the clk_get_sys() call must be undone.
Add the missing clk_put and a new 'put_pll_d_out0' label in the error handling path, and use it.
--- drivers/gpu/drm/tegra/rgb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/rgb.c +3 -1
@@ -244,7 +244,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)if (IS_ERR (rgb->pll_d2_out0)) { err =PTR_ERR (rgb->pll_d2_out0);dev_err (dc->dev,"failed to get pll_d2_out0: %d\n" , err); - goto remove; + goto put_pll; } }
@@ -252,6 +252,8 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)return 0 ; +put_pll: +clk_put (rgb->pll_d_out0); remove:tegra_output_remove (&rgb->output);return err;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 350/638 drm/tegra: output: Fix missing i2c_put_adapter() in the error handling paths of tegra_output_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 2db4578ef6ffb2b52115ca0ebf897b60ec559556 ]
If an error occurs after a successful of_get_i2c_adapter_by_node() call, it should be undone by a corresponding i2c_put_adapter().
Add the missing i2c_put_adapter() call.
--- drivers/gpu/drm/tegra/output.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/tegra/output.c +12 -4
@@ -142,8 +142,10 @@ int tegra_output_probe(struct tegra_output *output)GPIOD_IN , "HDMI hotplug detect");if (IS_ERR (output->hpd_gpio)) { -if (PTR_ERR (output->hpd_gpio) != -ENOENT ) -return PTR_ERR (output->hpd_gpio); +if (PTR_ERR (output->hpd_gpio) != -ENOENT ) { + err =PTR_ERR (output->hpd_gpio); + goto put_i2c; + } output->hpd_gpio =NULL ; }
@@ -152,7 +154,7 @@ int tegra_output_probe(struct tegra_output *output) err =gpiod_to_irq (output->hpd_gpio);if (err <0 ) {dev_err (output->dev,"gpiod_to_irq(): %d\n" , err); -return err; + goto put_i2c; } output->hpd_irq = err;
@@ -165,7 +167,7 @@ int tegra_output_probe(struct tegra_output *output)if (err <0 ) {dev_err (output->dev,"failed to request IRQ#%u: %d\n" , output->hpd_irq, err); -return err; + goto put_i2c; } output->connector.polled =DRM_CONNECTOR_POLL_HPD ;
@@ -179,6 +181,12 @@ int tegra_output_probe(struct tegra_output *output) }return 0 ; + +put_i2c: +if (output->ddc) +i2c_put_adapter (output->ddc); + +return err; }void tegra_output_remove (struct tegra_output *output)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 351/638 drm/rockchip: inno_hdmi: Fix video timing
In reply to Sasha LevinFrom: Alex Bee <[email protected]>
[ Upstream commit 47a145c03484d33e65d773169d5ca1b9fe2a492e ]
The controller wants the difference between *total and *sync_start in the HDMI_VIDEO_EXT_*DELAY registers. Otherwise the signal is very unstable for certain non-VIC modes. See downstream commit [0].
[0] https://github.com/rockchip-linux/kernel/commit/8eb559f2502c
--- drivers/gpu/drm/rockchip/inno_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/inno_hdmi.c +2 -2
@@ -412,7 +412,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HBLANK_L , value &0xFF );hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HBLANK_H , (value >>8 ) &0xFF ); - value = mode->hsync_start - mode->hdisplay; + value = mode->htotal - mode->hsync_start;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HDELAY_L , value &0xFF );hdmi_writeb (hdmi,HDMI_VIDEO_EXT_HDELAY_H , (value >>8 ) &0xFF );
@@ -427,7 +427,7 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, value = mode->vtotal - mode->vdisplay;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_VBLANK , value &0xFF ); - value = mode->vsync_start - mode->vdisplay; + value = mode->vtotal - mode->vsync_start;hdmi_writeb (hdmi,HDMI_VIDEO_EXT_VDELAY , value &0xFF ); value = mode->vsync_end - mode->vsync_start;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 352/638 drm: Don't treat 0 as -1 in drm_fixp2int_ceil
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
[ Upstream commit cf8837d7204481026335461629b84ac7f4538fa5 ]
Unit testing this in VKMS shows that passing 0 into this function returns -1, which is highly counter- intuitive. Fix it by checking whether the input is
Quoted 1 line
= 0 instead of > 0.
--- include/drm/drm_fixed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_fixed.h +1 -1
@@ -95,7 +95,7 @@ static inline int drm_fixp2int_round(s64 a)static inline int drm_fixp2int_ceil (s64 a) { -if (a >0 ) +if (a >=0 )return drm_fixp2int (a +DRM_FIXED_ALMOST_ONE );else return drm_fixp2int (a -DRM_FIXED_ALMOST_ONE );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 353/638 drm/vkms: Avoid reading beyond LUT array
In reply to Sasha LevinFrom: Harry Wentland <[email protected]>
[ Upstream commit 2fee84030d12d9fddfa874e4562d71761a129277 ]
When the floor LUT index (drm_fixp2int(lut_index) is the last index of the array the ceil LUT index will point to an entry beyond the array. Make sure we guard against it and use the value of the floor LUT index.
v3:
- Drop bits from commit description that didn't contribute anything of value
--- drivers/gpu/drm/vkms/vkms_composer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/vkms/vkms_composer.c +10 -4
@@ -123,6 +123,8 @@ static u16 apply_lut_to_channel_value(const struct vkms_color_lut *lut, u16 chan enum lut_channel channel) {s64 lut_index =get_lut_index (lut, channel_value); +u16 *floor_lut_value, *ceil_lut_value; +u16 floor_channel_value, ceil_channel_value;/* * This checks if `struct drm_color_lut` has any gap added by the compiler
@@ -130,11 +132,15 @@ static u16 apply_lut_to_channel_value(const struct vkms_color_lut *lut, u16 chan*/ static_assert (sizeof (struct drm_color_lut ) ==sizeof (__u16) *4 ); -u16 *floor_lut_value = (__u16 *)&lut->base[drm_fixp2int (lut_index)]; -u16 *ceil_lut_value = (__u16 *)&lut->base[drm_fixp2int_ceil (lut_index)]; + floor_lut_value = (__u16 *)&lut->base[drm_fixp2int (lut_index)]; +if (drm_fixp2int (lut_index) == (lut->lut_length -1 )) +/* We're at the end of the LUT array, use same value for ceil and floor */ + ceil_lut_value = floor_lut_value; +else + ceil_lut_value = (__u16 *)&lut->base[drm_fixp2int_ceil (lut_index)]; -u16 floor_channel_value = floor_lut_value[channel]; -u16 ceil_channel_value = ceil_lut_value[channel]; + floor_channel_value = floor_lut_value[channel]; + ceil_channel_value = ceil_lut_value[channel];return lerp_u16 (floor_channel_value, ceil_channel_value, lut_index &DRM_FIXED_DECIMAL_MASK );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 354/638 drm/vmwgfx: fix a memleak in vmw_gmrid_man_get_node
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 89709105a6091948ffb6ec2427954cbfe45358ce ]
When ida_alloc_max fails, resources allocated before should be freed, including *res allocated by kmalloc and ttm_resource_init.
--- drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +4 -1
@@ -64,8 +64,11 @@ static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man,ttm_resource_init (bo, place, *res); id =ida_alloc_max (&gman->gmr_ida, gman->max_gmr_ids -1 ,GFP_KERNEL ); -if (id <0 ) +if (id <0 ) { +ttm_resource_fini (man, *res); +kfree (*res);return id; + }spin_lock (&gman->lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 355/638 drm/rockchip: lvds: do not overwrite error code
In reply to Sasha LevinFrom: Quentin Schulz <[email protected]>
[ Upstream commit 79b09453c4e369ca81cfb670d0136d089e3b92f0 ]
ret variable stores the return value of drm_of_find_panel_or_bridge which can return error codes different from EPROBE_DEFER. Therefore, let's just return that error code instead of forcing it to EPROBE_DEFER.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +0 -1
@@ -578,7 +578,6 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, goto err_put_port; }else if (ret) {DRM_DEV_ERROR (dev,"failed to find panel and bridge node\n" ); - ret = -EPROBE_DEFER ; goto err_put_port; }if (lvds->panel)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 356/638 drm/rockchip: lvds: do not print scary message when probing defer
In reply to Sasha LevinFrom: Quentin Schulz <[email protected]>
[ Upstream commit 52d11c863ac92e36a0365249f7f6d27ac48c78bc ]
This scary message can misled the user into thinking something bad has happened and needs to be fixed, however it could simply be part of a normal boot process where EPROBE_DEFER is taken into account. Therefore, let's use dev_err_probe so that this message doesn't get shown (by default) when the return code is EPROBE_DEFER.
--- drivers/gpu/drm/rockchip/rockchip_lvds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_lvds.c +1 -1
@@ -577,7 +577,7 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, ret = -EINVAL ; goto err_put_port; }else if (ret) { -DRM_DEV_ERROR (dev,"failed to find panel and bridge node\n" ); +dev_err_probe (dev, ret,"failed to find panel and bridge node\n" ); goto err_put_port; }if (lvds->panel)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 357/638 drm/panel-edp: use put_sync in unprepare
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 49ddab089611ae5ddd0201ddbbf633da75bfcc25 ]
Some edp panel requires T10 (Delay from end of valid video data transmitted by the Source device to power-off) less than 500ms. Using autosuspend with delay set as 1000 violates this requirement.
Use put_sync_suspend in unprepare to meet the spec. For other cases (such as getting EDID), it still uses autosuspend.
--- drivers/gpu/drm/panel/panel-edp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +1 -2
@@ -413,8 +413,7 @@ static int panel_edp_unprepare(struct drm_panel *panel)if (!p->prepared)return 0 ; -pm_runtime_mark_last_busy (panel->dev); - ret =pm_runtime_put_autosuspend (panel->dev); + ret =pm_runtime_put_sync_suspend (panel->dev);if (ret <0 )return ret; p->prepared = false;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 358/638 drm/lima: fix a memleak in lima_heap_alloc
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 04ae3eb470e52a3c41babe85ff8cee195e4dcbea ]
When lima_vm_map_bo fails, the resources need to be deallocated, or there will be memleaks.
--- drivers/gpu/drm/lima/lima_gem.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/gpu/drm/lima/lima_gem.c +14 -9
@@ -75,29 +75,34 @@ int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm) }else { bo->base.sgt =kmalloc (sizeof (*bo->base.sgt),GFP_KERNEL );if (!bo->base.sgt) { -sg_free_table (&sgt); -return -ENOMEM ; + ret = -ENOMEM ; + goto err_out0; } } ret =dma_map_sgtable (dev, &sgt,DMA_BIDIRECTIONAL ,0 ); -if (ret) { -sg_free_table (&sgt); -kfree (bo->base.sgt); - bo->base.sgt =NULL ; -return ret; - } +if (ret) + goto err_out1; *bo->base.sgt = sgt;if (vm) { ret =lima_vm_map_bo (vm, bo, old_size >>PAGE_SHIFT );if (ret) -return ret; + goto err_out2; } bo->heap_size = new_size;return 0 ; + +err_out2: +dma_unmap_sgtable (dev, &sgt,DMA_BIDIRECTIONAL ,0 ); +err_out1: +kfree (bo->base.sgt); + bo->base.sgt =NULL ; +err_out0: +sg_free_table (&sgt); +return ret; } int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 359/638 ASoC: amd: acp: Add missing error handling in sof-mach
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit d0ada20279db2649a7549a2b8a4a3379c59f238d ]
Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine driver's probe function. Note there is no need for an undo.
While at it, switch to dev_err_probe().
--- sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/amd/acp/acp-sof-mach.c +6 -8
@@ -120,16 +120,14 @@ static int acp_sof_probe(struct platform_device *pdev)if (dmi_id && dmi_id->driver_data) acp_card_drvdata->tdm_mode = dmi_id->driver_data; -acp_sofdsp_dai_links_create (card); + ret =acp_sofdsp_dai_links_create (card); +if (ret) +return dev_err_probe (&pdev->dev, ret,"Failed to create DAI links\n" ); ret =devm_snd_soc_register_card (&pdev->dev, card); -if (ret) { -dev_err (&pdev->dev, -"devm_snd_soc_register_card(%s) failed: %d\n" , - card->name, ret); -return ret; - } - +if (ret) +return dev_err_probe (&pdev->dev, ret, +"Failed to register card(%s)\n" , card->name);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 360/638 ASoC: SOF: amd: Fix memory leak in amd_sof_acp_probe()
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 222be59e5eed1554119294edc743ee548c2371d0 ]
Driver uses kasprintf() to initialize fw_{code,data}_bin members of struct acp_dev_data, but kfree() is never called to deallocate the memory, which results in a memory leak.
Fix the issue by switching to devm_kasprintf(). Additionally, ensure the allocation was successful by checking the pointer validity.
--- sound/soc/sof/amd/acp.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
sound/soc/sof/amd/acp.c +19 -9
@@ -547,17 +547,27 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) adata->signed_fw_image = false; dmi_id =dmi_first_match (acp_sof_quirk_table);if (dmi_id && dmi_id->driver_data) { - adata->fw_code_bin =kasprintf (GFP_KERNEL ,"%s/sof-%s-code.bin" , - plat_data->fw_filename_prefix, - chip->name); - adata->fw_data_bin =kasprintf (GFP_KERNEL ,"%s/sof-%s-data.bin" , - plat_data->fw_filename_prefix, - chip->name); - adata->signed_fw_image = dmi_id->driver_data; + adata->fw_code_bin =devm_kasprintf (sdev->dev,GFP_KERNEL , +"%s/sof-%s-code.bin" , + plat_data->fw_filename_prefix, + chip->name); +if (!adata->fw_code_bin) { + ret = -ENOMEM ; + goto free_ipc_irq; + } + + adata->fw_data_bin =devm_kasprintf (sdev->dev,GFP_KERNEL , +"%s/sof-%s-data.bin" , + plat_data->fw_filename_prefix, + chip->name); +if (!adata->fw_data_bin) { + ret = -ENOMEM ; + goto free_ipc_irq; + } -dev_dbg (sdev->dev,"fw_code_bin:%s, fw_data_bin:%s\n" , adata->fw_code_bin, - adata->fw_data_bin); + adata->signed_fw_image = dmi_id->driver_data; } + adata->enable_fw_debug = enable_fw_debug;acp_memory_init (sdev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 361/638 dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA
In reply to Sasha LevinFrom: Peter Robinson <[email protected]>
[ Upstream commit 33b7db45533af240fe44e809f9dc4d604cf82d07 ]
Update the architecture dependency to be the generic Tegra because the driver works on the four latest Tegra generations not just T210, if you build a kernel with a specific ARCH_TEGRA_xxx_SOC option that excludes 210 you don't get this driver.
--- drivers/dma/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma/Kconfig +7 -7
@@ -629,16 +629,16 @@ config TEGRA20_APB_DMA config TEGRA210_ADMA tristate "NVIDIA Tegra210 ADMA support" - depends on (ARCH_TEGRA_210_SOC || COMPILE_TEST) + depends on (ARCH_TEGRA || COMPILE_TEST) select DMA_ENGINE select DMA_VIRTUAL_CHANNELS help - Support for the NVIDIA Tegra210 ADMA controller driver. The - DMA controller has multiple DMA channels and is used to service - various audio clients in the Tegra210 audio processing engine - (APE). This DMA controller transfers data from memory to - peripheral and vice versa. It does not support memory to - memory data transfer. + Support for the NVIDIA Tegra210/Tegra186/Tegra194/Tegra234 ADMA + controller driver. The DMA controller has multiple DMA channels + and is used to service various audio clients in the Tegra210 + audio processing engine (APE). This DMA controller transfers + data from memory to peripheral and vice versa. It does not + support memory to memory data transfer. config TIMB_DMA tristate "Timberdale FPGA DMA support"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 362/638 media: tc358743: register v4l2 async device only after successful setup
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 87399f1ff92203d65f1febf5919429f4bb613a02 ]
Ensure the device has been setup correctly before registering the v4l2 async device, thus allowing userspace to access.
--- drivers/media/i2c/tc358743.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/i2c/tc358743.c +4 -3
@@ -2091,9 +2091,6 @@ static int tc358743_probe(struct i2c_client *client) state->mbus_fmt_code =MEDIA_BUS_FMT_RGB888_1X24 ; sd->dev = &client->dev; - err =v4l2_async_register_subdev (sd); -if (err <0 ) - goto err_hdl;mutex_init (&state->confctl_mutex);
@@ -2151,6 +2148,10 @@ static int tc358743_probe(struct i2c_client *client)if (err) goto err_work_queues; + err =v4l2_async_register_subdev (sd); +if (err <0 ) + goto err_work_queues; +v4l2_info (sd,"%s found @ 0x%x (%s)\n" , client->name, client->addr <<1 , client->adapter->name);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 363/638 media: cadence: csi2rx: use match fwnode for media link
In reply to Sasha LevinFrom: Julien Massot <[email protected]>
[ Upstream commit 448699c522af9e3266f168c3f51f4c3713c7bee1 ]
Since commit 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching"), async connections are matched using the async sub-device fwnode, not that
of the endpoint. Fix this by using the fwnode of the connection match to find the pad.
--- drivers/media/platform/cadence/cdns-csi2rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/cadence/cdns-csi2rx.c +1 -1
@@ -319,7 +319,7 @@ static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,struct csi2rx_priv *csi2rx =v4l2_subdev_to_csi2rx (subdev); csi2rx->source_pad =media_entity_get_fwnode_pad (&s_subdev->entity, - s_subdev->fwnode, + asd->match.fwnode,MEDIA_PAD_FL_SOURCE );if (csi2rx->source_pad <0 ) { dev_err(csi2rx->dev, "Couldn't find output pad for subdev %s\n",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 364/638 PCI/DPC: Print all TLP Prefixes, not just the first
In reply to Sasha LevinFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 6568d82512b0a64809acff3d7a747362fa4288c8 ]
The TLP Prefix Log Register consists of multiple DWORDs (PCIe r6.1 sec 7.9.14.13) but the loop in dpc_process_rp_pio_error() keeps reading from the first DWORD, so we print only the first PIO TLP Prefix (duplicated several times), and we never print the second, third, etc., Prefixes.
Add the iteration count based offset calculation into the config read.
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -1
@@ -230,7 +230,7 @@ static void dpc_process_rp_pio_error(struct pci_dev *pdev)for (i =0 ; i < pdev->dpc_rp_log_size -5 ; i++) {pci_read_config_dword (pdev, - cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG , &prefix); + cap +PCI_EXP_DPC_RP_PIO_TLPPREFIX_LOG + i *4 , &prefix);pci_err (pdev,"TLP Prefix Header: dw%d, %#010x\n" , i, prefix); } clear_status:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 365/638 perf record: Fix possible incorrect free in record__switch_output()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit aff10a165201f6f60cff225083ce301ad3f5d8f1 ]
perf_data__switch() may not assign a legal value to 'new_filename'. In this case, 'new_filename' uses the on-stack value, which may cause a incorrect free and unexpected result.
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -1786,8 +1786,8 @@ static int record__switch_output(struct record *rec, bool at_exit) {struct perf_data *data = &rec->data; +char *new_filename =NULL ;int fd, err; -char *new_filename;/* Same Size: "2015122520103046"*/ char timestamp[] ="InvalidTimestamp" ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 366/638 perf top: Uniform the event name for the hybrid machine
In reply to Sasha LevinFrom: Kan Liang <[email protected]>
[ Upstream commit a61f89bf76ef6f87ec48dd90dbc73a6cf9952edc ]
It's hard to distinguish the default cycles events among hybrid PMUs. For example,
$ perf top Available samples 385 cycles:P 903 cycles:P
The other tool, e.g., perf record, uniforms the event name and adds the hybrid PMU name before opening the event. So the events can be easily distinguished. Apply the same methodology for the perf top as well.
The evlist__uniquify_name() will be invoked by both record and top. Move it to util/evlist.c
With the patch:
$ perf top Available samples 148 cpu_atom/cycles:P/ 1K cpu_core/cycles:P/
Stable-dep-of: 02f9b50e0481 ("perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording")
--- tools/perf/builtin-record.c | 28 +--------------------------- tools/perf/builtin-top.c | 1 + tools/perf/util/evlist.c | 25 +++++++++++++++++++++++++ tools/perf/util/evlist.h | 1 + 4 files changed, 28 insertions(+), 27 deletions(-)
tools/perf/builtin-record.c +1 -27
@@ -2184,32 +2184,6 @@ static void hit_auxtrace_snapshot_trigger(struct record *rec) } } -static void record__uniquify_name (struct record *rec) -{ -struct evsel *pos; -struct evlist *evlist = rec->evlist; -char *new_name; -int ret; - -if (perf_pmus__num_core_pmus () ==1 ) -return ; - -evlist__for_each_entry (evlist, pos) { -if (!evsel__is_hybrid (pos)) -continue ; - -if (strchr (pos->name,'/' )) -continue ; - - ret =asprintf (&new_name,"%s/%s/" , - pos->pmu_name, pos->name); -if (ret) { -free (pos->name); - pos->name = new_name; - } - } -} -static int record__terminate_thread (struct record_thread *thread_data) {int err;
@@ -2443,7 +2417,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)if (data->is_pipe && rec->evlist->core.nr_entries ==1 ) rec->opts.sample_id = true; -record__uniquify_name (rec); +evlist__uniquify_name (rec->evlist);/* Debug message used by test scripts */ pr_debug3 ("perf record opening and mmapping events\n" );
tools/perf/builtin-top.c +1 -0
@@ -1299,6 +1299,7 @@ static int __cmd_top(struct perf_top *top) } } +evlist__uniquify_name (top->evlist); ret =perf_top__start_counters (top);if (ret)return ret;
tools/perf/util/evlist.c +25 -0
@@ -2507,3 +2507,28 @@ void evlist__warn_user_requested_cpus(struct evlist *evlist, const char *cpu_lis }perf_cpu_map__put (user_requested_cpus); } + +void evlist__uniquify_name (struct evlist *evlist) +{ +struct evsel *pos; +char *new_name; +int ret; + +if (perf_pmus__num_core_pmus () ==1 ) +return ; + +evlist__for_each_entry (evlist, pos) { +if (!evsel__is_hybrid (pos)) +continue ; + +if (strchr (pos->name,'/' )) +continue ; + + ret =asprintf (&new_name,"%s/%s/" , + pos->pmu_name, pos->name); +if (ret) { +free (pos->name); + pos->name = new_name; + } + } +}
tools/perf/util/evlist.h +1 -0
@@ -441,5 +441,6 @@ struct evsel *evlist__find_evsel(struct evlist *evlist, int idx);int evlist__scnprintf_evsels (struct evlist *evlist,size_t size,char *bf);void evlist__check_mem_load_aux (struct evlist *evlist);void evlist__warn_user_requested_cpus (struct evlist *evlist,const char *cpu_list); +void evlist__uniquify_name (struct evlist *evlist);#endif /* __PERF_EVLIST_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 367/638 perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 02f9b50e04812782fd006ed21c6da1c5e3e373da ]
In pipe mode, no need to switch perf data output, therefore, '--timestamp-filename' option should not take effect.
Check the conflict before recording and output WARNING.
In this case, the check pipe mode in perf_data__switch() can be removed.
Before:
# perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1
# To display the perf.data header info, please use --header/--header-only options.
#
[ perf record: Woken up 1 times to write data ]
[ perf record: Dump -.2024011812110182 ]
#
# Total Lost Samples: 0
#
# Samples: 4K of event 'cycles:P'
# Event count (approx.): 2176784359
#
# Overhead Command Shared Object Symbol
# ........ ....... .................... ......................................
#
97.83% perf perf [.] noploop #
# (Tip: Print event counts in CSV format with: perf stat -x,) #
After:
# perf record --timestamp-filename -o- perf test -w noploop | perf report -i- --percent-limit=1
WARNING: --timestamp-filename option is not available in pipe mode.
# To display the perf.data header info, please use --header/--header-only options.
#
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ]
#
# Total Lost Samples: 0
#
# Samples: 4K of event 'cycles:P'
# Event count (approx.): 2185575421
#
# Overhead Command Shared Object Symbol
# ........ ....... ..................... .............................................
#
97.75% perf perf [.] noploop #
# (Tip: Profiling branch (mis)predictions with: perf record -b / perf report) #
--- tools/perf/builtin-record.c | 5 +++++ tools/perf/util/data.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +5 -0
@@ -2417,6 +2417,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)if (data->is_pipe && rec->evlist->core.nr_entries ==1 ) rec->opts.sample_id = true; +if (rec->timestamp_filename &&perf_data__is_pipe (data)) { + rec->timestamp_filename = false; +pr_warning ("WARNING: --timestamp-filename option is not available in pipe mode.\n" ); + } +evlist__uniquify_name (rec->evlist);/* Debug message used by test scripts */
tools/perf/util/data.c +0 -2
@@ -418,8 +418,6 @@ int perf_data__switch(struct perf_data *data, {int ret; -if (check_pipe (data)) -return -EINVAL ;if (perf_data__is_read (data))return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 368/638 HID: lenovo: Add middleclick_workaround sysfs knob for cptkbd
In reply to Sasha LevinFrom: Mikhail Khvainitski <[email protected]>
[ Upstream commit 2814646f76f8518326964f12ff20aaee70ba154d ]
Previous attempt to autodetect well-behaving patched firmware introduced in commit 46a0a2c96f0f ("HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround") has shown that there are false-positives on original firmware (on both 1st gen and 2nd gen keyboards) which causes the middle button click workaround to be mistakenly disabled.
This commit adds explicit parameter to sysfs to control this workaround.
--- drivers/hid/hid-lenovo.c | 57 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-)
drivers/hid/hid-lenovo.c +39 -18
@@ -54,10 +54,10 @@ struct lenovo_drvdata {/* 0: Up * 1: Down (undecided) * 2: Scrolling -* 3: Patched firmware, disable workaround */ u8 middlebutton_state;bool fn_lock; +bool middleclick_workaround_cptkbd; };#define map_key_clear (c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
@@ -621,6 +621,36 @@ static ssize_t attr_sensitivity_store_cptkbd(struct device *dev,return count; } +static ssize_t attr_middleclick_workaround_show_cptkbd (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct hid_device *hdev =to_hid_device (dev); +struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); + +return snprintf (buf,PAGE_SIZE ,"%u\n" , + cptkbd_data->middleclick_workaround_cptkbd); +} + +static ssize_t attr_middleclick_workaround_store_cptkbd (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct hid_device *hdev =to_hid_device (dev); +struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); +int value; + +if (kstrtoint (buf,10 , &value)) +return -EINVAL ; +if (value <0 || value >1 ) +return -EINVAL ; + + cptkbd_data->middleclick_workaround_cptkbd = !!value; + +return count; +} +static struct device_attribute dev_attr_fn_lock = __ATTR(fn_lock, S_IWUSR | S_IRUGO,
@@ -632,10 +662,16 @@ static struct device_attribute dev_attr_sensitivity_cptkbd = attr_sensitivity_show_cptkbd, attr_sensitivity_store_cptkbd); +static struct device_attribute dev_attr_middleclick_workaround_cptkbd = +__ATTR (middleclick_workaround,S_IWUSR |S_IRUGO , + attr_middleclick_workaround_show_cptkbd, + attr_middleclick_workaround_store_cptkbd); +static struct attribute *lenovo_attributes_cptkbd[] = { &dev_attr_fn_lock.attr, &dev_attr_sensitivity_cptkbd.attr, + &dev_attr_middleclick_workaround_cptkbd.attr,NULL };
@@ -686,23 +722,7 @@ static int lenovo_event_cptkbd(struct hid_device *hdev, {struct lenovo_drvdata *cptkbd_data =hid_get_drvdata (hdev); -if (cptkbd_data->middlebutton_state !=3 ) { -/* REL_X and REL_Y events during middle button pressed -* are only possible on patched, bug-free firmware -* so set middlebutton_state to 3 -* to never apply workaround anymore -*/ -if (hdev->product ==USB_DEVICE_ID_LENOVO_CUSBKBD && - cptkbd_data->middlebutton_state ==1 && - usage->type ==EV_REL && - (usage->code ==REL_X || usage->code ==REL_Y )) { - cptkbd_data->middlebutton_state =3 ; -/* send middle button press which was hold before */ -input_event (field->hidinput->input, -EV_KEY ,BTN_MIDDLE ,1 ); -input_sync (field->hidinput->input); - } - +if (cptkbd_data->middleclick_workaround_cptkbd) {/* "wheel" scroll events */ if (usage->type ==EV_REL && (usage->code ==REL_WHEEL || usage->code ==REL_HWHEEL )) {
@@ -1166,6 +1186,7 @@ static int lenovo_probe_cptkbd(struct hid_device *hdev) cptkbd_data->middlebutton_state =0 ; cptkbd_data->fn_lock = true; cptkbd_data->sensitivity =0x05 ; + cptkbd_data->middleclick_workaround_cptkbd = true;lenovo_features_set_cptkbd (hdev); ret =sysfs_create_group (&hdev->dev.kobj, &lenovo_attr_group_cptkbd);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 369/638 drm/amd/display: Fix a potential buffer overflow in 'dp_dsc_clock_en_read()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 4b09715f1504f1b6e8dff0e9643630610bc05141 ]
Tell snprintf() to store at most 10 bytes in the output buffer instead of 30.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:1508 dp_dsc_clock_en_read() error: snprintf() is printing too much 30 vs 10
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
@@ -1453,7 +1453,7 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,const uint32_t rd_buf_size =10 ;struct pipe_ctx *pipe_ctx;ssize_t result =0 ; -int i, r, str_len =30 ; +int i, r, str_len =10 ; rd_buf =kcalloc (rd_buf_size,sizeof (char ),GFP_KERNEL );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 370/638 perf pmu: Treat the msr pmu as software
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 24852ef2e2d5c555c2da05baff112ea414b6e0f5 ]
The msr PMU is a software one, meaning msr events may be grouped with events in a hardware context. As the msr PMU isn't marked as a software PMU by perf_pmu__is_software, groups with the msr PMU in are broken and the msr events placed in a different group. This may lead to multiplexing errors where a hardware event isn't counted while the msr event, such as tsc, is. Fix all of this by marking the msr PMU as software, which agrees with the driver.
Before:
```
$ perf stat -e '{slots,tsc}' -a true
WARNING: events were regrouped to match PMUs
Performance counter stats for 'system wide':
1,750,335 slots
4,243,557 tsc
0.001456717 seconds time elapsed
```After:
```
$ perf stat -e '{slots,tsc}' -a true
Performance counter stats for 'system wide':
12,526,380 slots
3,415,163 tsc
0.001488360 seconds time elapsed
```--- tools/perf/util/pmu.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
tools/perf/util/pmu.c +11 -1
@@ -1735,6 +1735,12 @@ bool pmu__name_match(const struct perf_pmu *pmu, const char *pmu_name)bool perf_pmu__is_software (const struct perf_pmu *pmu) { +const char *known_sw_pmus[] = { +"kprobe" , +"msr" , +"uprobe" , + }; +if (pmu->is_core || pmu->is_uncore || pmu->auxtrace)return false;switch (pmu->type) {
@@ -1746,7 +1752,11 @@ bool perf_pmu__is_software(const struct perf_pmu *pmu)case PERF_TYPE_BREAKPOINT :return true;default :break ; } -return !strcmp (pmu->name,"kprobe" ) || !strcmp (pmu->name,"uprobe" ); +for (size_t i =0 ; i <ARRAY_SIZE (known_sw_pmus); i++) { +if (!strcmp (pmu->name, known_sw_pmus[i])) +return true; + } +return false; }FILE *perf_pmu__open_file (struct perf_pmu *pmu,const char *name)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 371/638 drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfer_func()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 9ccfe80d022df7c595f1925afb31de2232900656 ]
The 'stream' pointer is used in dcn10_set_output_transfer_func() before the check if 'stream' is NULL.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1892 dcn10_set_output_transfer_func() warn: variable dereferenced before check 'stream' (see line 1875)
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -2
@@ -1832,6 +1832,9 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, {struct dpp *dpp = pipe_ctx->plane_res.dpp; +if (!stream) +return false; +if (dpp ==NULL )return false;
@@ -1854,8 +1857,8 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, }else dpp->funcs->dpp_program_regamma_pwl (dpp,NULL ,OPP_REGAMMA_BYPASS ); -if (stream !=NULL && stream->ctx !=NULL && - stream->out_transfer_func !=NULL ) { +if (stream->ctx && + stream->out_transfer_func) {log_tf (stream->ctx, stream->out_transfer_func, dpp->regamma_params.hw_points_num);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 372/638 ASoC: sh: rz-ssi: Fix error message print
In reply to Sasha LevinFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 9a6d7c4fb2801b675a9c31a7ceb78c84b8c439bc ]
The devm_request_irq() call is done for "dma_rt" interrupt but the error message printed "dma_tx" interrupt on failure, fix this by updating dma_tx -> dma_rt in dev_err_probe() message. While at it aligned the code.
--- sound/soc/sh/rz-ssi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rz-ssi.c +1 -1
@@ -1016,7 +1016,7 @@ static int rz_ssi_probe(struct platform_device *pdev) dev_name(&pdev->dev), ssi);if (ret <0 )return dev_err_probe (&pdev->dev, ret, -"irq request error (dma_tx)\n" ); +"irq request error (dma_rt)\n" ); }else {if (ssi->irq_tx <0 )return ssi->irq_tx;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 373/638 drm/vmwgfx: Fix vmw_du_get_cursor_mob fencing of newly-created MOBs
In reply to Sasha LevinFrom: Martin Krastev <[email protected]>
[ Upstream commit ed96cf7ad590989b009d6da5cd26387d995dac13 ]
The fencing of MOB creation used in vmw_du_get_cursor_mob was incompatible with register-based device communication employed by this routine. As a result cursor MOB creation was racy, leading to potentially broken/missing mouse cursor on desktops using CursorMob device feature.
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +10 -1
@@ -272,6 +272,7 @@ static int vmw_du_get_cursor_mob(struct vmw_cursor_plane *vcp,u32 size =vmw_du_cursor_mob_size (vps->base.crtc_w, vps->base.crtc_h);u32 i;u32 cursor_max_dim, mob_max_size; +struct vmw_fence_obj *fence =NULL ;int ret; if (!dev_priv->has_mob ||
@@ -313,7 +314,15 @@ static int vmw_du_get_cursor_mob(struct vmw_cursor_plane *vcp,if (ret !=0 ) goto teardown; -vmw_bo_fence_single (&vps->cursor.bo->tbo,NULL ); + ret =vmw_execbuf_fence_commands (NULL , dev_priv, &fence,NULL ); +if (ret !=0 ) { +ttm_bo_unreserve (&vps->cursor.bo->tbo); + goto teardown; + } + +dma_fence_wait (&fence->base, false); +dma_fence_put (&fence->base); +ttm_bo_unreserve (&vps->cursor.bo->tbo);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 374/638 pinctrl: renesas: r8a779g0: Add missing SCIF_CLK2 pin group/function
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 68540257cdf1d07ff8a649aa94c21c5804bbb9b0 ]
R-Car V4H actually has two SCIF_CLK pins.
The second pin provides the SCIF_CLK signal for HSCIF2 and SCIF4.
--- drivers/pinctrl/renesas/pfc-r8a779g0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/pinctrl/renesas/pfc-r8a779g0.c +14 -0
@@ -2384,6 +2384,14 @@ static const unsigned int scif_clk_mux[] = { SCIF_CLK_MARK, }; +static const unsigned int scif_clk2_pins[] = { +/* SCIF_CLK2 */ +RCAR_GP_PIN (8 ,11 ), +}; +static const unsigned int scif_clk2_mux[] = { +SCIF_CLK2_MARK , +}; +/* - SSI ------------------------------------------------- */ static const unsigned int ssi_data_pins[] = {/* SSI_SD */
@@ -2694,6 +2702,7 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {SH_PFC_PIN_GROUP (scif4_clk),SH_PFC_PIN_GROUP (scif4_ctrl),SH_PFC_PIN_GROUP (scif_clk), +SH_PFC_PIN_GROUP (scif_clk2),SH_PFC_PIN_GROUP (ssi_data), SH_PFC_PIN_GROUP(ssi_ctrl),
@@ -3015,6 +3024,10 @@ static const char * const scif_clk_groups[] = { "scif_clk", }; +static const char *const scif_clk2_groups[] = { +"scif_clk2" , +}; +static const char *const ssi_groups[] = {"ssi_data" ,"ssi_ctrl" ,
@@ -3102,6 +3115,7 @@ static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif3),SH_PFC_FUNCTION (scif4),SH_PFC_FUNCTION (scif_clk), +SH_PFC_FUNCTION (scif_clk2), SH_PFC_FUNCTION(ssi),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 375/638 clk: samsung: exynos850: Propagate SPI IPCLK rate change
In reply to Sasha LevinFrom: Sam Protsenko <[email protected]>
[ Upstream commit 67c15187d4910ee353374676d4dddf09d8cb227e ]
When SPI transfer is being prepared, the spi-s3c64xx driver will call clk_set_rate() to change the rate of SPI source clock (IPCLK). But IPCLK is a gate (leaf) clock, so it must propagate the rate change up the clock tree, so that corresponding DIV clocks can actually change their divider values. Add CLK_SET_RATE_PARENT flag to corresponding clocks for all SPI instances in Exynos850 (spi_0, spi_1 and spi_2) to make it possible. This change involves next clocks:
usi_spi_0:
Clock Block Div range
--------------------------------------------
gout_spi0_ipclk CMU_PERI -
dout_peri_spi0 CMU_PERI /1..32
mout_peri_spi_user CMU_PERI -
dout_peri_ip CMU_TOP /1..16
usi_cmgp0:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi0_ipclk CMU_CMGP -
dout_cmgp_usi0 CMU_CMGP /1..32
mout_cmgp_usi0 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
usi_cmgp1:
Clock Block Div range
--------------------------------------------
gout_cmgp_usi1_ipclk CMU_CMGP -
dout_cmgp_usi1 CMU_CMGP /1..32
mout_cmgp_usi1 CMU_CMGP -
gout_clkcmu_cmgp_bus CMU_APM -
dout_apm_bus CMU_APM /1..8
With input clock of 400 MHz, this scheme provides next IPCLK rate range, for each SPI block:
SPI0: 781 kHz ... 400 MHz
SPI1/2: 1.6 MHz ... 400 MHzAccounting for internal /4 divider in SPI blocks, and because the max SPI frequency is limited at 50 MHz, it gives us next SPI SCK rates:
SPI0: 200 kHz ... 49.9 MHz
SPI1/2: 400 kHz ... 49.9 MHzWhich should cover all possible applications of SPI bus. Of course, setting SPI frequency to values as low as 500 kHz will also affect the common bus dividers (dout_apm_bus or dout_peri_ip), which in turn effectively lowers the rates for all leaf bus clocks derived from those dividers, like HSI2C and I3C clocks. But at least it gives the board designer a choice, whether to keep all clocks (SPI/HSI2C/I3C) at high frequencies, or make all those clocks have lower frequencies. Not propagating the rate change to those common dividers would limit this choice to "only high frequencies are allowed for SPI/HSI2C/I3C" option, making the common dividers useless. This decision follows the "Worse is better" approach, relying on the users/engineers to know the system internals when working with such low-level features, instead of trying to account for all possible use-cases.
--- drivers/clk/samsung/clk-exynos850.c | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/clk/samsung/clk-exynos850.c +17 -16
@@ -605,7 +605,7 @@ static const struct samsung_div_clock apm_div_clks[] __initconst = {static const struct samsung_gate_clock apm_gate_clks[]__initconst = {GATE (CLK_GOUT_CLKCMU_CMGP_BUS ,"gout_clkcmu_cmgp_bus" ,"dout_apm_bus" , -CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,0 ,0 ), +CLK_CON_GAT_CLKCMU_CMGP_BUS ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CLKCMU_CHUB_BUS ,"gout_clkcmu_chub_bus" ,"mout_clkcmu_chub_bus" ,CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS ,21 ,0 ,0 ),
@@ -974,19 +974,19 @@ static const struct samsung_fixed_rate_clock cmgp_fixed_clks[] __initconst = {static const struct samsung_mux_clock cmgp_mux_clks[]__initconst = {MUX (CLK_MOUT_CMGP_ADC ,"mout_cmgp_adc" , mout_cmgp_adc_p,CLK_CON_MUX_CLK_CMGP_ADC ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ), -MUX (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, -CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ), +MUX_F (CLK_MOUT_CMGP_USI0 ,"mout_cmgp_usi0" , mout_cmgp_usi0_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), +MUX_F (CLK_MOUT_CMGP_USI1 ,"mout_cmgp_usi1" , mout_cmgp_usi1_p, +CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 ,0 ,1 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_div_clock cmgp_div_clks[]__initconst = {DIV (CLK_DOUT_CMGP_ADC ,"dout_cmgp_adc" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_DIV_DIV_CLK_CMGP_ADC ,0 ,4 ), -DIV (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ), -DIV (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , -CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ), +DIV_F (CLK_DOUT_CMGP_USI0 ,"dout_cmgp_usi0" ,"mout_cmgp_usi0" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), +DIV_F (CLK_DOUT_CMGP_USI1 ,"dout_cmgp_usi1" ,"mout_cmgp_usi1" , +CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 ,0 ,5 ,CLK_SET_RATE_PARENT ,0 ), };static const struct samsung_gate_clock cmgp_gate_clks[]__initconst = {
@@ -1001,12 +1001,12 @@ static const struct samsung_gate_clock cmgp_gate_clks[] __initconst = { "gout_clkcmu_cmgp_bus", CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK, 21, CLK_IGNORE_UNUSED, 0),GATE (CLK_GOUT_CMGP_USI0_IPCLK ,"gout_cmgp_usi0_ipclk" ,"dout_cmgp_usi0" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI0_PCLK ,"gout_cmgp_usi0_pclk" ,"gout_clkcmu_cmgp_bus" ,CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK ,21 ,0 ,0 ),GATE (CLK_GOUT_CMGP_USI1_IPCLK ,"gout_cmgp_usi1_ipclk" ,"dout_cmgp_usi1" , -CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_CMGP_USI1_PCLK ,"gout_cmgp_usi1_pclk" ,"gout_clkcmu_cmgp_bus" , CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK, 21, 0, 0),
@@ -1557,8 +1557,9 @@ static const struct samsung_mux_clock peri_mux_clks[] __initconst = { mout_peri_uart_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART_USER, 4, 1),MUX (CLK_MOUT_PERI_HSI2C_USER ,"mout_peri_hsi2c_user" , mout_peri_hsi2c_user_p,PLL_CON0_MUX_CLKCMU_PERI_HSI2C_USER ,4 ,1 ), -MUX (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , mout_peri_spi_user_p, - PLL_CON0_MUX_CLKCMU_PERI_SPI_USER, 4, 1), +MUX_F (CLK_MOUT_PERI_SPI_USER ,"mout_peri_spi_user" , + mout_peri_spi_user_p,PLL_CON0_MUX_CLKCMU_PERI_SPI_USER ,4 ,1 , + CLK_SET_RATE_PARENT, 0), }; static const struct samsung_div_clock peri_div_clks[] __initconst = {
@@ -1568,8 +1569,8 @@ static const struct samsung_div_clock peri_div_clks[] __initconst = { CLK_CON_DIV_DIV_CLK_PERI_HSI2C_1, 0, 5),DIV (CLK_DOUT_PERI_HSI2C2 ,"dout_peri_hsi2c2" ,"gout_peri_hsi2c2" ,CLK_CON_DIV_DIV_CLK_PERI_HSI2C_2 ,0 ,5 ), -DIV (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , - CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5), +DIV_F (CLK_DOUT_PERI_SPI0 ,"dout_peri_spi0" ,"mout_peri_spi_user" , + CLK_CON_DIV_DIV_CLK_PERI_SPI_0, 0, 5, CLK_SET_RATE_PARENT, 0), }; static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
@@ -1611,7 +1612,7 @@ static const struct samsung_gate_clock peri_gate_clks[] __initconst = { "mout_peri_bus_user", CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK, 21, 0, 0),GATE (CLK_GOUT_SPI0_IPCLK ,"gout_spi0_ipclk" ,"dout_peri_spi0" , -CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,0 ,0 ), +CLK_CON_GAT_GOUT_PERI_SPI_0_IPCLK ,21 ,CLK_SET_RATE_PARENT ,0 ),GATE (CLK_GOUT_SPI0_PCLK ,"gout_spi0_pclk" ,"mout_peri_bus_user" ,CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK ,21 ,0 ,0 ), GATE(CLK_GOUT_SYSREG_PERI_PCLK, "gout_sysreg_peri_pclk",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 376/638 media: v4l2: cci: print leading 0 on error
In reply to Sasha LevinFrom: Julien Massot <[email protected]>
[ Upstream commit 58ab1f9e140006e9e5686640f1773260038fe889 ]
In some error cases leading '0' for register address were missing.
--- drivers/media/v4l2-core/v4l2-cci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-cci.c +2 -2
@@ -32,7 +32,7 @@ int cci_read(struct regmap *map, u32 reg, u64 *val, int *err) ret =regmap_bulk_read (map, reg, buf, len);if (ret) { -dev_err (regmap_get_device (map),"Error reading reg 0x%4x: %d\n" , +dev_err (regmap_get_device (map),"Error reading reg 0x%04x: %d\n" , reg, ret); goto out; }
@@ -131,7 +131,7 @@ int cci_write(struct regmap *map, u32 reg, u64 val, int *err) ret =regmap_bulk_write (map, reg, buf, len);if (ret) -dev_err (regmap_get_device (map),"Error writing reg 0x%4x: %d\n" , +dev_err (regmap_get_device (map),"Error writing reg 0x%04x: %d\n" , reg, ret); out:
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 377/638 perf evsel: Fix duplicate initialization of data->id in evsel__parse_sample()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 4962aec0d684c8edb14574ccd0da53e4926ff834 ]
data->id has been initialized at line 2362, remove duplicate initialization.
--- tools/perf/util/evsel.c | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/evsel.c +0 -1
@@ -2366,7 +2366,6 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event, data->period = evsel->core.attr.sample_period; data->cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ; data->misc = event->header.misc; - data->id =-1ULL ; data->data_src =PERF_MEM_DATA_SRC_NONE ; data->vcpu =-1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 378/638 PCI/AER: Fix rootport attribute paths in ABI docs
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit 0e7d29a39a546161ea3a49e8e282a43212d7ff68 ]
The 'aer_stats' directory never made it into the sixth and final revision of the series adding the sysfs AER attributes.
--- Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats +3 -3
@@ -100,19 +100,19 @@ collectors) that are AER capable. These indicate the number of error messages as device, so these counters include them and are thus cumulative of all the error messages on the PCI hierarchy originating at that root port. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_cor +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_cor Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected] Description: Total number of ERR_COR messages reported to rootport. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_fatal +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_fatal Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected] Description: Total number of ERR_FATAL messages reported to rootport. -What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_nonfatal +What: /sys/bus/pci/devices/<dev>/aer_rootport_total_err_nonfatal Date: July 2018 KernelVersion: 4.19.0 Contact: [email protected], [email protected]
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 379/638 perf bpf: Clean up the generated/copied vmlinux.h
In reply to Sasha LevinFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit ffd856537b95dd65facb4e0c78ca1cb92c2048ff ]
When building perf with BPF skels we either copy the minimalistic tools/perf/util/bpf_skel/vmlinux/vmlinux.h or use bpftool to generate a vmlinux from BTF, storing the result in $(SKEL_OUT)/vmlinux.h.
We need to remove that when doing a 'make -C tools/perf clean', fix it.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -1127,7 +1127,7 @@ bpf-skel: endif # BUILD_BPF_SKEL bpf-skel-clean: - $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) + $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) $(SKEL_OUT)/vmlinux.h clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 380/638 clk: meson: Add missing clocks to axg_clk_regmaps
In reply to Sasha LevinFrom: Igor Prusov <[email protected]>
[ Upstream commit ba535bce57e71463a86f8b33a0ea88c26e3a6418 ]
Some clocks were missing from axg_clk_regmaps, which caused kernel panic during cat /sys/kernel/debug/clk/clk_summary
[ 57.349402] Unable to handle kernel NULL pointer dereference at virtual address 00000000000001fc ... [ 57.430002] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 57.436900] pc : regmap_read+0x1c/0x88 [ 57.440608] lr : clk_regmap_gate_is_enabled+0x3c/0xb0 [ 57.445611] sp : ffff800082f1b690 [ 57.448888] x29: ffff800082f1b690 x28: 0000000000000000 x27: ffff800080eb9a70 [ 57.455961] x26: 0000000000000007 x25: 0000000000000016 x24: 0000000000000000 [ 57.463033] x23: ffff800080e8b488 x22: 0000000000000015 x21: ffff00000e7e7000 [ 57.470106] x20: ffff00000400ec00 x19: 0000000000000000 x18: ffffffffffffffff [ 57.477178] x17: 0000000000000000 x16: 0000000000000000 x15: ffff0000042a3000 [ 57.484251] x14: 0000000000000000 x13: ffff0000042a2fec x12: 0000000005f5e100 [ 57.491323] x11: abcc77118461cefd x10: 0000000000000020 x9 : ffff8000805e4b24 [ 57.498396] x8 : ffff0000028063c0 x7 : ffff800082f1b710 x6 : ffff800082f1b710 [ 57.505468] x5 : 00000000ffffffd0 x4 : ffff800082f1b6e0 x3 : 0000000000001000 [ 57.512541] x2 : ffff800082f1b6e4 x1 : 000000000000012c x0 : 0000000000000000 [ 57.519615] Call trace: [ 57.522030] regmap_read+0x1c/0x88 [ 57.525393] clk_regmap_gate_is_enabled+0x3c/0xb0 [ 57.530050] clk_core_is_enabled+0x44/0x120 [ 57.534190] clk_summary_show_subtree+0x154/0x2f0 [ 57.538847] clk_summary_show_subtree+0x220/0x2f0 [ 57.543505] clk_summary_show_subtree+0x220/0x2f0 [ 57.548162] clk_summary_show_subtree+0x220/0x2f0 [ 57.552820] clk_summary_show_subtree+0x220/0x2f0 [ 57.557477] clk_summary_show_subtree+0x220/0x2f0 [ 57.562135] clk_summary_show_subtree+0x220/0x2f0 [ 57.566792] clk_summary_show_subtree+0x220/0x2f0 [ 57.571450] clk_summary_show+0x84/0xb8 [ 57.575245] seq_read_iter+0x1bc/0x4b8 [ 57.578954] seq_read+0x8c/0xd0 [ 57.582059] full_proxy_read+0x68/0xc8 [ 57.585767] vfs_read+0xb0/0x268 [ 57.588959] ksys_read+0x70/0x108 [ 57.592236] __arm64_sys_read+0x24/0x38 [ 57.596031] invoke_syscall+0x50/0x128 [ 57.599740] el0_svc_common.constprop.0+0x48/0xf8 [ 57.604397] do_el0_svc+0x28/0x40 [ 57.607675] el0_svc+0x34/0xb8 [ 57.610694] el0t_64_sync_handler+0x13c/0x158 [ 57.615006] el0t_64_sync+0x190/0x198 [ 57.618635] Code: a9bd7bfd 910003fd a90153f3 aa0003f3 (b941fc00) [ 57.624668] ---[ end trace 0000000000000000 ]---
--- drivers/clk/meson/axg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/meson/axg.c +2 -0
@@ -2142,7 +2142,9 @@ static struct clk_regmap *const axg_clk_regmaps[] = { &axg_vclk_input, &axg_vclk2_input, &axg_vclk_div, + &axg_vclk_div1, &axg_vclk2_div, + &axg_vclk2_div1, &axg_vclk_div2_en, &axg_vclk_div4_en, &axg_vclk_div6_en,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 381/638 media: em28xx: annotate unchecked call to media_device_register()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit fd61d77a3d28444b2635f0c8b5a2ecd6a4d94026 ]
Static analyzers generate alerts for an unchecked call to media_device_register(). However, in this case, the device will work reliably without the media controller API.
Add a comment above the call to prevent future unnecessary changes.
--- drivers/media/usb/em28xx/em28xx-cards.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/usb/em28xx/em28xx-cards.c +4 -0
@@ -4094,6 +4094,10 @@ static int em28xx_usb_probe(struct usb_interface *intf,* topology will likely change after the load of the em28xx subdrivers. */ #ifdef CONFIG_MEDIA_CONTROLLER +/* +* No need to check the return value, the device will still be +* usable without media controller API. +*/ retval =media_device_register (dev->media_dev);#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 382/638 media: v4l2-tpg: fix some memleaks in tpg_alloc
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8cf9c5051076e0eb958f4361d50d8b0c3ee6691c ]
In tpg_alloc, resources should be deallocated in each and every error-handling paths, since they are allocated in for statements. Otherwise there would be memleaks because tpg_free is called only when tpg_alloc return 0.
--- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 52 +++++++++++++++---- 1 file changed, 42 insertions(+), 10 deletions(-)
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +42 -10
@@ -113,6 +113,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) {unsigned pat;unsigned plane; +int ret =0 ; tpg->max_line_width = max_w;for (pat =0 ; pat <TPG_MAX_PAT_LINES ; pat++) {
@@ -121,14 +122,18 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) tpg->lines[pat][plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->lines[pat][plane]) -return -ENOMEM ; +if (!tpg->lines[pat][plane]) { + ret = -ENOMEM ; + goto free_lines; + }if (plane ==0 )continue ; tpg->downsampled_lines[pat][plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->downsampled_lines[pat][plane]) -return -ENOMEM ; +if (!tpg->downsampled_lines[pat][plane]) { + ret = -ENOMEM ; + goto free_lines; + } } }for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) {
@@ -136,18 +141,45 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) tpg->contrast_line[plane] =vzalloc (array_size (pixelsz, max_w)); -if (!tpg->contrast_line[plane]) -return -ENOMEM ; +if (!tpg->contrast_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } tpg->black_line[plane] =vzalloc (array_size (pixelsz, max_w)); -if (!tpg->black_line[plane]) -return -ENOMEM ; +if (!tpg->black_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } tpg->random_line[plane] =vzalloc (array3_size (max_w,2 , pixelsz)); -if (!tpg->random_line[plane]) -return -ENOMEM ; +if (!tpg->random_line[plane]) { + ret = -ENOMEM ; + goto free_contrast_line; + } }return 0 ; + +free_contrast_line: +for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) { +vfree (tpg->contrast_line[plane]); +vfree (tpg->black_line[plane]); +vfree (tpg->random_line[plane]); + tpg->contrast_line[plane] =NULL ; + tpg->black_line[plane] =NULL ; + tpg->random_line[plane] =NULL ; + } +free_lines: +for (pat =0 ; pat <TPG_MAX_PAT_LINES ; pat++) +for (plane =0 ; plane <TPG_MAX_PLANES ; plane++) { +vfree (tpg->lines[pat][plane]); + tpg->lines[pat][plane] =NULL ; +if (plane ==0 ) +continue ; +vfree (tpg->downsampled_lines[pat][plane]); + tpg->downsampled_lines[pat][plane] =NULL ; + } +return ret; }EXPORT_SYMBOL_GPL (tpg_alloc);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 383/638 media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8f94b49a5b5d386c038e355bef6347298aabd211 ]
The entity->name (i.e. name) is allocated in v4l2_m2m_register_entity but isn't freed in its following error-handling paths. This patch adds such deallocation to prevent memleak of entity->name.
--- drivers/media/v4l2-core/v4l2-mem2mem.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-mem2mem.c +8 -2
@@ -1084,11 +1084,17 @@ static int v4l2_m2m_register_entity(struct media_device *mdev, entity->function = function; ret =media_entity_pads_init (entity, num_pads, pads); -if (ret) +if (ret) { +kfree (entity->name); + entity->name =NULL ;return ret; + } ret =media_device_register_entity (mdev, entity); -if (ret) +if (ret) { +kfree (entity->name); + entity->name =NULL ;return ret; + }return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 384/638 mtd: spinand: esmt: Extend IDs to 5 bytes
In reply to Sasha LevinFrom: Ezra Buehler <[email protected]>
[ Upstream commit 4bd14b2fd8a83a2f5220ba4ef323f741e11bfdfd ]
According to the datasheets, the ESMT chips in question will return a 5 byte long identification code where the last 3 bytes are the JEDEC continuation codes (7Fh). Although, I would have expected 4 continuation codes as Powerchip Semiconductor (C8h, corresponding to the parameter page data) is located in bank 5 of the JEDEC database.
By matching the full 5 bytes we can avoid clashes with GigaDevice NAND flashes.
This fix allows the MT7688-based GARDENA smart Gateway to boot again.
--- drivers/mtd/nand/spi/esmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mtd/nand/spi/esmt.c +6 -3
@@ -104,7 +104,8 @@ static const struct mtd_ooblayout_ops f50l1g41lb_ooblayout = {static const struct spinand_info esmt_c8_spinand_table[] = { SPINAND_INFO("F50L1G41LB", - SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01), + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01, 0x7f, + 0x7f, 0x7f), NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), NAND_ECCREQ(1, 512), SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -113,7 +114,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = { 0, SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)), SPINAND_INFO("F50D1G41LB", - SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11), + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11, 0x7f, + 0x7f, 0x7f), NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), NAND_ECCREQ(1, 512), SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -122,7 +124,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = { 0, SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)), SPINAND_INFO("F50D2G41KA", - SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51), + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51, 0x7f, + 0x7f, 0x7f), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), NAND_ECCREQ(8, 512), SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 385/638 media: edia: dvbdev: fix a use-after-free
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 8c64f4cdf4e6cc5682c52523713af8c39c94e6d5 ]
In dvb_register_device, *pdvbdev is set equal to dvbdev, which is freed in several error-handling paths. However, *pdvbdev is not set to NULL after dvbdev's deallocation, causing use-after-frees in many places, for example, in the following call chain:
budget_register
|-> dvb_dmxdev_init
|-> dvb_register_device
|-> dvb_dmxdev_release
|-> dvb_unregister_device
|-> dvb_remove_device
|-> dvb_device_put
|-> kref_putWhen calling dvb_unregister_device, dmxdev->dvbdev (i.e. *pdvbdev in dvb_register_device) could point to memory that had been freed in dvb_register_device. Thereafter, this pointer is transferred to kref_put and triggering a use-after-free.
--- drivers/media/dvb-core/dvbdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/dvb-core/dvbdev.c +5 -0
@@ -490,6 +490,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dvbdevfops =kmemdup (template->fops,sizeof (*dvbdevfops),GFP_KERNEL );if (!dvbdevfops) {kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return -ENOMEM ; }
@@ -498,6 +499,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,if (!new_node) {kfree (dvbdevfops);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return -ENOMEM ; }
@@ -531,6 +533,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, }list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;up_write (&minor_rwsem);mutex_unlock (&dvbdev_register_lock);return -EINVAL ;
@@ -553,6 +556,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return ret; }
@@ -571,6 +575,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,dvb_media_device_free (dvbdev);list_del (&dvbdev->list_head);kfree (dvbdev); + *pdvbdev =NULL ;mutex_unlock (&dvbdev_register_lock);return PTR_ERR (clsdev); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 386/638 pinctrl: mediatek: Drop bogus slew rate register range for MT8186
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 3a29c87548809405bcbc66acc69cbe6f15184d94 ]
The MT8186 does not support configuring pin slew rate. This is evident from both the datasheet, and the fact that the driver points the slew rate register range at the GPIO direction register range.
Drop the bogus setting.
--- drivers/pinctrl/mediatek/pinctrl-mt8186.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-mt8186.c +0 -1
@@ -1198,7 +1198,6 @@ static const struct mtk_pin_reg_calc mt8186_reg_cals[PINCTRL_PIN_REG_MAX] = { [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8186_pin_dir_range), [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8186_pin_di_range), [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8186_pin_do_range), - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8186_pin_dir_range), [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8186_pin_smt_range), [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8186_pin_ies_range), [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8186_pin_pu_range),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 387/638 pinctrl: mediatek: Drop bogus slew rate register range for MT8192
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit e15ab05a6b3ed42f2f43f8bd1a1abdbde64afecd ]
The MT8192 does not support configuring pin slew rate. This is evident from both the datasheet, and the fact that the driver points the slew rate register range at the GPIO direction register range.
Drop the bogus setting.
--- drivers/pinctrl/mediatek/pinctrl-mt8192.c | 1 - 1 file changed, 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-mt8192.c +0 -1
@@ -1379,7 +1379,6 @@ static const struct mtk_pin_reg_calc mt8192_reg_cals[PINCTRL_PIN_REG_MAX] = { [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8192_pin_dir_range), [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8192_pin_di_range), [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8192_pin_do_range), - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8192_pin_dir_range), [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8192_pin_smt_range), [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8192_pin_ies_range), [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8192_pin_pu_range),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 388/638 drm/amdgpu: Fix potential out-of-bounds access in 'amdgpu_discovery_reg_base_init()'
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit cdb637d339572398821204a1142d8d615668f1e9 ]
The issue arises when the array 'adev->vcn.vcn_config' is accessed before checking if the index 'adev->vcn.num_vcn_inst' is within the bounds of the array.
The fix involves moving the bounds check before the array access. This ensures that 'adev->vcn.num_vcn_inst' is within the bounds of the array before it is used as an index.
Fixes the below:drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1289 amdgpu_discovery_reg_base_init() error: testing array offset 'adev->vcn.num_vcn_inst' after use.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +3 -3
@@ -1270,11 +1270,10 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)* 0b10 : encode is disabled * 0b01 : decode is disabled */ - adev->vcn.vcn_config[adev->vcn.num_vcn_inst] = - ip->revision &0xc0 ; - ip->revision &= ~0xc0 ;if (adev->vcn.num_vcn_inst <AMDGPU_MAX_VCN_INSTANCES ) { + adev->vcn.vcn_config[adev->vcn.num_vcn_inst] = + ip->revision &0xc0 ; adev->vcn.num_vcn_inst++; adev->vcn.inst_mask |= (1U << ip->instance_number);
@@ -1285,6 +1284,7 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) adev->vcn.num_vcn_inst +1 , AMDGPU_MAX_VCN_INSTANCES); } + ip->revision &= ~0xc0 ; } if (le16_to_cpu(ip->hw_id) == SDMA0_HWID || le16_to_cpu(ip->hw_id) == SDMA1_HWID ||
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 389/638 clk: qcom: reset: Commonize the de/assert functions
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit eda40d9c583e95e0b6ac69d2950eec10f802e0e8 ]
They do the same thing, except the last argument of the last function call differs. Commonize them.
Stable-dep-of: 2f8cf2c3f3e3 ("clk: qcom: reset: Ensure write completion on reset de/assertion")
--- drivers/clk/qcom/reset.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/clk/qcom/reset.c +9 -13
@@ -22,8 +22,8 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)return 0 ; } -static int -qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id) +static int qcom_reset_set_assert (struct reset_controller_dev *rcdev, +unsigned long id,bool assert) {struct qcom_reset_controller *rst;const struct qcom_reset_map *map;
@@ -33,21 +33,17 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) map = &rst->reset_map[id]; mask = map->bitmask ? map->bitmask :BIT (map->bit); -return regmap_update_bits (rst->regmap, map->reg, mask, mask); +return regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); } -static int -qcom_reset_deassert (struct reset_controller_dev *rcdev,unsigned long id) +static int qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id) { -struct qcom_reset_controller *rst; -const struct qcom_reset_map *map; -u32 mask; - - rst =to_qcom_reset_controller (rcdev); - map = &rst->reset_map[id]; - mask = map->bitmask ? map->bitmask :BIT (map->bit); +return qcom_reset_set_assert (rcdev, id, true); +} -return regmap_update_bits (rst->regmap, map->reg, mask,0 ); +static int qcom_reset_deassert (struct reset_controller_dev *rcdev,unsigned long id) +{ +return qcom_reset_set_assert (rcdev, id, false); }const struct reset_control_ops qcom_reset_ops = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 390/638 clk: qcom: reset: Ensure write completion on reset de/assertion
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 2f8cf2c3f3e3f7ef61bd19abb4b0bb797ad50aaf ]
Trying to toggle the resets in a rapid fashion can lead to the changes not actually arriving at the clock controller block when we expect them to. This was observed at least on SM8250.
Read back the value after regmap_update_bits to ensure write completion.
--- drivers/clk/qcom/reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/qcom/reset.c +6 -1
@@ -33,7 +33,12 @@ static int qcom_reset_set_assert(struct reset_controller_dev *rcdev, map = &rst->reset_map[id]; mask = map->bitmask ? map->bitmask :BIT (map->bit); -return regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); +regmap_update_bits (rst->regmap, map->reg, mask, assert ? mask :0 ); + +/* Read back the register to ensure write completion, ignore the value */ +regmap_read (rst->regmap, map->reg, &mask); + +return 0 ; }static int qcom_reset_assert (struct reset_controller_dev *rcdev,unsigned long id)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 391/638 quota: Fix potential NULL pointer dereference
In reply to Sasha LevinFrom: Wang Jianjian <[email protected]>
[ Upstream commit d0aa72604fbd80c8aabb46eda00535ed35570f1f ]
Below race may cause NULL pointer dereference
P1 P2dquot_free_inode quota_off
drop_dquot_ref
remove_dquot_ref dquots = i_dquot(inode)
dquots = i_dquot(inode)
srcu_read_lock
dquots[cnt]) != NULL (1)
dquots[type] = NULL (2)
spin_lock(&dquots[cnt]->dq_dqb_lock) (3)
....
If dquot_free_inode(or other routines) checks inode's quota pointers (1) before quota_off sets it to NULL(2) and use it (3) after that, NULL pointer dereference will be triggered.
So let's fix it by using a temporary pointer to avoid this issue.
Message-Id: <[email protected]>
Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot pointers")
--- fs/quota/dquot.c | 98 ++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 41 deletions(-)
fs/quota/dquot.c +57 -41
@@ -399,15 +399,17 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)EXPORT_SYMBOL (dquot_mark_dquot_dirty);/* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty (struct dquot *const *dquot) +static inline int mark_all_dquot_dirty (struct dquot *const *dquots) {int ret, err, cnt; +struct dquot *dquot; ret = err =0 ;for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquot[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot)/* Even in case of error we have to continue */ - ret =mark_dquot_dirty (dquot[cnt]); + ret =mark_dquot_dirty (dquot);if (!err) err = ret; }
@@ -1684,6 +1686,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)struct dquot_warn warn[MAXQUOTAS ];int reserve = flags &DQUOT_SPACE_RESERVE ;struct dquot **dquots; +struct dquot *dquot;if (!inode_quota_active (inode)) {if (reserve) {
@@ -1703,27 +1706,26 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) index =srcu_read_lock (&dquot_srcu);spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ;if (reserve) { - ret =dquot_add_space (dquots[cnt],0 , number, flags, - &warn[cnt]); + ret =dquot_add_space (dquot,0 , number, flags, &warn[cnt]); }else { - ret =dquot_add_space (dquots[cnt], number,0 , flags, - &warn[cnt]); + ret =dquot_add_space (dquot, number,0 , flags, &warn[cnt]); }if (ret) {/* Back out changes we already did */ for (cnt--; cnt >=0 ; cnt--) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock);if (reserve) -dquot_free_reserved_space (dquots[cnt], - number); +dquot_free_reserved_space (dquot, number);else -dquot_decr_space (dquots[cnt], number); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +dquot_decr_space (dquot, number); +spin_unlock (&dquot->dq_dqb_lock); }spin_unlock (&inode->i_lock); goto out_flush_warn;
@@ -1754,6 +1756,7 @@ int dquot_alloc_inode(struct inode *inode)int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ];struct dquot *const *dquots; +struct dquot *dquot;if (!inode_quota_active (inode))return 0 ;
@@ -1764,17 +1767,19 @@ int dquot_alloc_inode(struct inode *inode) index =srcu_read_lock (&dquot_srcu);spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; - ret =dquot_add_inodes (dquots[cnt],1 , &warn[cnt]); + ret =dquot_add_inodes (dquot,1 , &warn[cnt]);if (ret) {for (cnt--; cnt >=0 ; cnt--) { -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ;/* Back out changes we already did */ -spin_lock (&dquots[cnt]->dq_dqb_lock); -dquot_decr_inodes (dquots[cnt],1 ); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock); +dquot_decr_inodes (dquot,1 ); +spin_unlock (&dquot->dq_dqb_lock); } goto warn_put_all; }
@@ -1796,6 +1801,7 @@ EXPORT_SYMBOL(dquot_alloc_inode);int dquot_claim_space_nodirty (struct inode *inode,qsize_t number) {struct dquot **dquots; +struct dquot *dquot;int cnt, index;if (!inode_quota_active (inode)) {
@@ -1811,9 +1817,8 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)spin_lock (&inode->i_lock);/* Claim reserved quotas to allocated quotas */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquots[cnt]) { -struct dquot *dquot = dquots[cnt]; - + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot) {spin_lock (&dquot->dq_dqb_lock);if (WARN_ON_ONCE (dquot->dq_dqb.dqb_rsvspace < number)) number = dquot->dq_dqb.dqb_rsvspace;
@@ -1838,6 +1843,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty);void dquot_reclaim_space_nodirty (struct inode *inode,qsize_t number) {struct dquot **dquots; +struct dquot *dquot;int cnt, index;if (!inode_quota_active (inode)) {
@@ -1853,9 +1859,8 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)spin_lock (&inode->i_lock);/* Claim reserved quotas to allocated quotas */ for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { -if (dquots[cnt]) { -struct dquot *dquot = dquots[cnt]; - + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (dquot) {spin_lock (&dquot->dq_dqb_lock);if (WARN_ON_ONCE (dquot->dq_dqb.dqb_curspace < number)) number = dquot->dq_dqb.dqb_curspace;
@@ -1882,6 +1887,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ];struct dquot **dquots; +struct dquot *dquot;int reserve = flags &DQUOT_SPACE_RESERVE , index;if (!inode_quota_active (inode)) {
@@ -1902,17 +1908,18 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)int wtype; warn[cnt].w_type =QUOTA_NL_NOWARN ; -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); - wtype =info_bdq_free (dquots[cnt], number); +spin_lock (&dquot->dq_dqb_lock); + wtype =info_bdq_free (dquot, number);if (wtype !=QUOTA_NL_NOWARN ) -prepare_warning (&warn[cnt], dquots[cnt], wtype); +prepare_warning (&warn[cnt], dquot, wtype);if (reserve) -dquot_free_reserved_space (dquots[cnt], number); +dquot_free_reserved_space (dquot, number);else -dquot_decr_space (dquots[cnt], number); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +dquot_decr_space (dquot, number); +spin_unlock (&dquot->dq_dqb_lock); }if (reserve) *inode_reserved_space (inode) -= number;
@@ -1937,6 +1944,7 @@ void dquot_free_inode(struct inode *inode)unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ];struct dquot *const *dquots; +struct dquot *dquot;int index;if (!inode_quota_active (inode))
@@ -1947,16 +1955,16 @@ void dquot_free_inode(struct inode *inode)spin_lock (&inode->i_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) {int wtype; - warn[cnt].w_type =QUOTA_NL_NOWARN ; -if (!dquots[cnt]) + dquot =srcu_dereference (dquots[cnt], &dquot_srcu); +if (!dquot)continue ; -spin_lock (&dquots[cnt]->dq_dqb_lock); - wtype =info_idq_free (dquots[cnt],1 ); +spin_lock (&dquot->dq_dqb_lock); + wtype =info_idq_free (dquot,1 );if (wtype !=QUOTA_NL_NOWARN ) -prepare_warning (&warn[cnt], dquots[cnt], wtype); -dquot_decr_inodes (dquots[cnt],1 ); -spin_unlock (&dquots[cnt]->dq_dqb_lock); +prepare_warning (&warn[cnt], dquot, wtype); +dquot_decr_inodes (dquot,1 ); +spin_unlock (&dquot->dq_dqb_lock); }spin_unlock (&inode->i_lock);mark_all_dquot_dirty (dquots);
@@ -1983,7 +1991,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)qsize_t rsv_space =0 ;qsize_t inode_usage =1 ;struct dquot *transfer_from[MAXQUOTAS ] = {}; -int cnt, ret =0 ; +int cnt, index, ret =0 ;char is_valid[MAXQUOTAS ] = {};struct dquot_warn warn_to[MAXQUOTAS ];struct dquot_warn warn_from_inodes[MAXQUOTAS ];
@@ -2072,8 +2080,16 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)spin_unlock (&inode->i_lock);spin_unlock (&dq_data_lock); +/* +* These arrays are local and we hold dquot references so we don't need +* the srcu protection but still take dquot_srcu to avoid warning in +* mark_all_dquot_dirty(). +*/ + index =srcu_read_lock (&dquot_srcu);mark_all_dquot_dirty (transfer_from);mark_all_dquot_dirty (transfer_to); +srcu_read_unlock (&dquot_srcu, index); +flush_warnings (warn_to);flush_warnings (warn_from_inodes);flush_warnings (warn_from_space);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 392/638 quota: Fix rcu annotations of inode dquot pointers
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 179b8c97ebf63429589f5afeba59a181fe70603e ]
Dquot pointers in i_dquot array in the inode are protected by dquot_srcu. Annotate the array pointers with __rcu, perform the locked dereferences with srcu_dereference_check() instead of plain reads, and set the array elements with rcu_assign_pointer().
--- fs/quota/dquot.c | 66 ++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 27 deletions(-)
fs/quota/dquot.c +39 -27
@@ -399,7 +399,7 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)EXPORT_SYMBOL (dquot_mark_dquot_dirty);/* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty (struct dquot *const *dquots) +static inline int mark_all_dquot_dirty (struct dquot __rcu *const *dquots) {int ret, err, cnt;struct dquot *dquot;
@@ -1006,14 +1006,15 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid) }EXPORT_SYMBOL (dqget); -static inline struct dquot **i_dquot (struct inode *inode) +static inline struct dquot __rcu **i_dquot (struct inode *inode) { -return inode->i_sb->s_op->get_dquots (inode); +/* Force __rcu for now until filesystems are fixed */ +return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots (inode); }static int dqinit_needed (struct inode *inode,int type) { -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;int cnt;if (IS_NOQUOTA (inode))
@@ -1103,14 +1104,16 @@ static void remove_dquot_ref(struct super_block *sb, int type)*/ spin_lock (&dq_data_lock);if (!IS_NOQUOTA (inode)) { -struct dquot **dquots =i_dquot (inode); -struct dquot *dquot = dquots[type]; +struct dquot __rcu **dquots =i_dquot (inode); +struct dquot *dquot =srcu_dereference_check ( + dquots[type], &dquot_srcu, +lockdep_is_held (&dq_data_lock));#ifdef CONFIG_QUOTA_DEBUG if (unlikely (inode_get_rsv_space (inode) >0 )) reserved =1 ;#endif - dquots[type] =NULL ; +rcu_assign_pointer (dquots[type],NULL );if (dquot)dqput (dquot); }
@@ -1463,7 +1466,8 @@ static int inode_quota_active(const struct inode *inode)static int __dquot_initialize (struct inode *inode,int type) {int cnt, init_needed =0 ; -struct dquot **dquots, *got[MAXQUOTAS ] = {}; +struct dquot __rcu **dquots; +struct dquot *got[MAXQUOTAS ] = {};struct super_block *sb = inode->i_sb;qsize_t rsv;int ret =0 ;
@@ -1538,7 +1542,7 @@ static int __dquot_initialize(struct inode *inode, int type)if (!got[cnt])continue ;if (!dquots[cnt]) { - dquots[cnt] = got[cnt]; +rcu_assign_pointer (dquots[cnt], got[cnt]); got[cnt] =NULL ;/* * Make quota reservation system happy if someone
@@ -1546,12 +1550,16 @@ static int __dquot_initialize(struct inode *inode, int type)*/ rsv =inode_get_rsv_space (inode);if (unlikely (rsv)) { +struct dquot *dquot =srcu_dereference_check ( + dquots[cnt], &dquot_srcu, +lockdep_is_held (&dq_data_lock)); +spin_lock (&inode->i_lock);/* Get reservation again under proper lock */ rsv =__inode_get_rsv_space (inode); -spin_lock (&dquots[cnt]->dq_dqb_lock); - dquots[cnt]->dq_dqb.dqb_rsvspace += rsv; -spin_unlock (&dquots[cnt]->dq_dqb_lock); +spin_lock (&dquot->dq_dqb_lock); + dquot->dq_dqb.dqb_rsvspace += rsv; +spin_unlock (&dquot->dq_dqb_lock);spin_unlock (&inode->i_lock); } }
@@ -1573,7 +1581,7 @@ EXPORT_SYMBOL(dquot_initialize);bool dquot_initialize_needed (struct inode *inode) { -struct dquot **dquots; +struct dquot __rcu **dquots;int i;if (!inode_quota_active (inode))
@@ -1598,13 +1606,14 @@ EXPORT_SYMBOL(dquot_initialize_needed);static void __dquot_drop (struct inode *inode) {int cnt; -struct dquot **dquots =i_dquot (inode); +struct dquot __rcu **dquots =i_dquot (inode);struct dquot *put[MAXQUOTAS ];spin_lock (&dq_data_lock);for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { - put[cnt] = dquots[cnt]; - dquots[cnt] =NULL ; + put[cnt] =srcu_dereference_check (dquots[cnt], &dquot_srcu, +lockdep_is_held (&dq_data_lock)); +rcu_assign_pointer (dquots[cnt],NULL ); }spin_unlock (&dq_data_lock);dqput_all (put);
@@ -1612,7 +1621,7 @@ static void __dquot_drop(struct inode *inode)void dquot_drop (struct inode *inode) { -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;int cnt;if (IS_NOQUOTA (inode))
@@ -1685,7 +1694,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ];int reserve = flags &DQUOT_SPACE_RESERVE ; -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;if (!inode_quota_active (inode)) {
@@ -1755,7 +1764,7 @@ int dquot_alloc_inode(struct inode *inode) {int cnt, ret =0 , index;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;struct dquot *dquot;if (!inode_quota_active (inode))
@@ -1800,7 +1809,7 @@ EXPORT_SYMBOL(dquot_alloc_inode);*/ int dquot_claim_space_nodirty (struct inode *inode,qsize_t number) { -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int cnt, index;
@@ -1842,7 +1851,7 @@ EXPORT_SYMBOL(dquot_claim_space_nodirty);*/ void dquot_reclaim_space_nodirty (struct inode *inode,qsize_t number) { -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int cnt, index;
@@ -1886,7 +1895,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) {unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot **dquots; +struct dquot __rcu **dquots;struct dquot *dquot;int reserve = flags &DQUOT_SPACE_RESERVE , index;
@@ -1943,7 +1952,7 @@ void dquot_free_inode(struct inode *inode) {unsigned int cnt;struct dquot_warn warn[MAXQUOTAS ]; -struct dquot *const *dquots; +struct dquot __rcu *const *dquots;struct dquot *dquot;int index;
@@ -1990,6 +1999,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)qsize_t cur_space;qsize_t rsv_space =0 ;qsize_t inode_usage =1 ; +struct dquot __rcu **dquots;struct dquot *transfer_from[MAXQUOTAS ] = {};int cnt, index, ret =0 ;char is_valid[MAXQUOTAS ] = {};
@@ -2022,6 +2032,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) } cur_space =__inode_get_bytes (inode); rsv_space =__inode_get_rsv_space (inode); + dquots =i_dquot (inode);/* * Build the transfer_from list, check limits, and update usage in * the target structures.
@@ -2036,7 +2047,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)if (!sb_has_quota_active (inode->i_sb, cnt))continue ; is_valid[cnt] =1 ; - transfer_from[cnt] =i_dquot (inode)[cnt]; + transfer_from[cnt] =srcu_dereference_check (dquots[cnt], + &dquot_srcu,lockdep_is_held (&dq_data_lock)); ret =dquot_add_inodes (transfer_to[cnt], inode_usage, &warn_to[cnt]);if (ret)
@@ -2075,7 +2087,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) rsv_space);spin_unlock (&transfer_from[cnt]->dq_dqb_lock); } -i_dquot (inode)[cnt] = transfer_to[cnt]; +rcu_assign_pointer (dquots[cnt], transfer_to[cnt]); }spin_unlock (&inode->i_lock);spin_unlock (&dq_data_lock);
@@ -2086,8 +2098,8 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to)* mark_all_dquot_dirty(). */ index =srcu_read_lock (&dquot_srcu); -mark_all_dquot_dirty (transfer_from); -mark_all_dquot_dirty (transfer_to); +mark_all_dquot_dirty ((struct dquot __rcu **)transfer_from); +mark_all_dquot_dirty ((struct dquot __rcu **)transfer_to);srcu_read_unlock (&dquot_srcu, index);flush_warnings (warn_to);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 393/638 quota: Properly annotate i_dquot arrays with __rcu
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit ccb49011bb2ebfd66164dbf68c5bff48917bb5ef ]
Dquots pointed to from i_dquot arrays in inodes are protected by dquot_srcu. Annotate them as such and change .get_dquots callback to return properly annotated pointer to make sparse happy.
--- fs/ext2/ext2.h | 2 +- fs/ext2/super.c | 2 +- fs/ext4/ext4.h | 2 +- fs/ext4/super.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/super.c | 2 +- fs/jfs/jfs_incore.h | 2 +- fs/jfs/super.c | 2 +- fs/ocfs2/inode.h | 2 +- fs/ocfs2/super.c | 2 +- fs/quota/dquot.c | 3 +-- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/super.c | 2 +- include/linux/fs.h | 2 +- include/linux/shmem_fs.h | 2 +- mm/shmem.c | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-)
fs/ext2/ext2.h +1 -1
@@ -674,7 +674,7 @@ struct ext2_inode_info {struct inode vfs_inode;struct list_head i_orphan;/* unlinked but open inodes */ #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif };
fs/ext2/super.c +1 -1
@@ -320,7 +320,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, sizstatic ssize_t ext2_quota_write (struct super_block *sb,int type,const char *data,size_t len,loff_t off);static int ext2_quota_on (struct super_block *sb,int type,int format_id,const struct path *path); -static struct dquot **ext2_get_dquots (struct inode *inode) +static struct dquot __rcu **ext2_get_dquots (struct inode *inode) {return EXT2_I (inode)->i_dquot; }
fs/ext4/ext4.h +1 -1
@@ -1146,7 +1146,7 @@ struct ext4_inode_info {tid_t i_datasync_tid;#ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif /* Precomputed uuid+inum+igen checksum for seeding inode checksums */
fs/ext4/super.c +1 -1
@@ -1593,7 +1593,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,static int ext4_quota_enable (struct super_block *sb,int type,int format_id,unsigned int flags); -static struct dquot **ext4_get_dquots (struct inode *inode) +static struct dquot __rcu **ext4_get_dquots (struct inode *inode) {return EXT4_I (inode)->i_dquot; }
fs/f2fs/f2fs.h +1 -1
@@ -824,7 +824,7 @@ struct f2fs_inode_info {spinlock_t i_size_lock;/* protect last_disk_size */ #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];/* quota space reservation, managed internally by quota code */ qsize_t i_reserved_quota;
fs/f2fs/super.c +1 -1
@@ -2756,7 +2756,7 @@ int f2fs_dquot_initialize(struct inode *inode)return dquot_initialize (inode); } -static struct dquot **f2fs_get_dquots (struct inode *inode) +static struct dquot __rcu **f2fs_get_dquots (struct inode *inode) {return F2FS_I (inode)->i_dquot; }
fs/jfs/jfs_incore.h +1 -1
@@ -92,7 +92,7 @@ struct jfs_inode_info { } link; } u;#ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif u32 dev;/* will die when we get wide dev_t */ struct inode vfs_inode;
fs/jfs/super.c +1 -1
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,return len - towrite; } -static struct dquot **jfs_get_dquots (struct inode *inode) +static struct dquot __rcu **jfs_get_dquots (struct inode *inode) {return JFS_IP (inode)->i_dquot; }
fs/ocfs2/inode.h +1 -1
@@ -65,7 +65,7 @@ struct ocfs2_inode_infotid_t i_sync_tid;tid_t i_datasync_tid; -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ]; };/*
fs/ocfs2/super.c +1 -1
@@ -122,7 +122,7 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);static int ocfs2_enable_quotas (struct ocfs2_super *osb);static void ocfs2_disable_quotas (struct ocfs2_super *osb); -static struct dquot **ocfs2_get_dquots (struct inode *inode) +static struct dquot __rcu **ocfs2_get_dquots (struct inode *inode) {return OCFS2_I (inode)->i_dquot; }
fs/quota/dquot.c +1 -2
@@ -1008,8 +1008,7 @@ EXPORT_SYMBOL(dqget);static inline struct dquot __rcu **i_dquot (struct inode *inode) { -/* Force __rcu for now until filesystems are fixed */ -return (struct dquot __rcu **)inode->i_sb->s_op->get_dquots (inode); +return inode->i_sb->s_op->get_dquots (inode); }static int dqinit_needed (struct inode *inode,int type)
fs/reiserfs/reiserfs.h +1 -1
@@ -97,7 +97,7 @@ struct reiserfs_inode_info {struct rw_semaphore i_xattr_sem;#endif #ifdef CONFIG_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif struct inode vfs_inode;
fs/reiserfs/super.c +1 -1
@@ -802,7 +802,7 @@ static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,static ssize_t reiserfs_quota_read (struct super_block *,int ,char *,size_t ,loff_t ); -static struct dquot **reiserfs_get_dquots (struct inode *inode) +static struct dquot __rcu **reiserfs_get_dquots (struct inode *inode) {return REISERFS_I (inode)->i_dquot; }
include/linux/fs.h +1 -1
@@ -2079,7 +2079,7 @@ struct super_operations {#ifdef CONFIG_QUOTA ssize_t (*quota_read)(struct super_block *,int ,char *,size_t ,loff_t );ssize_t (*quota_write)(struct super_block *,int ,const char *,size_t ,loff_t ); -struct dquot **(*get_dquots)(struct inode *); +struct dquot __rcu **(*get_dquots)(struct inode *);#endif long (*nr_cached_objects)(struct super_block *,struct shrink_control *);
include/linux/shmem_fs.h +1 -1
@@ -32,7 +32,7 @@ struct shmem_inode_info {struct timespec64 i_crtime;/* file creation time */ unsigned int fsflags;/* flags for FS_IOC_[SG]ETFLAGS */ #ifdef CONFIG_TMPFS_QUOTA -struct dquot *i_dquot[MAXQUOTAS ]; +struct dquot __rcu *i_dquot[MAXQUOTAS ];#endif struct offset_ctx dir_offsets;/* stable entry offsets */ struct inode vfs_inode;
mm/shmem.c +1 -1
@@ -311,7 +311,7 @@ static void shmem_disable_quotas(struct super_block *sb)dquot_quota_off (sb, type); } -static struct dquot **shmem_get_dquots (struct inode *inode) +static struct dquot __rcu **shmem_get_dquots (struct inode *inode) {return SHMEM_I (inode)->i_dquot; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 394/638 PCI/P2PDMA: Fix a sleeping issue in a RCU read section
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 1e5c66afd4a40bb7be17cb33cbb1a1085f727730 ]
It is not allowed to sleep within a RCU read section, so use GFP_ATOMIC instead of GFP_KERNEL here.
--- drivers/pci/p2pdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/p2pdma.c +1 -1
@@ -661,7 +661,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client, p2pdma =rcu_dereference (provider->p2pdma);if (p2pdma)xa_store (&p2pdma->map_types,map_types_idx (client), -xa_mk_value (map_type),GFP_KERNEL ); +xa_mk_value (map_type),GFP_ATOMIC );rcu_read_unlock ();return map_type; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 395/638 PCI: switchtec: Fix an error handling path in switchtec_pci_probe()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit dec529b0b0572b32f9eb91c882dd1f08ca657efb ]
The commit in Fixes changed the logic on how resources are released and introduced a new switchtec_exit_pci() that need to be called explicitly in order to undo a corresponding switchtec_init_pci().
This was done in the remove function, but not in the probe.
Fix the probe now.
--- drivers/pci/switch/switchtec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/switch/switchtec.c +3 -1
@@ -1672,7 +1672,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, rc =switchtec_init_isr (stdev);if (rc) {dev_err (&stdev->dev,"failed to init isr.\n" ); - goto err_put; + goto err_exit_pci; } iowrite32(SWITCHTEC_EVENT_CLEAR |
@@ -1693,6 +1693,8 @@ static int switchtec_pci_probe(struct pci_dev *pdev, err_devadd:stdev_kill (stdev); +err_exit_pci: +switchtec_exit_pci (stdev); err_put:ida_free (&switchtec_minor_ida,MINOR (stdev->dev.devt));put_device (&stdev->dev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 396/638 crypto: xilinx - call finalize with bh disabled
In reply to Sasha LevinFrom: Quanyang Wang <[email protected]>
[ Upstream commit a853450bf4c752e664abab0b2fad395b7ad7701c ]
When calling crypto_finalize_request, BH should be disabled to avoid triggering the following calltrace:
------------[ cut here ]------------
WARNING: CPU: 2 PID: 74 at crypto/crypto_engine.c:58 crypto_finalize_request+0xa0/0x118
Modules linked in: cryptodev(O)
CPU: 2 PID: 74 Comm: firmware:zynqmp Tainted: G O 6.8.0-rc1-yocto-standard #323
Hardware name: ZynqMP ZCU102 Rev1.0 (DT)
pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : crypto_finalize_request+0xa0/0x118
lr : crypto_finalize_request+0x104/0x118
sp : ffffffc085353ce0
x29: ffffffc085353ce0 x28: 0000000000000000 x27: ffffff8808ea8688
x26: ffffffc081715038 x25: 0000000000000000 x24: ffffff880100db00
x23: ffffff880100da80 x22: 0000000000000000 x21: 0000000000000000
x20: ffffff8805b14000 x19: ffffff880100da80 x18: 0000000000010450
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000003 x13: 0000000000000000 x12: ffffff880100dad0
x11: 0000000000000000 x10: ffffffc0832dcd08 x9 : ffffffc0812416d8
x8 : 00000000000001f4 x7 : ffffffc0830d2830 x6 : 0000000000000001
x5 : ffffffc082091000 x4 : ffffffc082091658 x3 : 0000000000000000
x2 : ffffffc7f9653000 x1 : 0000000000000000 x0 : ffffff8802d20000
Call trace:
crypto_finalize_request+0xa0/0x118
crypto_finalize_aead_request+0x18/0x30
zynqmp_handle_aes_req+0xcc/0x388
crypto_pump_work+0x168/0x2d8
kthread_worker_fn+0xfc/0x3a0
kthread+0x118/0x138
ret_from_fork+0x10/0x20
irq event stamp: 40
hardirqs last enabled at (39): [<ffffffc0812416f8>] _raw_spin_unlock_irqrestore+0x70/0xb0
hardirqs last disabled at (40): [<ffffffc08122d208>] el1_dbg+0x28/0x90
softirqs last enabled at (36): [<ffffffc080017dec>] kernel_neon_begin+0x8c/0xf0
softirqs last disabled at (34): [<ffffffc080017dc0>] kernel_neon_begin+0x60/0xf0
---[ end trace 0000000000000000 ]------ drivers/crypto/xilinx/zynqmp-aes-gcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/xilinx/zynqmp-aes-gcm.c +3 -0
@@ -231,7 +231,10 @@ static int zynqmp_handle_aes_req(struct crypto_engine *engine, err =zynqmp_aes_aead_cipher (areq); } +local_bh_disable ();crypto_finalize_aead_request (engine, areq, err); +local_bh_enable (); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 397/638 drivers/ps3: select VIDEO to provide cmdline functions
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 7edd06233958d9086a9e3eb723a8768d3c5a9ce1 ]
When VIDEO is not set, there is a build error. Fix that by selecting VIDEO for PS3_PS3AV.
ERROR: modpost: ".video_get_options" [drivers/ps3/ps3av_mod.ko] undefined!
--- arch/powerpc/platforms/ps3/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/ps3/Kconfig +1 -0
@@ -67,6 +67,7 @@ config PS3_VUART config PS3_PS3AV depends on PPC_PS3 tristate "PS3 AV settings driver" if PS3_ADVANCED + select VIDEO select PS3_VUART default y help
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 398/638 perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
In reply to Sasha LevinFrom: Yang Jihong <[email protected]>
[ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ]
slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str().
--- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str) threads->nr = ntasks; } out: +strlist__delete (slist);if (threads)refcount_set (&threads->refcnt,1 );return threads; out_free_threads:zfree (&threads); -strlist__delete (slist); goto out; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 399/638 perf srcline: Add missed addr2line closes
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit c7ba9d18ae47924a6ea6a47ca139779f58eb83c0 ]
The child_process for addr2line sets in and out to -1 so that pipes get created. It is the caller's responsibility to close the pipes, finish_command doesn't do it. Add the missed closes.
--- tools/perf/util/srcline.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/srcline.c +2 -0
@@ -399,6 +399,8 @@ static void addr2line_subprocess_cleanup(struct child_process *a2l)kill (a2l->pid,SIGKILL );finish_command (a2l);/* ignore result, we don't care */ a2l->pid =-1 ; +close (a2l->in); +close (a2l->out); }free (a2l);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 400/638 dt-bindings: msm: qcom, mdss: Include ommited fam-b compatible
In reply to Sasha LevinFrom: Adam Skladowski <[email protected]>
[ Upstream commit 3b63880de42bd3cb79c2a99949135a8f2441c088 ]
During conversion 28nm-hpm-fam-b compat got lost, add it.
Patchwork: https://patchwork.freedesktop.org/patch/575290/
--- Documentation/devicetree/bindings/display/msm/qcom,mdss.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/msm/qcom,mdss.yaml +1 -0
@@ -127,6 +127,7 @@ patternProperties: - qcom,dsi-phy-20nm - qcom,dsi-phy-28nm-8226 - qcom,dsi-phy-28nm-hpm + - qcom,dsi-phy-28nm-hpm-fam-b - qcom,dsi-phy-28nm-lp - qcom,hdmi-phy-8084 - qcom,hdmi-phy-8660
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 401/638 drm/msm/dpu: fix the programming of INTF_CFG2_DATA_HCTL_EN
In reply to Sasha LevinFrom: Abhinav Kumar <[email protected]>
[ Upstream commit 2f4a67a3894e15c135125cb54edc5b43abc1b70e ]
Currently INTF_CFG2_DATA_HCTL_EN is coupled with the enablement of widebus but this is incorrect because we should be enabling this bit independent of widebus except for cases where compression is enabled in one pixel per clock mode.
Fix this by making the condition checks more explicit and enabling INTF_CFG2_DATA_HCTL_EN for all other cases when supported by DPU.
Patchwork: https://patchwork.freedesktop.org/patch/576722/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 7 +++++++ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 15 +++++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 1 + 5 files changed, 25 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +7 -0
@@ -226,6 +226,13 @@ bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc)return dpu_enc->wide_bus_en; } +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc) +{ +const struct dpu_encoder_virt *dpu_enc =to_dpu_encoder_virt (drm_enc); + +return dpu_enc->dsc ? true : false; +} +int dpu_encoder_get_crc_values_cnt (const struct drm_encoder *drm_enc) {struct dpu_encoder_virt *dpu_enc;
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +7 -0
@@ -158,6 +158,13 @@ int dpu_encoder_get_vsync_count(struct drm_encoder *drm_enc);bool dpu_encoder_is_widebus_enabled (const struct drm_encoder *drm_enc); +/** +* dpu_encoder_is_dsc_enabled - indicate whether dsc is enabled +* for the encoder. +* @drm_enc: Pointer to previously created drm encoder structure +*/ +bool dpu_encoder_is_dsc_enabled (const struct drm_encoder *drm_enc); +/** * dpu_encoder_get_crc_values_cnt - get number of physical encoders contained * in virtual encoder that can collect CRC values
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +1 -0
@@ -100,6 +100,7 @@ static void drm_mode_to_intf_timing_params( } timing->wide_bus_en =dpu_encoder_is_widebus_enabled (phys_enc->parent); + timing->compression_en =dpu_encoder_is_dsc_enabled (phys_enc->parent);/* * for DP, divide the horizonal parameters by 2 when
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -6
@@ -161,13 +161,8 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, hsync_ctl = (hsync_period <<16 ) | p->hsync_pulse_width; display_hctl = (hsync_end_x <<16 ) | hsync_start_x; -/* -* DATA_HCTL_EN controls data timing which can be different from -* video timing. It is recommended to enable it for all cases, except -* if compression is enabled in 1 pixel per clock mode -*/ if (p->wide_bus_en) - intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN |INTF_CFG2_DATA_HCTL_EN ; + intf_cfg2 |=INTF_CFG2_DATABUS_WIDEN ; data_width = p->width;
@@ -227,6 +222,14 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx,DPU_REG_WRITE (c,INTF_CONFIG , intf_cfg);DPU_REG_WRITE (c,INTF_PANEL_FORMAT , panel_format);if (ctx->cap->features &BIT (DPU_DATA_HCTL_EN )) { +/* +* DATA_HCTL_EN controls data timing which can be different from +* video timing. It is recommended to enable it for all cases, except +* if compression is enabled in 1 pixel per clock mode +*/ +if (!(p->compression_en && !p->wide_bus_en)) + intf_cfg2 |=INTF_CFG2_DATA_HCTL_EN ; +DPU_REG_WRITE (c,INTF_CONFIG2 , intf_cfg2);DPU_REG_WRITE (c,INTF_DISPLAY_DATA_HCTL , display_data_hctl);DPU_REG_WRITE (c,INTF_ACTIVE_DATA_HCTL , active_data_hctl);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +1 -0
@@ -33,6 +33,7 @@ struct dpu_hw_intf_timing_params {u32 hsync_skew;bool wide_bus_en; +bool compression_en; };struct dpu_hw_intf_prog_fetch {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 402/638 drm/msm/dpu: Only enable DSC_MODE_MULTIPLEX if dsc_merge is enabled
In reply to Sasha LevinFrom: Marijn Suijten <[email protected]>
[ Upstream commit 06267d22f9ee6fd34150b6dcdb2fa6983e1a85bc ]
When the topology calls for two interfaces on the current fixed topology of 2 DSC blocks, or uses 1 DSC block for a single interface (e.g. SC7280 with only one DSC block), there should be no merging of DSC output.
This is already represented by the return value of dpu_encoder_use_dsc_merge(), but not yet used to correctly configure this flag.
Patchwork: https://patchwork.freedesktop.org/patch/577067/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +3 -1
@@ -1855,7 +1855,9 @@ static void dpu_encoder_prep_dsc(struct dpu_encoder_virt *dpu_enc, dsc_common_mode =0 ; pic_width = dsc->pic_width; - dsc_common_mode =DSC_MODE_MULTIPLEX |DSC_MODE_SPLIT_PANEL ; + dsc_common_mode =DSC_MODE_SPLIT_PANEL ; +if (dpu_encoder_use_dsc_merge (enc_master->parent)) + dsc_common_mode |=DSC_MODE_MULTIPLEX ;if (enc_master->intf_mode ==INTF_MODE_VIDEO ) dsc_common_mode |=DSC_MODE_VIDEO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 403/638 drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit c4891d979c7668b195a0a75787967ec95a24ecef ]
Clean up a typo in pr_err() erroneously printing NI MC 'rdev->mc_fw->size' during SMC firmware load. Log 'rdev->smc_fw->size' instead.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -813,7 +813,7 @@ int ni_init_microcode(struct radeon_device *rdev) err =0 ; }else if (rdev->smc_fw->size != smc_req_size) {pr_err ("ni_mc: Bogus length %zu in firmware \"%s\"\n" , - rdev->mc_fw->size, fw_name); + rdev->smc_fw->size, fw_name); err = -EINVAL ; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 404/638 drm/amd/display: fix NULL checks for adev->dm.dc in amdgpu_dm_fini()
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit 2a3cfb9a24a28da9cc13d2c525a76548865e182c ]
Since 'adev->dm.dc' in amdgpu_dm_fini() might turn out to be NULL before the call to dc_enable_dmub_notifications(), check beforehand to ensure there will not be a possible NULL-ptr-deref there.
Also, since commit 1e88eb1b2c25 ("drm/amd/display: Drop CONFIG_DRM_AMD_DC_HDCP") there are two separate checks for NULL in 'adev->dm.dc' before dc_deinit_callbacks() and dc_dmub_srv_destroy(). Clean up by combining them all under one 'if'.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -9
@@ -1902,17 +1902,15 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) adev->dm.hdcp_workqueue =NULL ; } -if (adev->dm.dc) +if (adev->dm.dc) {dc_deinit_callbacks (adev->dm.dc); - -if (adev->dm.dc)dc_dmub_srv_destroy (&adev->dm.dc->ctx->dmub_srv); - -if (dc_enable_dmub_notifications (adev->dm.dc)) { -kfree (adev->dm.dmub_notify); - adev->dm.dmub_notify =NULL ; -destroy_workqueue (adev->dm.delayed_hpd_wq); - adev->dm.delayed_hpd_wq =NULL ; +if (dc_enable_dmub_notifications (adev->dm.dc)) { +kfree (adev->dm.dmub_notify); + adev->dm.dmub_notify =NULL ; +destroy_workqueue (adev->dm.delayed_hpd_wq); + adev->dm.delayed_hpd_wq =NULL ; + } }if (adev->dm.dmub_bo)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 405/638 clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit abb3fa662b8f8eaed1590b0e7a4e19eda467cdd3 ]
According to the R-Car V4H Series Hardware User’s Manual Rev.1.00, the parent clock of the Pin Function (PFC/GPIO) module clocks is the CP clock.
Fix this by adding the missing CP clock, and correcting the PFC parents.
--- drivers/clk/renesas/r8a779g0-cpg-mssr.c | 11 ++++++----- include/dt-bindings/clock/r8a779g0-cpg-mssr.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/clk/renesas/r8a779g0-cpg-mssr.c +6 -5
@@ -22,7 +22,7 @@enum clk_ids {/* Core Clock Outputs exported to DT */ -LAST_DT_CORE_CLK =R8A779G0_CLK_R , +LAST_DT_CORE_CLK =R8A779G0_CLK_CP ,/* External Input Clocks */ CLK_EXTAL ,
@@ -141,6 +141,7 @@ static const struct cpg_core_clk r8a779g0_core_clks[] __initconst = {DEF_FIXED ("svd2_vip" ,R8A779G0_CLK_SVD2_VIP ,CLK_SV_VIP ,2 ,1 ),DEF_FIXED ("cbfusa" ,R8A779G0_CLK_CBFUSA ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("cpex" ,R8A779G0_CLK_CPEX ,CLK_EXTAL ,2 ,1 ), +DEF_FIXED ("cp" ,R8A779G0_CLK_CP ,CLK_EXTAL ,2 ,1 ),DEF_FIXED ("viobus" ,R8A779G0_CLK_VIOBUS ,CLK_VIO ,1 ,1 ),DEF_FIXED ("viobusd2" ,R8A779G0_CLK_VIOBUSD2 ,CLK_VIO ,2 ,1 ), DEF_FIXED("vcbus", R8A779G0_CLK_VCBUS, CLK_VC, 1, 1),
@@ -230,10 +231,10 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779G0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779G0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779G0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CL16M ), -DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc1" ,916 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc2" ,917 ,R8A779G0_CLK_CP ), +DEF_MOD ("pfc3" ,918 ,R8A779G0_CLK_CP ),DEF_MOD ("tsc" ,919 ,R8A779G0_CLK_CL16M ),DEF_MOD ("ssiu" ,2926 ,R8A779G0_CLK_S0D6_PER ), DEF_MOD("ssi", 2927, R8A779G0_CLK_S0D6_PER),
include/dt-bindings/clock/r8a779g0-cpg-mssr.h +1 -0
@@ -86,5 +86,6 @@#define R8A779G0_CLK_CPEX 74#define R8A779G0_CLK_CBFUSA 75#define R8A779G0_CLK_R 76 +#define R8A779G0_CLK_CP 77#endif /* __DT_BINDINGS_CLOCK_R8A779G0_CPG_MSSR_H__ */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 406/638 clk: renesas: r8a779f0: Correct PFC/GPIO parent clock
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d1b32a83a02d9433dbd8c5f4d6fc44aa597755bd ]
According to the R-Car S4 Series Hardware User’s Manual Rev.0.81, the parent clock of the Pin Function (PFC/GPIO) module clock is the CP clock.
As this clock is not documented to exist on R-Car S4, use the CPEX clock instead.
--- drivers/clk/renesas/r8a779f0-cpg-mssr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/r8a779f0-cpg-mssr.c +1 -1
@@ -161,7 +161,7 @@ static const struct mssr_mod_clk r8a779f0_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,911 ,R8A779F0_CLK_R ),DEF_MOD ("cmt2" ,912 ,R8A779F0_CLK_R ),DEF_MOD ("cmt3" ,913 ,R8A779F0_CLK_R ), -DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CL16M ), +DEF_MOD ("pfc0" ,915 ,R8A779F0_CLK_CPEX ),DEF_MOD ("tsc" ,919 ,R8A779F0_CLK_CL16M ),DEF_MOD ("rswitch2" ,1505 ,R8A779F0_CLK_RSW2 ), DEF_MOD("ether-serdes", 1506, R8A779F0_CLK_S0D2_HSC),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 407/638 ALSA: seq: fix function cast warnings
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit d7bf73809849463f76de42aad62c850305dd6c5d ]
clang-16 points out a control flow integrity (kcfi) issue when event callbacks get converted to incompatible types:
sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawmidi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
135 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_rawmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
83 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~For addressing those errors, introduce wrapper functions that are used for callbacks and bridge to the actual function call with pointer cast.
The code was originally added with the initial ALSA merge in linux-2.5.4.
[ the patch description shamelessly copied from Arnd's original patch
-- tiwai ]
--- sound/core/seq/seq_midi.c | 8 +++++++- sound/core/seq/seq_virmidi.c | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-)
sound/core/seq/seq_midi.c +7 -1
@@ -113,6 +113,12 @@ static int dump_midi(struct snd_rawmidi_substream *substream, const char *buf, ireturn 0 ; } +/* callback for snd_seq_dump_var_event(), bridging to dump_midi() */ +static int __dump_midi (void *ptr,void *buf,int count) +{ +return dump_midi (ptr, buf, count); +} +static int event_process_midi (struct snd_seq_event *ev,int direct,void *private_data,int atomic,int hop) {
@@ -132,7 +138,7 @@ static int event_process_midi(struct snd_seq_event *ev, int direct,pr_debug ("ALSA: seq_midi: invalid sysex event flags = 0x%x\n" , ev->flags);return 0 ; } -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )dump_midi, substream); +snd_seq_dump_var_event (ev, __dump_midi, substream);snd_midi_event_reset_decode (msynth->parser); }else {if (msynth->parser ==NULL )
sound/core/seq/seq_virmidi.c +8 -1
@@ -62,6 +62,13 @@ static void snd_virmidi_init_event(struct snd_virmidi *vmidi,/* * decode input event and put to read buffer of each opened file */ + +/* callback for snd_seq_dump_var_event(), bridging to snd_rawmidi_receive() */ +static int dump_to_rawmidi (void *ptr,void *buf,int count) +{ +return snd_rawmidi_receive (ptr, buf, count); +} +static int snd_virmidi_dev_receive_event (struct snd_virmidi_dev *rdev,struct snd_seq_event *ev,bool atomic)
@@ -80,7 +87,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,if (ev->type ==SNDRV_SEQ_EVENT_SYSEX ) {if ((ev->flags &SNDRV_SEQ_EVENT_LENGTH_MASK ) !=SNDRV_SEQ_EVENT_LENGTH_VARIABLE )continue ; -snd_seq_dump_var_event (ev, (snd_seq_dump_func_t )snd_rawmidi_receive, vmidi->substream); +snd_seq_dump_var_event (ev, dump_to_rawmidi, vmidi->substream);snd_midi_event_reset_decode (vmidi->parser); }else { len =snd_midi_event_decode (vmidi->parser, msg,sizeof (msg), ev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 408/638 perf expr: Fix "has_event" function for metric style events
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 6dd76680b925228312756c13b9b983661b552a64 ]
Events in metrics cannot use '/' as a separator, it would be recognized as a divide, so they use '@'. The '@' is recognized in the metricgroups code and changed to '/', do the same in the has_event function so that the parsing is only tried without the @s.
--- tools/perf/util/expr.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
tools/perf/util/expr.c +19 -1
@@ -500,7 +500,25 @@ double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const tmp =evlist__new ();if (!tmp)return NAN ; - ret =parse_event (tmp, id) ?0 :1 ; + +if (strchr (id,'@' )) { +char *tmp_id, *p; + + tmp_id =strdup (id); +if (!tmp_id) { + ret =NAN ; + goto out; + } + p =strchr (tmp_id,'@' ); + *p ='/' ; + p =strrchr (tmp_id,'@' ); + *p ='/' ; + ret =parse_event (tmp, tmp_id) ?0 :1 ; +free (tmp_id); + }else { + ret =parse_event (tmp, id) ?0 :1 ; + } +out:evlist__delete (tmp);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 409/638 perf stat: Avoid metric-only segv
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 2543947c77e0e224bda86b4e7220c2f6714da463 ]
Cycles is recognized as part of a hard coded metric in stat-shadow.c, it may call print_metric_only with a NULL fmt string leading to a segfault. Handle the NULL fmt explicitly.
--- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/stat-display.c +1 -1
@@ -560,7 +560,7 @@ static void print_metric_only(struct perf_stat_config *config,if (color) mlen +=strlen (color) +sizeof (PERF_COLOR_RESET ) -1 ; -color_snprintf (str,sizeof (str), color ?:"" , fmt, val); +color_snprintf (str,sizeof (str), color ?:"" , fmt ?:"" , val);fprintf (out,"%*s " , mlen, str); os->first = false; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 410/638 perf metric: Don't remove scale from counts
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 6d6be5eb45b423a37d746d3ee0fd0c78f76ead9f ]
Counts were switched from the scaled saved value form to the aggregated count to avoid double accounting. When this happened the removing of scaling for a count should have been removed, however, it wasn't and this wasn't observed as it normally doesn't matter because a counter's scale is 1. A problem was observed with RAPL events that are scaled.
--- tools/perf/util/stat-shadow.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
tools/perf/util/stat-shadow.c +1 -6
@@ -414,12 +414,7 @@ static int prepare_metric(struct evsel **metric_events, val =NAN ; source_count =0 ; }else { -/* -* If an event was scaled during stat gathering, -* reverse the scale before computing the -* metric. -*/ - val = aggr->counts.val * (1.0 / metric_events[i]->scale); + val = aggr->counts.val; source_count =evsel__source_count (metric_events[i]); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 411/638 ASoC: meson: aiu: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 98ac85a00f31d2e9d5452b825a9ed0153d934043 ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
243 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/aiu.c | 19 ++++--------------- sound/soc/meson/aiu.h | 1 - 2 files changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/aiu.c +4 -15
@@ -212,11 +212,12 @@ static const char * const aiu_spdif_ids[] = {static int aiu_clk_get (struct device *dev) {struct aiu *aiu =dev_get_drvdata (dev); +struct clk *pclk;int ret; - aiu->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (aiu->pclk)) -return dev_err_probe (dev,PTR_ERR (aiu->pclk),"Can't get the aiu pclk\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"Can't get the aiu pclk\n" ); aiu->spdif_mclk =devm_clk_get (dev,"spdif_mclk" );if (IS_ERR (aiu->spdif_mclk))
@@ -233,18 +234,6 @@ static int aiu_clk_get(struct device *dev)if (ret)return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); - ret =clk_prepare_enable (aiu->pclk); -if (ret) { -dev_err (dev,"peripheral clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - aiu->pclk); -if (ret) -dev_err (dev,"failed to add reset action on pclk" ); -return ret; }
sound/soc/meson/aiu.h +0 -1
@@ -33,7 +33,6 @@ struct aiu_platform_data { };struct aiu { -struct clk *pclk;struct clk *spdif_mclk;struct aiu_interface i2s;struct aiu_interface spdif;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 412/638 ASoC: meson: t9015: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 5ad992c71b6a8e8a547954addc7af9fbde6ca10a ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
274 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/t9015.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/t9015.c +4 -16
@@ -48,7 +48,6 @@#define POWER_CFG 0x10struct t9015 { -struct clk *pclk;struct regulator *avdd; };
@@ -249,6 +248,7 @@ static int t9015_probe(struct platform_device *pdev)struct t9015 *priv;void __iomem *regs;struct regmap *regmap; +struct clk *pclk;int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );
@@ -256,26 +256,14 @@ static int t9015_probe(struct platform_device *pdev)return -ENOMEM ;platform_set_drvdata (pdev, priv); - priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) -return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get core clock\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"failed to get core clock\n" ); priv->avdd =devm_regulator_get (dev,"AVDD" );if (IS_ERR (priv->avdd))return dev_err_probe (dev,PTR_ERR (priv->avdd),"failed to AVDD\n" ); - ret =clk_prepare_enable (priv->pclk); -if (ret) { -dev_err (dev,"core clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - priv->pclk); -if (ret) -return ret; - ret =device_reset (dev);if (ret) {dev_err (dev,"reset failed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 413/638 powerpc: Force inlining of arch_vmap_p{u/m}d_supported()
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit c5aebb53b32460bc52680dd4e2a2f6b84d5ea521 ]
arch_vmap_pud_supported() and arch_vmap_pmd_supported() are expected to constant-fold to false when RADIX is not enabled.
Force inlining in order to avoid following failure which leads to unexpected call of non-existing pud_set_huge() and pmd_set_huge() on powerpc 8xx.
In function 'pud_huge_tests',
inlined from 'debug_vm_pgtable' at mm/debug_vm_pgtable.c:1399:2:./arch/powerpc/include/asm/vmalloc.h:9:33: warning: inlining failed in call to 'arch_vmap_pud_supported.isra': call is unlikely and code size would grow [-Winline]
9 | #define arch_vmap_pud_supported arch_vmap_pud_supported
| ^~~~~~~~~~~~~~~~~~~~~~~./arch/powerpc/include/asm/vmalloc.h:10:20: note: in expansion of macro 'arch_vmap_pud_supported'
10 | static inline bool arch_vmap_pud_supported(pgprot_t prot)
| ^~~~~~~~~~~~~~~~~~~~~~~
./arch/powerpc/include/asm/vmalloc.h:9:33: note: called from here
9 | #define arch_vmap_pud_supported arch_vmap_pud_supportedmm/debug_vm_pgtable.c:458:14: note: in expansion of macro 'arch_vmap_pud_supported'
458 | if (!arch_vmap_pud_supported(args->page_prot) ||
| ^~~~~~~~~~~~~~~~~~~~~~~
--- arch/powerpc/include/asm/vmalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/vmalloc.h +2 -2
@@ -7,14 +7,14 @@#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP #define arch_vmap_pud_supported arch_vmap_pud_supported -static inline bool arch_vmap_pud_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pud_supported(pgprot_t prot) {/* HPT does not cope with large pages in the vmalloc area */ return radix_enabled (); }#define arch_vmap_pmd_supported arch_vmap_pmd_supported -static inline bool arch_vmap_pmd_supported (pgprot_t prot) +static __always_inline bool arch_vmap_pmd_supported(pgprot_t prot) {return radix_enabled (); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 414/638 ASoC: SOF: Add some bounds checking to firmware data
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 98f681b0f84cfc3a1d83287b77697679e0398306 ]
Smatch complains about "head->full_size - head->header_size" can underflow. To some extent, we're always going to have to trust the firmware a bit. However, it's easy enough to add a check for negatives, and let's add a upper bounds check as well.
--- sound/soc/sof/ipc3-loader.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/sof/ipc3-loader.c +2 -0
@@ -148,6 +148,8 @@ static size_t sof_ipc3_fw_parse_ext_man(struct snd_sof_dev *sdev) head = (struct sof_ext_man_header *)fw->data; remaining = head->full_size - head->header_size; +if (remaining <0 || remaining > sdev->basefw.fw->size) +return -EINVAL ; ext_man_size =ipc3_fw_ext_man_size (sdev, fw);/* Assert firmware starts with extended manifest */
Signature · 1 line
2.43.0