* [PATCH AUTOSEL 5.10 02/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal()
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 03/16] dmaengine: ti: edma: Add some null pointer checks to the edma_probe Sasha Levin
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Baokun Li, Jan Kara, Theodore Ts'o, Sasha Levin,
adilger.kernel, linux-ext4
From: Baokun Li <libaokun1@huawei.com>
[ Upstream commit 832698373a25950942c04a512daa652c18a9b513 ]
Places the logic for checking if the group's block bitmap is corrupt under
the protection of the group lock to avoid allocating blocks from the group
with a corrupted block bitmap.
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240104142040.2835097-8-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/mballoc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d7724601f42b..e528ae0618fe 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1893,12 +1893,10 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,
if (err)
return err;
- if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) {
- ext4_mb_unload_buddy(e4b);
- return 0;
- }
-
ext4_lock_group(ac->ac_sb, group);
+ if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)))
+ goto out;
+
max = mb_find_extent(e4b, ac->ac_g_ex.fe_start,
ac->ac_g_ex.fe_len, &ex);
ex.fe_logical = 0xDEADFA11; /* debug value */
@@ -1931,6 +1929,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,
ac->ac_b_ex = ex;
ext4_mb_use_best_found(ac, e4b);
}
+out:
ext4_unlock_group(ac->ac_sb, group);
ext4_mb_unload_buddy(e4b);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 03/16] dmaengine: ti: edma: Add some null pointer checks to the edma_probe
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 02/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal() Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include Sasha Levin
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Kunwu Chan, Vinod Koul, Sasha Levin, peter.ujfalusi, dmaengine
From: Kunwu Chan <chentao@kylinos.cn>
[ Upstream commit 6e2276203ac9ff10fc76917ec9813c660f627369 ]
devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Link: https://lore.kernel.org/r/20240118031929.192192-1-chentao@kylinos.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ti/edma.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index a1adc8d91fd8..69292d4a0c44 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -2462,6 +2462,11 @@ static int edma_probe(struct platform_device *pdev)
if (irq > 0) {
irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint",
dev_name(dev));
+ if (!irq_name) {
+ ret = -ENOMEM;
+ goto err_disable_pm;
+ }
+
ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
ecc);
if (ret) {
@@ -2478,6 +2483,11 @@ static int edma_probe(struct platform_device *pdev)
if (irq > 0) {
irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint",
dev_name(dev));
+ if (!irq_name) {
+ ret = -ENOMEM;
+ goto err_disable_pm;
+ }
+
ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,
ecc);
if (ret) {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 02/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal() Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 03/16] dmaengine: ti: edma: Add some null pointer checks to the edma_probe Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-18 19:10 ` Pavel Machek
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 05/16] regulator: pwm-regulator: Add validity checks in continuous .get_voltage Sasha Levin
` (11 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Krzysztof Kozlowski, Mark Brown, Sasha Levin, srinivas.kandagatla,
bgoswami, lgirdwood, perex, tiwai, alsa-devel, linux-sound
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
[ Upstream commit 35314e39dabcfb256832654ad0e856a9fba744bd ]
Driver does not use any regulator code, so drop redundant include of
regulator/consumer.h header.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240117151208.1219755-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wcd934x.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 104751ac6cd1..dbed3a646524 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -13,7 +13,6 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
-#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/slimbus.h>
#include <sound/pcm_params.h>
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include Sasha Levin
@ 2024-02-18 19:10 ` Pavel Machek
0 siblings, 0 replies; 19+ messages in thread
From: Pavel Machek @ 2024-02-18 19:10 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Krzysztof Kozlowski, Mark Brown,
srinivas.kandagatla, bgoswami, lgirdwood, perex, tiwai,
alsa-devel, linux-sound
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Hi!
> [ Upstream commit 35314e39dabcfb256832654ad0e856a9fba744bd ]
>
> Driver does not use any regulator code, so drop redundant include of
> regulator/consumer.h header.
This is just a cleanup, we should not have it in stable.
Best regards,
Pavel
> +++ b/sound/soc/codecs/wcd934x.c
> @@ -13,7 +13,6 @@
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/regmap.h>
> -#include <linux/regulator/consumer.h>
> #include <linux/slab.h>
> #include <linux/slimbus.h>
> #include <sound/pcm_params.h>
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH AUTOSEL 5.10 05/16] regulator: pwm-regulator: Add validity checks in continuous .get_voltage
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (2 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 04/16] ASoC: codecs: wcd934x: drop unneeded regulator include Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 06/16] nvmet-tcp: fix nvme tcp ida memory leak Sasha Levin
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Martin Blumenstingl, Uwe Kleine-König, Mark Brown,
Sasha Levin, lgirdwood
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[ Upstream commit c92688cac239794e4a1d976afa5203a4d3a2ac0e ]
Continuous regulators can be configured to operate only in a certain
duty cycle range (for example from 0..91%). Add a check to error out if
the duty cycle translates to an unsupported (or out of range) voltage.
Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://msgid.link/r/20240113224628.377993-2-martin.blumenstingl@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/regulator/pwm-regulator.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 7629476d94ae..f4d9d9455dea 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -158,6 +158,9 @@ static int pwm_regulator_get_voltage(struct regulator_dev *rdev)
pwm_get_state(drvdata->pwm, &pstate);
voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit);
+ if (voltage < min(max_uV_duty, min_uV_duty) ||
+ voltage > max(max_uV_duty, min_uV_duty))
+ return -ENOTRECOVERABLE;
/*
* The dutycycle for min_uV might be greater than the one for max_uV.
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 06/16] nvmet-tcp: fix nvme tcp ida memory leak
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (3 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 05/16] regulator: pwm-regulator: Add validity checks in continuous .get_voltage Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 07/16] ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 Sasha Levin
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Guixin Liu, Christoph Hellwig, Chaitanya Kulkarni, Keith Busch,
Sasha Levin, sagi, linux-nvme
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit 47c5dd66c1840524572dcdd956f4af2bdb6fbdff ]
The nvmet_tcp_queue_ida should be destroy when the nvmet-tcp module
exit.
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/tcp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 116ae6fd35e2..d70a2fa4ba45 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1852,6 +1852,7 @@ static void __exit nvmet_tcp_exit(void)
flush_scheduled_work();
destroy_workqueue(nvmet_tcp_wq);
+ ida_destroy(&nvmet_tcp_queue_ida);
}
module_init(nvmet_tcp_init);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 07/16] ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (4 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 06/16] nvmet-tcp: fix nvme tcp ida memory leak Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 08/16] spi: sh-msiof: avoid integer overflow in constants Sasha Levin
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Chen-Yu Tsai, Andre Przywara, Jernej Skrabec, Mark Brown,
Sasha Levin, lgirdwood, perex, tiwai, samuel,
kuninori.morimoto.gx, nicolas.ferre, robh, ruanjinjie,
u.kleine-koenig, linux-sound, linux-arm-kernel, linux-sunxi
From: Chen-Yu Tsai <wens@csie.org>
[ Upstream commit 0adf963b8463faa44653e22e56ce55f747e68868 ]
The SPDIF hardware block found in the H616 SoC has the same layout as
the one found in the H6 SoC, except that it is missing the receiver
side.
Since the driver currently only supports the transmit function, support
for the H616 is identical to what is currently done for the H6.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://msgid.link/r/20240127163247.384439-4-wens@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sunxi/sun4i-spdif.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
index 228485fe0734..6dcad1aa2503 100644
--- a/sound/soc/sunxi/sun4i-spdif.c
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -464,6 +464,11 @@ static const struct of_device_id sun4i_spdif_of_match[] = {
.compatible = "allwinner,sun50i-h6-spdif",
.data = &sun50i_h6_spdif_quirks,
},
+ {
+ .compatible = "allwinner,sun50i-h616-spdif",
+ /* Essentially the same as the H6, but without RX */
+ .data = &sun50i_h6_spdif_quirks,
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 08/16] spi: sh-msiof: avoid integer overflow in constants
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (5 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 07/16] ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 09/16] netfilter: conntrack: check SCTP_CID_SHUTDOWN_ACK for vtag setting in sctp_new Sasha Levin
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Wolfram Sang, Geert Uytterhoeven, Mark Brown, Sasha Levin,
linux-spi
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
[ Upstream commit 6500ad28fd5d67d5ca0fee9da73c463090842440 ]
cppcheck rightfully warned:
drivers/spi/spi-sh-msiof.c:792:28: warning: Signed integer overflow for expression '7<<29'. [integerOverflow]
sh_msiof_write(p, SIFCTR, SIFCTR_TFWM_1 | SIFCTR_RFWM_1);
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://msgid.link/r/20240130094053.10672-1-wsa+renesas@sang-engineering.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-sh-msiof.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 35d30378256f..12fd02f92e37 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -137,14 +137,14 @@ struct sh_msiof_spi_priv {
/* SIFCTR */
#define SIFCTR_TFWM_MASK GENMASK(31, 29) /* Transmit FIFO Watermark */
-#define SIFCTR_TFWM_64 (0 << 29) /* Transfer Request when 64 empty stages */
-#define SIFCTR_TFWM_32 (1 << 29) /* Transfer Request when 32 empty stages */
-#define SIFCTR_TFWM_24 (2 << 29) /* Transfer Request when 24 empty stages */
-#define SIFCTR_TFWM_16 (3 << 29) /* Transfer Request when 16 empty stages */
-#define SIFCTR_TFWM_12 (4 << 29) /* Transfer Request when 12 empty stages */
-#define SIFCTR_TFWM_8 (5 << 29) /* Transfer Request when 8 empty stages */
-#define SIFCTR_TFWM_4 (6 << 29) /* Transfer Request when 4 empty stages */
-#define SIFCTR_TFWM_1 (7 << 29) /* Transfer Request when 1 empty stage */
+#define SIFCTR_TFWM_64 (0UL << 29) /* Transfer Request when 64 empty stages */
+#define SIFCTR_TFWM_32 (1UL << 29) /* Transfer Request when 32 empty stages */
+#define SIFCTR_TFWM_24 (2UL << 29) /* Transfer Request when 24 empty stages */
+#define SIFCTR_TFWM_16 (3UL << 29) /* Transfer Request when 16 empty stages */
+#define SIFCTR_TFWM_12 (4UL << 29) /* Transfer Request when 12 empty stages */
+#define SIFCTR_TFWM_8 (5UL << 29) /* Transfer Request when 8 empty stages */
+#define SIFCTR_TFWM_4 (6UL << 29) /* Transfer Request when 4 empty stages */
+#define SIFCTR_TFWM_1 (7UL << 29) /* Transfer Request when 1 empty stage */
#define SIFCTR_TFUA_MASK GENMASK(26, 20) /* Transmit FIFO Usable Area */
#define SIFCTR_TFUA_SHIFT 20
#define SIFCTR_TFUA(i) ((i) << SIFCTR_TFUA_SHIFT)
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 09/16] netfilter: conntrack: check SCTP_CID_SHUTDOWN_ACK for vtag setting in sctp_new
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (6 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 08/16] spi: sh-msiof: avoid integer overflow in constants Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 10/16] nvme-fc: do not wait in vain when unloading module Sasha Levin
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Xin Long, Pablo Neira Ayuso, Sasha Levin, kadlec, fw, davem,
edumazet, kuba, pabeni, netfilter-devel, coreteam, netdev
From: Xin Long <lucien.xin@gmail.com>
[ Upstream commit 6e348067ee4bc5905e35faa3a8fafa91c9124bc7 ]
The annotation says in sctp_new(): "If it is a shutdown ack OOTB packet, we
expect a return shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8)".
However, it does not check SCTP_CID_SHUTDOWN_ACK before setting vtag[REPLY]
in the conntrack entry(ct).
Because of that, if the ct in Router disappears for some reason in [1]
with the packet sequence like below:
Client > Server: sctp (1) [INIT] [init tag: 3201533963]
Server > Client: sctp (1) [INIT ACK] [init tag: 972498433]
Client > Server: sctp (1) [COOKIE ECHO]
Server > Client: sctp (1) [COOKIE ACK]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057809]
Server > Client: sctp (1) [SACK] [cum ack 3075057809]
Server > Client: sctp (1) [HB REQ]
(the ct in Router disappears somehow) <-------- [1]
Client > Server: sctp (1) [HB ACK]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810]
Client > Server: sctp (1) [HB REQ]
Client > Server: sctp (1) [DATA] (B)(E) [TSN: 3075057810]
Client > Server: sctp (1) [HB REQ]
Client > Server: sctp (1) [ABORT]
when processing HB ACK packet in Router it calls sctp_new() to initialize
the new ct with vtag[REPLY] set to HB_ACK packet's vtag.
Later when sending DATA from Client, all the SACKs from Server will get
dropped in Router, as the SACK packet's vtag does not match vtag[REPLY]
in the ct. The worst thing is the vtag in this ct will never get fixed
by the upcoming packets from Server.
This patch fixes it by checking SCTP_CID_SHUTDOWN_ACK before setting
vtag[REPLY] in the ct in sctp_new() as the annotation says. With this
fix, it will leave vtag[REPLY] in ct to 0 in the case above, and the
next HB REQ/ACK from Server is able to fix the vtag as its value is 0
in nf_conntrack_sctp_packet().
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_conntrack_proto_sctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index e7545bcca805..6b2a215b2786 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -299,7 +299,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb,
pr_debug("Setting vtag %x for secondary conntrack\n",
sh->vtag);
ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL] = sh->vtag;
- } else {
+ } else if (sch->type == SCTP_CID_SHUTDOWN_ACK) {
/* If it is a shutdown ack OOTB packet, we expect a return
shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */
pr_debug("Setting vtag %x for new conn OOTB\n",
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 10/16] nvme-fc: do not wait in vain when unloading module
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (7 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 09/16] netfilter: conntrack: check SCTP_CID_SHUTDOWN_ACK for vtag setting in sctp_new Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 11/16] nvmet-fcloop: swap the list_add_tail arguments Sasha Levin
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Daniel Wagner, Christoph Hellwig, Hannes Reinecke, Keith Busch,
Sasha Levin, james.smart, sagi, linux-nvme
From: Daniel Wagner <dwagner@suse.de>
[ Upstream commit 70fbfc47a392b98e5f8dba70c6efc6839205c982 ]
The module exit path has race between deleting all controllers and
freeing 'left over IDs'. To prevent double free a synchronization
between nvme_delete_ctrl and ida_destroy has been added by the initial
commit.
There is some logic around trying to prevent from hanging forever in
wait_for_completion, though it does not handling all cases. E.g.
blktests is able to reproduce the situation where the module unload
hangs forever.
If we completely rely on the cleanup code executed from the
nvme_delete_ctrl path, all IDs will be freed eventually. This makes
calling ida_destroy unnecessary. We only have to ensure that all
nvme_delete_ctrl code has been executed before we leave
nvme_fc_exit_module. This is done by flushing the nvme_delete_wq
workqueue.
While at it, remove the unused nvme_fc_wq workqueue too.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/fc.c | 47 ++++++------------------------------------
1 file changed, 6 insertions(+), 41 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 906cab35afe7..8e05239073ef 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -220,11 +220,6 @@ static LIST_HEAD(nvme_fc_lport_list);
static DEFINE_IDA(nvme_fc_local_port_cnt);
static DEFINE_IDA(nvme_fc_ctrl_cnt);
-static struct workqueue_struct *nvme_fc_wq;
-
-static bool nvme_fc_waiting_to_unload;
-static DECLARE_COMPLETION(nvme_fc_unload_proceed);
-
/*
* These items are short-term. They will eventually be moved into
* a generic FC class. See comments in module init.
@@ -254,8 +249,6 @@ nvme_fc_free_lport(struct kref *ref)
/* remove from transport list */
spin_lock_irqsave(&nvme_fc_lock, flags);
list_del(&lport->port_list);
- if (nvme_fc_waiting_to_unload && list_empty(&nvme_fc_lport_list))
- complete(&nvme_fc_unload_proceed);
spin_unlock_irqrestore(&nvme_fc_lock, flags);
ida_simple_remove(&nvme_fc_local_port_cnt, lport->localport.port_num);
@@ -3823,10 +3816,6 @@ static int __init nvme_fc_init_module(void)
{
int ret;
- nvme_fc_wq = alloc_workqueue("nvme_fc_wq", WQ_MEM_RECLAIM, 0);
- if (!nvme_fc_wq)
- return -ENOMEM;
-
/*
* NOTE:
* It is expected that in the future the kernel will combine
@@ -3844,7 +3833,7 @@ static int __init nvme_fc_init_module(void)
ret = class_register(&fc_class);
if (ret) {
pr_err("couldn't register class fc\n");
- goto out_destroy_wq;
+ return ret;
}
/*
@@ -3868,8 +3857,6 @@ static int __init nvme_fc_init_module(void)
device_destroy(&fc_class, MKDEV(0, 0));
out_destroy_class:
class_unregister(&fc_class);
-out_destroy_wq:
- destroy_workqueue(nvme_fc_wq);
return ret;
}
@@ -3889,45 +3876,23 @@ nvme_fc_delete_controllers(struct nvme_fc_rport *rport)
spin_unlock(&rport->lock);
}
-static void
-nvme_fc_cleanup_for_unload(void)
+static void __exit nvme_fc_exit_module(void)
{
struct nvme_fc_lport *lport;
struct nvme_fc_rport *rport;
-
- list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
- list_for_each_entry(rport, &lport->endp_list, endp_list) {
- nvme_fc_delete_controllers(rport);
- }
- }
-}
-
-static void __exit nvme_fc_exit_module(void)
-{
unsigned long flags;
- bool need_cleanup = false;
spin_lock_irqsave(&nvme_fc_lock, flags);
- nvme_fc_waiting_to_unload = true;
- if (!list_empty(&nvme_fc_lport_list)) {
- need_cleanup = true;
- nvme_fc_cleanup_for_unload();
- }
+ list_for_each_entry(lport, &nvme_fc_lport_list, port_list)
+ list_for_each_entry(rport, &lport->endp_list, endp_list)
+ nvme_fc_delete_controllers(rport);
spin_unlock_irqrestore(&nvme_fc_lock, flags);
- if (need_cleanup) {
- pr_info("%s: waiting for ctlr deletes\n", __func__);
- wait_for_completion(&nvme_fc_unload_proceed);
- pr_info("%s: ctrl deletes complete\n", __func__);
- }
+ flush_workqueue(nvme_delete_wq);
nvmf_unregister_transport(&nvme_fc_transport);
- ida_destroy(&nvme_fc_local_port_cnt);
- ida_destroy(&nvme_fc_ctrl_cnt);
-
device_destroy(&fc_class, MKDEV(0, 0));
class_unregister(&fc_class);
- destroy_workqueue(nvme_fc_wq);
}
module_init(nvme_fc_init_module);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 11/16] nvmet-fcloop: swap the list_add_tail arguments
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (8 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 10/16] nvme-fc: do not wait in vain when unloading module Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 12/16] nvmet-fc: release reference on target port Sasha Levin
` (4 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Daniel Wagner, Christoph Hellwig, Hannes Reinecke, Keith Busch,
Sasha Levin, james.smart, sagi, kch, linux-nvme
From: Daniel Wagner <dwagner@suse.de>
[ Upstream commit dcfad4ab4d6733f2861cd241d8532a0004fc835a ]
The first argument of list_add_tail function is the new element which
should be added to the list which is the second argument. Swap the
arguments to allow processing more than one element at a time.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/fcloop.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index 80a208fb34f5..f2c5136bf2b8 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -358,7 +358,7 @@ fcloop_h2t_ls_req(struct nvme_fc_local_port *localport,
if (!rport->targetport) {
tls_req->status = -ECONNREFUSED;
spin_lock(&rport->lock);
- list_add_tail(&rport->ls_list, &tls_req->ls_list);
+ list_add_tail(&tls_req->ls_list, &rport->ls_list);
spin_unlock(&rport->lock);
schedule_work(&rport->ls_work);
return ret;
@@ -391,7 +391,7 @@ fcloop_h2t_xmt_ls_rsp(struct nvmet_fc_target_port *targetport,
if (remoteport) {
rport = remoteport->private;
spin_lock(&rport->lock);
- list_add_tail(&rport->ls_list, &tls_req->ls_list);
+ list_add_tail(&tls_req->ls_list, &rport->ls_list);
spin_unlock(&rport->lock);
schedule_work(&rport->ls_work);
}
@@ -446,7 +446,7 @@ fcloop_t2h_ls_req(struct nvmet_fc_target_port *targetport, void *hosthandle,
if (!tport->remoteport) {
tls_req->status = -ECONNREFUSED;
spin_lock(&tport->lock);
- list_add_tail(&tport->ls_list, &tls_req->ls_list);
+ list_add_tail(&tls_req->ls_list, &tport->ls_list);
spin_unlock(&tport->lock);
schedule_work(&tport->ls_work);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 12/16] nvmet-fc: release reference on target port
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (9 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 11/16] nvmet-fcloop: swap the list_add_tail arguments Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc Sasha Levin
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Daniel Wagner, Hannes Reinecke, Christoph Hellwig, Keith Busch,
Sasha Levin, james.smart, sagi, kch, linux-nvme
From: Daniel Wagner <dwagner@suse.de>
[ Upstream commit c691e6d7e13dab81ac8c7489c83b5dea972522a5 ]
In case we return early out of __nvmet_fc_finish_ls_req() we still have
to release the reference on the target port.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/fc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 46fc44ce8671..18a64a4fd8da 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -357,7 +357,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)
if (!lsop->req_queued) {
spin_unlock_irqrestore(&tgtport->lock, flags);
- return;
+ goto out_puttgtport;
}
list_del(&lsop->lsreq_list);
@@ -370,6 +370,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)
(lsreq->rqstlen + lsreq->rsplen),
DMA_BIDIRECTIONAL);
+out_puttgtport:
nvmet_fc_tgtport_put(tgtport);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (10 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 12/16] nvmet-fc: release reference on target port Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-18 19:08 ` Pavel Machek
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 14/16] nvmet-fc: abort command when there is no binding Sasha Levin
` (2 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Daniel Wagner, Hannes Reinecke, Christoph Hellwig, Keith Busch,
Sasha Levin, james.smart, sagi, kch, linux-nvme
From: Daniel Wagner <dwagner@suse.de>
[ Upstream commit 1c110588dd95d21782397ff3cbaa55820b4e1fad ]
The association life time is tied to the life time of the target port.
That means we should not take extra a refcount when creating a
association.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/fc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 18a64a4fd8da..ebbc513682e1 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1110,12 +1110,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
if (idx < 0)
goto out_free_assoc;
- if (!nvmet_fc_tgtport_get(tgtport))
- goto out_ida;
-
assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle);
if (IS_ERR(assoc->hostport))
- goto out_put;
+ goto out_ida;
assoc->tgtport = tgtport;
assoc->a_id = idx;
@@ -1145,8 +1142,6 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
return assoc;
-out_put:
- nvmet_fc_tgtport_put(tgtport);
out_ida:
ida_simple_remove(&tgtport->assoc_cnt, idx);
out_free_assoc:
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc Sasha Levin
@ 2024-02-18 19:08 ` Pavel Machek
2024-02-22 12:24 ` Sasha Levin
0 siblings, 1 reply; 19+ messages in thread
From: Pavel Machek @ 2024-02-18 19:08 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Daniel Wagner, Hannes Reinecke,
Christoph Hellwig, Keith Busch, james.smart, sagi, kch,
linux-nvme
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
Hi!
> From: Daniel Wagner <dwagner@suse.de>
>
> [ Upstream commit 1c110588dd95d21782397ff3cbaa55820b4e1fad ]
>
> The association life time is tied to the life time of the target port.
> That means we should not take extra a refcount when creating a
> association.
I don't see this one queued for 6.1 or 6.6. What went wrong here?
Best regards,
Pavel
> +++ b/drivers/nvme/target/fc.c
> @@ -1110,12 +1110,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
> if (idx < 0)
> goto out_free_assoc;
>
> - if (!nvmet_fc_tgtport_get(tgtport))
> - goto out_ida;
> -
> assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle);
> if (IS_ERR(assoc->hostport))
> - goto out_put;
> + goto out_ida;
>
> assoc->tgtport = tgtport;
> assoc->a_id = idx;
> @@ -1145,8 +1142,6 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
>
> return assoc;
>
> -out_put:
> - nvmet_fc_tgtport_put(tgtport);
> out_ida:
> ida_simple_remove(&tgtport->assoc_cnt, idx);
> out_free_assoc:
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc
2024-02-18 19:08 ` Pavel Machek
@ 2024-02-22 12:24 ` Sasha Levin
0 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-22 12:24 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, stable, Daniel Wagner, Hannes Reinecke,
Christoph Hellwig, Keith Busch, james.smart, sagi, kch,
linux-nvme
On Sun, Feb 18, 2024 at 08:08:51PM +0100, Pavel Machek wrote:
>Hi!
>
>> From: Daniel Wagner <dwagner@suse.de>
>>
>> [ Upstream commit 1c110588dd95d21782397ff3cbaa55820b4e1fad ]
>>
>> The association life time is tied to the life time of the target port.
>> That means we should not take extra a refcount when creating a
>> association.
>
>I don't see this one queued for 6.1 or 6.6. What went wrong here?
Yup, this should have been dropped from all trees. Thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH AUTOSEL 5.10 14/16] nvmet-fc: abort command when there is no binding
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (11 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 13/16] nvmet-fc: do not tack refs on tgtports from assoc Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 15/16] ext4: correct the hole length returned by ext4_map_blocks() Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 16/16] Input: i8042 - add Fujitsu Lifebook U728 to i8042 quirk table Sasha Levin
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Daniel Wagner, Hannes Reinecke, Christoph Hellwig, Keith Busch,
Sasha Levin, james.smart, sagi, kch, linux-nvme
From: Daniel Wagner <dwagner@suse.de>
[ Upstream commit 3146345c2e9c2f661527054e402b0cfad80105a4 ]
When the target port has not active port binding, there is no point in
trying to process the command as it has to fail anyway. Instead adding
checks to all commands abort the command early.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/fc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index ebbc513682e1..6bdf9235b14d 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1102,6 +1102,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
int idx;
bool needrandom = true;
+ if (!tgtport->pe)
+ return NULL;
+
assoc = kzalloc(sizeof(*assoc), GFP_KERNEL);
if (!assoc)
return NULL;
@@ -2524,8 +2527,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
fod->req.cmd = &fod->cmdiubuf.sqe;
fod->req.cqe = &fod->rspiubuf.cqe;
- if (tgtport->pe)
- fod->req.port = tgtport->pe->port;
+ if (!tgtport->pe)
+ goto transport_error;
+ fod->req.port = tgtport->pe->port;
/* clear any response payload */
memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf));
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 15/16] ext4: correct the hole length returned by ext4_map_blocks()
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (12 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 14/16] nvmet-fc: abort command when there is no binding Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 16/16] Input: i8042 - add Fujitsu Lifebook U728 to i8042 quirk table Sasha Levin
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Zhang Yi, Jan Kara, Theodore Ts'o, Sasha Levin,
adilger.kernel, linux-ext4
From: Zhang Yi <yi.zhang@huawei.com>
[ Upstream commit 6430dea07e85958fa87d0276c0c4388dd51e630b ]
In ext4_map_blocks(), if we can't find a range of mapping in the
extents cache, we are calling ext4_ext_map_blocks() to search the real
path and ext4_ext_determine_hole() to determine the hole range. But if
the querying range was partially or completely overlaped by a delalloc
extent, we can't find it in the real extent path, so the returned hole
length could be incorrect.
Fortunately, ext4_ext_put_gap_in_cache() have already handle delalloc
extent, but it searches start from the expanded hole_start, doesn't
start from the querying range, so the delalloc extent found could not be
the one that overlaped the querying range, plus, it also didn't adjust
the hole length. Let's just remove ext4_ext_put_gap_in_cache(), handle
delalloc and insert adjusted hole extent in ext4_ext_determine_hole().
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240127015825.1608160-4-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/extents.c | 111 +++++++++++++++++++++++++++++-----------------
1 file changed, 70 insertions(+), 41 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 193b13630ac1..68aa8760cb46 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2222,7 +2222,7 @@ static int ext4_fill_es_cache_info(struct inode *inode,
/*
- * ext4_ext_determine_hole - determine hole around given block
+ * ext4_ext_find_hole - find hole around given block according to the given path
* @inode: inode we lookup in
* @path: path in extent tree to @lblk
* @lblk: pointer to logical block around which we want to determine hole
@@ -2234,9 +2234,9 @@ static int ext4_fill_es_cache_info(struct inode *inode,
* The function returns the length of a hole starting at @lblk. We update @lblk
* to the beginning of the hole if we managed to find it.
*/
-static ext4_lblk_t ext4_ext_determine_hole(struct inode *inode,
- struct ext4_ext_path *path,
- ext4_lblk_t *lblk)
+static ext4_lblk_t ext4_ext_find_hole(struct inode *inode,
+ struct ext4_ext_path *path,
+ ext4_lblk_t *lblk)
{
int depth = ext_depth(inode);
struct ext4_extent *ex;
@@ -2263,30 +2263,6 @@ static ext4_lblk_t ext4_ext_determine_hole(struct inode *inode,
return len;
}
-/*
- * ext4_ext_put_gap_in_cache:
- * calculate boundaries of the gap that the requested block fits into
- * and cache this gap
- */
-static void
-ext4_ext_put_gap_in_cache(struct inode *inode, ext4_lblk_t hole_start,
- ext4_lblk_t hole_len)
-{
- struct extent_status es;
-
- ext4_es_find_extent_range(inode, &ext4_es_is_delayed, hole_start,
- hole_start + hole_len - 1, &es);
- if (es.es_len) {
- /* There's delayed extent containing lblock? */
- if (es.es_lblk <= hole_start)
- return;
- hole_len = min(es.es_lblk - hole_start, hole_len);
- }
- ext_debug(inode, " -> %u:%u\n", hole_start, hole_len);
- ext4_es_insert_extent(inode, hole_start, hole_len, ~0,
- EXTENT_STATUS_HOLE);
-}
-
/*
* ext4_ext_rm_idx:
* removes index from the index block.
@@ -4058,6 +4034,69 @@ static int get_implied_cluster_alloc(struct super_block *sb,
return 0;
}
+/*
+ * Determine hole length around the given logical block, first try to
+ * locate and expand the hole from the given @path, and then adjust it
+ * if it's partially or completely converted to delayed extents, insert
+ * it into the extent cache tree if it's indeed a hole, finally return
+ * the length of the determined extent.
+ */
+static ext4_lblk_t ext4_ext_determine_insert_hole(struct inode *inode,
+ struct ext4_ext_path *path,
+ ext4_lblk_t lblk)
+{
+ ext4_lblk_t hole_start, len;
+ struct extent_status es;
+
+ hole_start = lblk;
+ len = ext4_ext_find_hole(inode, path, &hole_start);
+again:
+ ext4_es_find_extent_range(inode, &ext4_es_is_delayed, hole_start,
+ hole_start + len - 1, &es);
+ if (!es.es_len)
+ goto insert_hole;
+
+ /*
+ * There's a delalloc extent in the hole, handle it if the delalloc
+ * extent is in front of, behind and straddle the queried range.
+ */
+ if (lblk >= es.es_lblk + es.es_len) {
+ /*
+ * The delalloc extent is in front of the queried range,
+ * find again from the queried start block.
+ */
+ len -= lblk - hole_start;
+ hole_start = lblk;
+ goto again;
+ } else if (in_range(lblk, es.es_lblk, es.es_len)) {
+ /*
+ * The delalloc extent containing lblk, it must have been
+ * added after ext4_map_blocks() checked the extent status
+ * tree, adjust the length to the delalloc extent's after
+ * lblk.
+ */
+ len = es.es_lblk + es.es_len - lblk;
+ return len;
+ } else {
+ /*
+ * The delalloc extent is partially or completely behind
+ * the queried range, update hole length until the
+ * beginning of the delalloc extent.
+ */
+ len = min(es.es_lblk - hole_start, len);
+ }
+
+insert_hole:
+ /* Put just found gap into cache to speed up subsequent requests */
+ ext_debug(inode, " -> %u:%u\n", hole_start, len);
+ ext4_es_insert_extent(inode, hole_start, len, ~0, EXTENT_STATUS_HOLE);
+
+ /* Update hole_len to reflect hole size after lblk */
+ if (hole_start != lblk)
+ len -= lblk - hole_start;
+
+ return len;
+}
/*
* Block allocation/map/preallocation routine for extents based files
@@ -4175,22 +4214,12 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
* we couldn't try to create block if create flag is zero
*/
if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
- ext4_lblk_t hole_start, hole_len;
+ ext4_lblk_t len;
- hole_start = map->m_lblk;
- hole_len = ext4_ext_determine_hole(inode, path, &hole_start);
- /*
- * put just found gap into cache to speed up
- * subsequent requests
- */
- ext4_ext_put_gap_in_cache(inode, hole_start, hole_len);
+ len = ext4_ext_determine_insert_hole(inode, path, map->m_lblk);
- /* Update hole_len to reflect hole size after map->m_lblk */
- if (hole_start != map->m_lblk)
- hole_len -= map->m_lblk - hole_start;
map->m_pblk = 0;
- map->m_len = min_t(unsigned int, map->m_len, hole_len);
-
+ map->m_len = min_t(unsigned int, map->m_len, len);
goto out;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH AUTOSEL 5.10 16/16] Input: i8042 - add Fujitsu Lifebook U728 to i8042 quirk table
2024-02-07 21:26 [PATCH AUTOSEL 5.10 01/16] ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() Sasha Levin
` (13 preceding siblings ...)
2024-02-07 21:26 ` [PATCH AUTOSEL 5.10 15/16] ext4: correct the hole length returned by ext4_map_blocks() Sasha Levin
@ 2024-02-07 21:26 ` Sasha Levin
14 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2024-02-07 21:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Szilard Fabian, Dmitry Torokhov, Sasha Levin, wse, eshimanovich,
jdenose, linux-input
From: Szilard Fabian <szfabian@bluemarch.art>
[ Upstream commit 4255447ad34c5c3785fcdcf76cfa0271d6e5ed39 ]
Another Fujitsu-related patch.
In the initial boot stage the integrated keyboard of Fujitsu Lifebook U728
refuses to work and it's not possible to type for example a dm-crypt
passphrase without the help of an external keyboard.
i8042.nomux kernel parameter resolves this issue but using that a PS/2
mouse is detected. This input device is unused even when the i2c-hid-acpi
kernel module is blacklisted making the integrated ELAN touchpad
(04F3:3092) not working at all.
So this notebook uses a hid-over-i2c touchpad which is managed by the
i2c_designware input driver. Since you can't find a PS/2 mouse port on this
computer and you can't connect a PS/2 mouse to it even with an official
port replicator I think it's safe to not use the PS/2 mouse port at all.
Signed-off-by: Szilard Fabian <szfabian@bluemarch.art>
Link: https://lore.kernel.org/r/20240103014717.127307-2-szfabian@bluemarch.art
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/input/serio/i8042-acpipnpio.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index 124ab98ea43a..816711771ffd 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -625,6 +625,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
},
.driver_data = (void *)(SERIO_QUIRK_NOAUX)
},
+ {
+ /* Fujitsu Lifebook U728 */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U728"),
+ },
+ .driver_data = (void *)(SERIO_QUIRK_NOAUX)
+ },
{
/* Gigabyte M912 */
.matches = {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread