6.3.10-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 141/199 selftests: forwarding: Fix race condition in mirror installation
In reply to Greg Kroah-HartmanFrom: Danielle Ratson <[email protected]>
[ Upstream commit c7c059fba6fb19c3bc924925c984772e733cb594 ]
When mirroring to a gretap in hardware the device expects to be programmed with the egress port and all the encapsulating headers. This requires the driver to resolve the path the packet will take in the software data path and program the device accordingly.
If the path cannot be resolved (in this case because of an unresolved neighbor), then mirror installation fails until the path is resolved. This results in a race that causes the test to sometimes fail.
Fix this by setting the neighbor's state to permanent in a couple of tests, so that it is always valid.
--- .../testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh | 4 ++++ .../testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh | 4 ++++ 2 files changed, 8 insertions(+)
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d.sh +4 -0
@@ -93,12 +93,16 @@ cleanup() test_gretap() { + ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap" full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" } test_ip6gretap() { + ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \ + nud permanent dev br2 full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap" full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap" }
tools/testing/selftests/net/forwarding/mirror_gre_bridge_1q.sh +4 -0
@@ -90,12 +90,16 @@ cleanup() test_gretap() { + ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \ + nud permanent dev br1 full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap" full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap" } test_ip6gretap() { + ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \ + nud permanent dev br1 full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap" full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap" }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 142/199 platform/x86/amd/pmf: Register notify handler only if SPS is enabled
In reply to Greg Kroah-HartmanFrom: Shyam Sundar S K <[email protected]>
[ Upstream commit 146b6f6855e7656e8329910606595220c761daac ]
Power source notify handler is getting registered even when none of the PMF feature in enabled leading to a crash.
...
[ 22.592162] Call Trace: [ 22.592164] <TASK> [ 22.592164] ? rcu_note_context_switch+0x5e0/0x660 [ 22.592166] ? __warn+0x81/0x130 [ 22.592171] ? rcu_note_context_switch+0x5e0/0x660 [ 22.592172] ? report_bug+0x171/0x1a0 [ 22.592175] ? prb_read_valid+0x1b/0x30 [ 22.592177] ? handle_bug+0x3c/0x80 [ 22.592178] ? exc_invalid_op+0x17/0x70 [ 22.592179] ? asm_exc_invalid_op+0x1a/0x20 [ 22.592182] ? rcu_note_context_switch+0x5e0/0x660 [ 22.592183] ? acpi_ut_delete_object_desc+0x86/0xb0 [ 22.592186] ? acpi_ut_update_ref_count.part.0+0x22d/0x930 [ 22.592187] __schedule+0xc0/0x1410 [ 22.592189] ? ktime_get+0x3c/0xa0 [ 22.592191] ? lapic_next_event+0x1d/0x30 [ 22.592193] ? hrtimer_start_range_ns+0x25b/0x350 [ 22.592196] schedule+0x5e/0xd0 [ 22.592197] schedule_hrtimeout_range_clock+0xbe/0x140 [ 22.592199] ? __pfx_hrtimer_wakeup+0x10/0x10 [ 22.592200] usleep_range_state+0x64/0x90 [ 22.592203] amd_pmf_send_cmd+0x106/0x2a0 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616] [ 22.592207] amd_pmf_update_slider+0x56/0x1b0 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616] [ 22.592210] amd_pmf_set_sps_power_limits+0x72/0x80 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616] [ 22.592213] amd_pmf_pwr_src_notify_call+0x49/0x90 [amd_pmf bddfe0fe3712aaa99acce3d5487405c5213c6616] [ 22.592216] notifier_call_chain+0x5a/0xd0 [ 22.592218] atomic_notifier_call_chain+0x32/0x50
...
Fix this by moving the registration of source change notify handler only when SPS(Static Slider) is advertised as supported.
--- drivers/platform/x86/amd/pmf/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/platform/x86/amd/pmf/core.c +5 -5
@@ -297,6 +297,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)/* Enable Static Slider */ if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR )) {amd_pmf_init_sps (dev); + dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call; +power_supply_reg_notifier (&dev->pwr_src_notifier);dev_dbg (dev->dev,"SPS enabled and Platform Profiles registered\n" ); }
@@ -315,8 +317,10 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)static void amd_pmf_deinit_features (struct amd_pmf_dev *dev) { -if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR )) +if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR )) { +power_supply_unreg_notifier (&dev->pwr_src_notifier);amd_pmf_deinit_sps (dev); + }if (is_apmf_func_supported (dev,APMF_FUNC_AUTO_MODE )) {amd_pmf_deinit_auto_mode (dev);
@@ -399,9 +403,6 @@ static int amd_pmf_probe(struct platform_device *pdev)apmf_install_handler (dev);amd_pmf_dbgfs_register (dev); - dev->pwr_src_notifier.notifier_call = amd_pmf_pwr_src_notify_call; -power_supply_reg_notifier (&dev->pwr_src_notifier); -dev_info (dev->dev,"registered PMF device successfully\n" );return 0 ;
@@ -411,7 +412,6 @@ static int amd_pmf_remove(struct platform_device *pdev) {struct amd_pmf_dev *dev =platform_get_drvdata (pdev); -power_supply_unreg_notifier (&dev->pwr_src_notifier);amd_pmf_deinit_features (dev);apmf_acpi_deinit (dev);amd_pmf_dbgfs_unregister (dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 143/199 sch_netem: acquire qdisc lock in netem_change()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 2174a08db80d1efeea382e25ac41c4e7511eb6d6 ]
syzbot managed to trigger a divide error [1] in netem.
It could happen if q->rate changes while netem_enqueue() is running, since q->rate is read twice.
It turns out netem_change() always lacked proper synchronization.
[1]
divide error: 0000 [#1] SMP KASAN
CPU: 1 PID: 7867 Comm: syz-executor.1 Not tainted 6.1.30-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 RIP: 0010:div64_u64 include/linux/math64.h:69 [inline] RIP: 0010:packet_time_ns net/sched/sch_netem.c:357 [inline] RIP: 0010:netem_enqueue+0x2067/0x36d0 net/sched/sch_netem.c:576 Code: 89 e2 48 69 da 00 ca 9a 3b 42 80 3c 28 00 4c 8b a4 24 88 00 00 00 74 0d 4c 89 e7 e8 c3 4f 3b fd 48 8b 4c 24 18 48 89 d8 31 d2 <49> f7 34 24 49 01 c7 4c 8b 64 24 48 4d 01 f7 4c 89 e3 48 c1 eb 03 RSP: 0018:ffffc9000dccea60 EFLAGS: 00010246 RAX: 000001a442624200 RBX: 000001a442624200 RCX: ffff888108a4f000 RDX: 0000000000000000 RSI: 000000000000070d RDI: 000000000000070d RBP: ffffc9000dcceb90 R08: ffffffff849c5e26 R09: fffffbfff10e1297 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888108a4f358 R13: dffffc0000000000 R14: 0000001a8cd9a7ec R15: 0000000000000000 FS: 00007fa73fe18700(0000) GS:ffff8881f6b00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fa73fdf7718 CR3: 000000011d36e000 CR4: 0000000000350ee0 Call Trace: <TASK> [<ffffffff84714385>] __dev_xmit_skb net/core/dev.c:3931 [inline] [<ffffffff84714385>] __dev_queue_xmit+0xcf5/0x3370 net/core/dev.c:4290 [<ffffffff84d22df2>] dev_queue_xmit include/linux/netdevice.h:3030 [inline] [<ffffffff84d22df2>] neigh_hh_output include/net/neighbour.h:531 [inline] [<ffffffff84d22df2>] neigh_output include/net/neighbour.h:545 [inline] [<ffffffff84d22df2>] ip_finish_output2+0xb92/0x10d0 net/ipv4/ip_output.c:235 [<ffffffff84d21e63>] __ip_finish_output+0xc3/0x2b0 [<ffffffff84d10a81>] ip_finish_output+0x31/0x2a0 net/ipv4/ip_output.c:323 [<ffffffff84d10f14>] NF_HOOK_COND include/linux/netfilter.h:298 [inline] [<ffffffff84d10f14>] ip_output+0x224/0x2a0 net/ipv4/ip_output.c:437 [<ffffffff84d123b5>] dst_output include/net/dst.h:444 [inline] [<ffffffff84d123b5>] ip_local_out net/ipv4/ip_output.c:127 [inline] [<ffffffff84d123b5>] __ip_queue_xmit+0x1425/0x2000 net/ipv4/ip_output.c:542 [<ffffffff84d12fdc>] ip_queue_xmit+0x4c/0x70 net/ipv4/ip_output.c:556
--- net/sched/sch_netem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/sch_netem.c +6 -2
@@ -966,6 +966,7 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt,if (ret <0 )return ret; +sch_tree_lock (sch);/* backup q->clg and q->loss_model */ old_clg = q->clg; old_loss_model = q->loss_model;
@@ -974,7 +975,7 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, ret =get_loss_clg (q, tb[TCA_NETEM_LOSS ]);if (ret) { q->loss_model = old_loss_model; -return ret; + goto unlock; } }else { q->loss_model =CLG_RANDOM ;
@@ -1041,6 +1042,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt,/* capping jitter to the range acceptable by tabledist() */ q->jitter =min_t (s64,abs (q->jitter),INT_MAX ); +unlock: +sch_tree_unlock (sch);return ret; get_table_failure:
@@ -1050,7 +1053,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt,*/ q->clg = old_clg; q->loss_model = old_loss_model; -return ret; + + goto unlock; } static int netem_init(struct Qdisc *sch, struct nlattr *opt,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 144/199 revert "net: align SO_RCVMARK required privileges with SO_MARK"
In reply to Greg Kroah-HartmanFrom: Maciej Żenczykowski <[email protected]>
[ Upstream commit a9628e88776eb7d045cf46467f1afdd0f7fe72ea ]
This reverts commit 1f86123b9749 ("net: align SO_RCVMARK required privileges with SO_MARK") because the reasoning in the commit message is not really correct:
SO_RCVMARK is used for 'reading' incoming skb mark (via cmsg), as such it is more equivalent to 'getsockopt(SO_MARK)' which has no priv check and retrieves the socket mark, rather than 'setsockopt(SO_MARK) which sets the socket mark and does require privs.
Additionally incoming skb->mark may already be visible if sysctl_fwmark_reflect and/or sysctl_tcp_fwmark_accept are enabled.
Furthermore, it is easier to block the getsockopt via bpf (either cgroup setsockopt hook, or via syscall filters) then to unblock it if it requires CAP_NET_RAW/ADMIN.
On Android the socket mark is (among other things) used to store the network identifier a socket is bound to. Setting it is privileged, but retrieving it is not. We'd like unprivileged userspace to be able to read the network id of incoming packets (where mark is set via iptables [to be moved to bpf])...
An alternative would be to add another sysctl to control whether setting SO_RCVMARK is privilged or not.
(or even a MASK of which bits in the mark can be exposed) But this seems like over-engineering...
Note: This is a non-trivial revert, due to later merged commit e42c7beee71d ("bpf: net: Consider has_current_bpf_ctx() when testing capable() in sk_setsockopt()") which changed both 'ns_capable' into 'sockopt_ns_capable' calls.
--- net/core/sock.c | 6 ------ 1 file changed, 6 deletions(-)
net/core/sock.c +0 -6
@@ -1362,12 +1362,6 @@ int sk_setsockopt(struct sock *sk, int level, int optname,__sock_set_mark (sk, val);break ;case SO_RCVMARK : -if (!sockopt_ns_capable (sock_net (sk)->user_ns,CAP_NET_RAW ) && - !sockopt_ns_capable (sock_net (sk)->user_ns,CAP_NET_ADMIN )) { - ret = -EPERM ; -break ; - } -sock_valbool_flag (sk,SOCK_RCVMARK , valbool);break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 145/199 arm64: dts: rockchip: fix nEXTRST on SOQuartz
In reply to Greg Kroah-HartmanFrom: Nicolas Frattaroli <[email protected]>
[ Upstream commit cf9ae4a0077496e8224d68fc88e3df13dd7e5f37 ]
In pre-production prototypes (of which I only know one person having one, Peter Geis), GPIO0 pin A5 was tied to the SDMMC power enable pin on the CM4 connector. On all production models, this is not the case; instead, this pin is used for the nEXTRST signal, and the SDMMC power enable pin is always pulled high.
Since everyone currently using the SOQuartz device trees will want this change, it is made to the tree without splitting the trees into two separate ones of which users will then inevitably choose the wrong one.
This fixes USB and PCIe on a wide variety of CM4IO-compatible boards which use the nEXTRST signal.
--- .../boot/dts/rockchip/rk3566-soquartz-cm4.dts | 18 +++++++----- .../boot/dts/rockchip/rk3566-soquartz.dtsi | 29 +++++++++---------- 2 files changed, 24 insertions(+), 23 deletions(-)
arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts +11 -7
@@ -28,6 +28,16 @@ regulator-max-microvolt = <5000000>; vin-supply = <&vcc12v_dcin>; }; + + vcc_sd_pwr: vcc-sd-pwr-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_sd_pwr"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; }; /* phy for pcie */
@@ -130,13 +140,7 @@ }; &sdmmc0 { - vmmc-supply = <&sdmmc_pwr>; - status = "okay"; -}; - -&sdmmc_pwr { - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; + vmmc-supply = <&vcc_sd_pwr>; status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3566-soquartz.dtsi +13 -16
@@ -104,16 +104,6 @@ regulator-max-microvolt = <3300000>; vin-supply = <&vcc5v0_sys>; }; - - sdmmc_pwr: sdmmc-pwr-regulator { - compatible = "regulator-fixed"; - enable-active-high; - gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&sdmmc_pwr_h>; - regulator-name = "sdmmc_pwr"; - status = "disabled"; - }; }; &cpu0 {
@@ -155,6 +145,19 @@ status = "disabled"; }; +&gpio0 { + nextrst-hog { + gpio-hog; + /* + * GPIO_ACTIVE_LOW + output-low here means that the pin is set + * to high, because output-low decides the value pre-inversion. + */ + gpios = <RK_PA5 GPIO_ACTIVE_LOW>; + line-name = "nEXTRST"; + output-low; + }; +}; + &gpu { mali-supply = <&vdd_gpu>; status = "okay";
@@ -538,12 +541,6 @@ rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; }; }; - - sdmmc-pwr { - sdmmc_pwr_h: sdmmc-pwr-h { - rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; - }; - }; }; &pmu_io_domains {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 146/199 gpiolib: Fix GPIO chip IRQ initialization restriction
In reply to Greg Kroah-HartmanFrom: Jiawen Wu <[email protected]>
[ Upstream commit 8c00914e5438e3636f26b4f814b3297ae2a1b9ee ]
In case of gpio-regmap, IRQ chip is added by regmap-irq and associated with GPIO chip by gpiochip_irqchip_add_domain(). The initialization flag was not added in gpiochip_irqchip_add_domain(), causing gpiochip_to_irq() to return -EPROBE_DEFER.
--- drivers/gpio/gpiolib.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpiolib.c +8 -0
@@ -1763,6 +1763,14 @@ int gpiochip_irqchip_add_domain(struct gpio_chip *gc, gc->to_irq = gpiochip_to_irq; gc->irq.domain = domain; +/* +* Using barrier() here to prevent compiler from reordering +* gc->irq.initialized before adding irqdomain. +*/ +barrier (); + + gc->irq.initialized = true; +return 0 ; }EXPORT_SYMBOL_GPL (gpiochip_irqchip_add_domain);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 147/199 gpio: sifive: add missing check for platform_get_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit c1bcb976d8feb107ff2c12caaf12ac5e70f44d5f ]
Add the missing check for platform_get_irq() and return error code if it fails.
The returned error code will be dealed with in builtin_platform_driver(sifive_gpio_driver) and the driver will not be registered.
--- drivers/gpio/gpio-sifive.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpio/gpio-sifive.c +6 -2
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)return -ENODEV ; } -for (i =0 ; i < ngpio; i++) - chip->irq_number[i] =platform_get_irq (pdev, i); +for (i =0 ; i < ngpio; i++) { + ret =platform_get_irq (pdev, i); +if (ret <0 ) +return ret; + chip->irq_number[i] = ret; + } ret = bgpio_init(&chip->gc, dev, 4, chip->base + SIFIVE_GPIO_INPUT_VAL,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 148/199 iommu/amd: Fix possible memory leak of domain
In reply to Greg Kroah-HartmanFrom: Su Hui <[email protected]>
[ Upstream commit 5b00369fcf6d1ff9050b94800dc596925ff3623f ]
Move allocation code down to avoid memory leak.
--- drivers/iommu/amd/iommu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/amd/iommu.c +4 -4
@@ -2069,10 +2069,6 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)int mode =DEFAULT_PGTABLE_LEVEL ;int ret; - domain =kzalloc (sizeof (*domain),GFP_KERNEL ); -if (!domain) -return NULL ; -/* * Force IOMMU v1 page table when iommu=pt and * when allocating domain for pass-through devices.
@@ -2088,6 +2084,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)return NULL ; } + domain =kzalloc (sizeof (*domain),GFP_KERNEL ); +if (!domain) +return NULL ; +switch (pgtable) {case AMD_IOMMU_V1 : ret =protection_domain_init_v1 (domain, mode);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 149/199 gpiolib: Fix irq_domain resource tracking for gpiochip_irqchip_add_domain()
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit ff7a1790fbf92f1bdd0966d3f0da3ea808ede876 ]
Up until commit 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()") all irq_domains were allocated by gpiolib itself and thus gpiolib also takes care of freeing it.
With gpiochip_irqchip_add_domain() a user of gpiolib can associate an irq_domain with the gpio_chip. This irq_domain is not managed by gpiolib and therefore must not be freed by gpiolib.
--- drivers/gpio/gpiolib.c | 3 ++- include/linux/gpio/driver.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib.c +2 -1
@@ -1716,7 +1716,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gc) }/* Remove all IRQ mappings and delete the domain */ -if (gc->irq.domain) { +if (!gc->irq.domain_is_allocated_externally && gc->irq.domain) {unsigned int irq;for (offset =0 ; offset < gc->ngpio; offset++) {
@@ -1762,6 +1762,7 @@ int gpiochip_irqchip_add_domain(struct gpio_chip *gc, gc->to_irq = gpiochip_to_irq; gc->irq.domain = domain; + gc->irq.domain_is_allocated_externally = true;/* * Using barrier() here to prevent compiler from reordering
include/linux/gpio/driver.h +8 -0
@@ -244,6 +244,14 @@ struct gpio_irq_chip {*/ bool initialized; +/** +* @domain_is_allocated_externally: +* +* True it the irq_domain was allocated outside of gpiolib, in which +* case gpiolib won't free the irq_domain itself. +*/ +bool domain_is_allocated_externally; +/** * @init_hw: optional routine to initialize hardware before * an IRQ chip will be added. This is quite useful when
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 150/199 scsi: target: iscsi: Fix hang in the iSCSI login code
In reply to Greg Kroah-HartmanFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 13247018d68f21e7132924b9853f7e2c423588b6 ]
If the initiator suddenly stops sending data during a login while keeping the TCP connection open, the login_work won't be scheduled and will never release the login semaphore; concurrent login operations will therefore get stuck and fail.
The bug is due to the inability of the login timeout code to properly handle this particular case.
Fix the problem by replacing the old per-NP login timer with a new per-connection timer.
The timer is started when an initiator connects to the target; if it expires, it sends a SIGINT signal to the thread pointed at by the conn->login_kworker pointer.
conn->login_kworker is set by calling the iscsit_set_login_timer_kworker() helper, initially it will point to the np thread; When the login operation's control is in the process of being passed from the NP-thread to login_work, the conn->login_worker pointer is set to NULL. Finally, login_kworker will be changed to point to the worker thread executing the login_work job.
If conn->login_kworker is NULL when the timer expires, it means that the login operation hasn't been completed yet but login_work isn't running, in this case the timer will mark the login process as failed and will schedule login_work so the latter will be forced to free the resources it holds.
--- drivers/target/iscsi/iscsi_target.c | 2 - drivers/target/iscsi/iscsi_target_login.c | 63 ++------------------ drivers/target/iscsi/iscsi_target_nego.c | 70 +++++++++++++---------- drivers/target/iscsi/iscsi_target_util.c | 51 +++++++++++++++++ drivers/target/iscsi/iscsi_target_util.h | 4 ++ include/target/iscsi/iscsi_target_core.h | 6 +- 6 files changed, 103 insertions(+), 93 deletions(-)
drivers/target/iscsi/iscsi_target.c +0 -2
@@ -363,8 +363,6 @@ struct iscsi_np *iscsit_add_np(init_completion (&np->np_restart_comp);INIT_LIST_HEAD (&np->np_list); -timer_setup (&np->np_login_timer, iscsi_handle_login_thread_timeout,0 ); - ret =iscsi_target_setup_login_socket (np, sockaddr);if (ret !=0 ) {kfree (np);
drivers/target/iscsi/iscsi_target_login.c +5 -58
103 lines not on this page · raw message
drivers/target/iscsi/iscsi_target_nego.c +39 -31
122 lines not on this page · raw message
drivers/target/iscsi/iscsi_target_util.c +51 -0
57 lines not on this page · raw message
drivers/target/iscsi/iscsi_target_util.h +4 -0
@@ -56,6 +56,10 @@ extern void iscsit_handle_nopin_timeout(struct timer_list *t);extern void __iscsit_start_nopin_timer (struct iscsit_conn *);extern void iscsit_start_nopin_timer (struct iscsit_conn *);extern void iscsit_stop_nopin_timer (struct iscsit_conn *); +extern void iscsit_login_timeout (struct timer_list *t); +extern void iscsit_start_login_timer (struct iscsit_conn *,struct task_struct *kthr); +extern void iscsit_stop_login_timer (struct iscsit_conn *); +extern int iscsit_set_login_timer_kworker (struct iscsit_conn *,struct task_struct *kthr);extern int iscsit_send_tx_data (struct iscsit_cmd *,struct iscsit_conn *,int );extern int iscsit_fe_sendpage_sg (struct iscsit_cmd *,struct iscsit_conn *);extern int iscsit_tx_login_rsp (struct iscsit_conn *,u8 ,u8 );
include/target/iscsi/iscsi_target_core.h +4 -2
@@ -562,12 +562,14 @@ struct iscsit_conn {#define LOGIN_FLAGS_READ_ACTIVE 2#define LOGIN_FLAGS_WRITE_ACTIVE 3#define LOGIN_FLAGS_CLOSED 4 +#define LOGIN_FLAGS_WORKER_RUNNING 5unsigned long login_flags;struct delayed_work login_work;struct iscsi_login *login;struct timer_list nopin_timer;struct timer_list nopin_response_timer;struct timer_list transport_timer; +struct timer_list login_timer;struct task_struct *login_kworker;/* Spinlock used for add/deleting cmd's from conn_cmd_list */ spinlock_t cmd_lock;
@@ -576,6 +578,8 @@ struct iscsit_conn {spinlock_t nopin_timer_lock;spinlock_t response_queue_lock;spinlock_t state_lock; +spinlock_t login_timer_lock; +spinlock_t login_worker_lock;/* libcrypto RX and TX contexts for crc32c */ struct ahash_request *conn_rx_hash;struct ahash_request *conn_tx_hash;
@@ -792,7 +796,6 @@ struct iscsi_np {enum np_thread_state_table np_thread_state;bool enabled;atomic_t np_reset_count; -enum iscsi_timer_flags_table np_login_timer_flags;u32 np_exports;enum np_flags_table np_flags;spinlock_t np_thread_lock;
@@ -800,7 +803,6 @@ struct iscsi_np {struct socket *np_socket;struct sockaddr_storage np_sockaddr;struct task_struct *np_thread; -struct timer_list np_login_timer;void *np_context;struct iscsit_transport *np_transport;struct list_head np_list;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 151/199 scsi: target: iscsi: Remove unused transport_timer
In reply to Greg Kroah-HartmanFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 98a8c2bf938a5973716f280da618077a3d255976 ]
--- include/target/iscsi/iscsi_target_core.h | 1 - 1 file changed, 1 deletion(-)
include/target/iscsi/iscsi_target_core.h +0 -1
@@ -568,7 +568,6 @@ struct iscsit_conn {struct iscsi_login *login;struct timer_list nopin_timer;struct timer_list nopin_response_timer; -struct timer_list transport_timer;struct timer_list login_timer;struct task_struct *login_kworker;/* Spinlock used for add/deleting cmd's from conn_cmd_list */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 152/199 scsi: target: iscsi: Prevent login threads from racing between each other
In reply to Greg Kroah-HartmanFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 2a737d3b8c792400118d6cf94958f559de9c5e59 ]
The tpg->np_login_sem is a semaphore that is used to serialize the login process when multiple login threads run concurrently against the same target portal group.
The iscsi_target_locate_portal() function finds the tpg, calls iscsit_access_np() against the np_login_sem semaphore and saves the tpg pointer in conn->tpg;
If iscsi_target_locate_portal() fails, the caller will check for the conn->tpg pointer and, if it's not NULL, then it will assume that iscsi_target_locate_portal() called iscsit_access_np() on the semaphore.
Make sure that conn->tpg gets initialized only if iscsit_access_np() was successful, otherwise iscsit_deaccess_np() may end up being called against a semaphore we never took, allowing more than one thread to access the same tpg.
--- drivers/target/iscsi/iscsi_target_nego.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target_nego.c +3 -1
@@ -1122,6 +1122,7 @@ int iscsi_target_locate_portal(iscsi_target_set_sock_callbacks (conn); login->np = np; + conn->tpg =NULL ; login_req = (struct iscsi_login_req *) login->req; payload_length =ntoh24 (login_req->dlength);
@@ -1189,7 +1190,6 @@ int iscsi_target_locate_portal(*/ sessiontype =strncmp (s_buf,DISCOVERY ,9 );if (!sessiontype) { - conn->tpg = iscsit_global->discovery_tpg;if (!login->leading_connection) goto get_target;
@@ -1206,9 +1206,11 @@ int iscsi_target_locate_portal(* Serialize access across the discovery struct iscsi_portal_group to * process login attempt. */ + conn->tpg = iscsit_global->discovery_tpg;if (iscsit_access_np (np, conn->tpg) <0 ) {iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR ,ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE ); + conn->tpg =NULL ; ret =-1 ; goto out; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 153/199 HID: wacom: Add error check to wacom_parse_and_register()
In reply to Greg Kroah-HartmanFrom: Denis Arefev <[email protected]>
[ Upstream commit 16a9c24f24fbe4564284eb575b18cc20586b9270 ]
Added a variable check and
transition in case of an error
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hid/wacom_sys.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +6 -1
@@ -2417,8 +2417,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless) goto fail_quirks; } -if (features->device_type &WACOM_DEVICETYPE_WL_MONITOR ) +if (features->device_type &WACOM_DEVICETYPE_WL_MONITOR ) { error =hid_hw_open (hdev); +if (error) { +hid_err (hdev,"hw open failed\n" ); + goto fail_quirks; + } + }wacom_set_shared_values (wacom_wac);devres_close_group (&hdev->dev, wacom);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 154/199 arm64: Add missing Set/Way CMO encodings
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 8d0f019e4c4f2ee2de81efd9bf1c27e9fb3c0460 ]
Add the missing Set/Way CMOs that apply to tagged memory.
--- arch/arm64/include/asm/sysreg.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/include/asm/sysreg.h +6 -0
@@ -115,8 +115,14 @@#define SB_BARRIER_INSN __SYS_BARRIER_INSN(0, 7, 31)#define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2) +#define SYS_DC_IGSW sys_insn(1, 0, 7, 6, 4) +#define SYS_DC_IGDSW sys_insn(1, 0, 7, 6, 6)#define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2) +#define SYS_DC_CGSW sys_insn(1, 0, 7, 10, 4) +#define SYS_DC_CGDSW sys_insn(1, 0, 7, 10, 6)#define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2) +#define SYS_DC_CIGSW sys_insn(1, 0, 7, 14, 4) +#define SYS_DC_CIGDSW sys_insn(1, 0, 7, 14, 6)/* * Automatically generated definitions for system registers, the
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 155/199 smb3: missing null check in SMB2_change_notify
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit b535cc796a4b4942cd189652588e8d37c1f5925a ]
If plen is null when passed in, we only checked for null in one of the two places where it could be used. Although plen is always valid (not null) for current callers of the SMB2_change_notify function, this change makes it more consistent.
--- fs/cifs/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2pdu.c +1 -1
@@ -3777,7 +3777,7 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,if (*out_data ==NULL ) { rc = -ENOMEM ; goto cnotify_exit; - }else + }else if (plen) *plen =le32_to_cpu (smb_rsp->OutputBufferLength); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 156/199 media: cec: core: disable adapter in cec_devnode_unregister
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit fe4526d99e2e06b08bb80316c3a596ea6a807b75 ]
Explicitly disable the CEC adapter in cec_devnode_unregister()
Usually this does not really do anything important, but for drivers that use the CEC pin framework this is needed to properly stop the hrtimer. Without this a crash would happen when such a driver is unloaded with rmmod.
--- drivers/media/cec/core/cec-adap.c | 5 ++++- drivers/media/cec/core/cec-core.c | 2 ++ drivers/media/cec/core/cec-priv.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/media/cec/core/cec-adap.c +4 -1
@@ -1582,7 +1582,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)* * This function is called with adap->lock held. */ -static int cec_adap_enable (struct cec_adapter *adap) +int cec_adap_enable (struct cec_adapter *adap) {bool enable;int ret =0 ;
@@ -1592,6 +1592,9 @@ static int cec_adap_enable(struct cec_adapter *adap)if (adap->needs_hpd) enable = enable && adap->phys_addr !=CEC_PHYS_ADDR_INVALID ; +if (adap->devnode.unregistered) + enable = false; +if (enable == adap->is_enabled)return 0 ;
drivers/media/cec/core/cec-core.c +2 -0
@@ -191,6 +191,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap)mutex_lock (&adap->lock);__cec_s_phys_addr (adap,CEC_PHYS_ADDR_INVALID , false);__cec_s_log_addrs (adap,NULL , false); +// Disable the adapter (since adap->devnode.unregistered is true) +cec_adap_enable (adap);mutex_unlock (&adap->lock);cdev_device_del (&devnode->cdev, &devnode->dev);
drivers/media/cec/core/cec-priv.h +1 -0
@@ -47,6 +47,7 @@ int cec_monitor_pin_cnt_inc(struct cec_adapter *adap);void cec_monitor_pin_cnt_dec (struct cec_adapter *adap);int cec_adap_status (struct seq_file *file,void *priv);int cec_thread_func (void *_adap); +int cec_adap_enable (struct cec_adapter *adap);void __cec_s_phys_addr (struct cec_adapter *adap,u16 phys_addr,bool block);int __cec_s_log_addrs (struct cec_adapter *adap,struct cec_log_addrs *log_addrs,bool block);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 157/199 media: cec: core: dont set last_initiator if tx in progress
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 73af6c7511038249cad3d5f3b44bf8d78ac0f499 ]
When a message was received the last_initiator is set to 0xff. This will force the signal free time for the next transmit to that for a new initiator. However, if a new transmit is already in progress, then don't set last_initiator, since that's the initiator of the current transmit. Overwriting this would cause the signal free time of a following transmit to be that of the new initiator instead of a next transmit.
--- drivers/media/cec/core/cec-adap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/cec/core/cec-adap.c +2 -1
@@ -1090,7 +1090,8 @@ void cec_received_msg_ts(struct cec_adapter *adap,mutex_lock (&adap->lock);dprintk (2 ,"%s: %*ph\n" , __func__, msg->len, msg->msg); - adap->last_initiator =0xff ; +if (!adap->transmit_in_progress) + adap->last_initiator =0xff ;/* Check if this message was for us (directed or broadcast). */ if (!cec_msg_is_broadcast (msg))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 158/199 nfcsim.c: Fix error checking for debugfs_create_dir
In reply to Greg Kroah-HartmanFrom: Osama Muhammad <[email protected]>
[ Upstream commit 9b9e46aa07273ceb96866b2e812b46f1ee0b8d2f ]
This patch fixes the error checking in nfcsim.c. The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.
--- drivers/nfc/nfcsim.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/nfc/nfcsim.c +0 -4
@@ -336,10 +336,6 @@ static struct dentry *nfcsim_debugfs_root;static void nfcsim_debugfs_init (void ) { nfcsim_debugfs_root =debugfs_create_dir ("nfcsim" ,NULL ); - -if (!nfcsim_debugfs_root) -pr_err ("Could not create debugfs entry\n" ); - }static void nfcsim_debugfs_remove (void )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 159/199 btrfs: fix an uninitialized variable warning in btrfs_log_inode
In reply to Greg Kroah-HartmanFrom: Shida Zhang <[email protected]>
[ Upstream commit 8fd9f4232d8152c650fd15127f533a0f6d0a4b2b ]
This fixes the following warning reported by gcc 10.2.1 under x86_64:
../fs/btrfs/tree-log.c: In function ‘btrfs_log_inode’:../fs/btrfs/tree-log.c:6211:9: error: ‘last_range_start’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
6211 | ret = insert_dir_log_key(trans, log, path, key.objectid,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6212 | first_dir_index, last_dir_index);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../fs/btrfs/tree-log.c:6161:6: note: ‘last_range_start’ was declared here
6161 | u64 last_range_start;
| ^~~~~~~~~~~~~~~~This might be a false positive fixed in later compiler versions but we want to have it fixed.
--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-log.c +1 -1
@@ -6163,7 +6163,7 @@ static int log_delayed_deletions_incremental(struct btrfs_trans_handle *trans, {struct btrfs_root *log = inode->root->log_root;const struct btrfs_delayed_item *curr; -u64 last_range_start; +u64 last_range_start =0 ;u64 last_range_end =0 ;struct btrfs_key key;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 160/199 usb: gadget: udc: fix NULL dereference in remove()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 016da9c65fec9f0e78c4909ed9a0f2d567af6775 ]
The "udc" pointer was never set in the probe() function so it will lead to a NULL dereference in udc_pci_remove() when we do:
usb_del_gadget_udc(&udc->gadget);
--- drivers/usb/gadget/udc/amd5536udc_pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/gadget/udc/amd5536udc_pci.c +3 -0
@@ -170,6 +170,9 @@ static int udc_pci_probe( retval = -ENODEV ; goto err_probe; } + + udc = dev; +return 0 ; err_probe:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 161/199 nvme: fix miss command type check
In reply to Greg Kroah-HartmanFrom: min15.li <[email protected]>
[ Upstream commit 31a5978243d24d77be4bacca56c78a0fbc43b00d ]
In the function nvme_passthru_end(), only the value of the command opcode is checked, without checking the command type (IO command or Admin command). When we send a Dataset Management command (The opcode of the Dataset Management command is the same as the Set Feature command), kernel thinks it is a set feature command, then sets the controller's keep alive interval, and calls nvme_keep_alive_work().
--- drivers/nvme/host/core.c | 4 +++- drivers/nvme/host/ioctl.c | 2 +- drivers/nvme/host/nvme.h | 2 +- drivers/nvme/target/passthru.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +3 -1
@@ -1115,7 +1115,7 @@ u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode) }EXPORT_SYMBOL_NS_GPL (nvme_passthru_start,NVME_TARGET_PASSTHRU ); -void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +void nvme_passthru_end (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u32 effects,struct nvme_command *cmd,int status) {if (effects &NVME_CMD_EFFECTS_CSE_MASK ) {
@@ -1132,6 +1132,8 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,nvme_queue_scan (ctrl);flush_work (&ctrl->scan_work); } +if (ns) +return ;switch (cmd->common.opcode) {case nvme_admin_set_features:
drivers/nvme/host/ioctl.c +1 -1
@@ -254,7 +254,7 @@ static int nvme_submit_user_cmd(struct request_queue *q,blk_mq_free_request (req);if (effects) -nvme_passthru_end (ctrl, effects, cmd, ret); +nvme_passthru_end (ctrl, ns, effects, cmd, ret);return ret; }
drivers/nvme/host/nvme.h +1 -1
@@ -1077,7 +1077,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode);u32 nvme_passthru_start (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u8 opcode);int nvme_execute_rq (struct request *rq,bool at_head); -void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +void nvme_passthru_end (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u32 effects,struct nvme_command *cmd,int status);struct nvme_ctrl *nvme_ctrl_from_file (struct file *file);struct nvme_ns *nvme_find_get_ns (struct nvme_ctrl *ctrl,unsigned nsid);
drivers/nvme/target/passthru.c +1 -1
@@ -243,7 +243,7 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w)blk_mq_free_request (rq);if (effects) -nvme_passthru_end (ctrl, effects, req->cmd, status); +nvme_passthru_end (ctrl, ns, effects, req->cmd, status); } static enum rq_end_io_ret nvmet_passthru_req_done(struct request *rq,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 162/199 nvme: double KA polling frequency to avoid KATO with TBKAS on
In reply to Greg Kroah-HartmanFrom: Uday Shankar <[email protected]>
[ Upstream commit ea4d453b9ec9ea279c39744cd0ecb47ef48ede35 ]
With TBKAS on, the completion of one command can defer sending a keep alive for up to twice the delay between successive runs of nvme_keep_alive_work. The current delay of KATO / 2 thus makes it possible for one command to defer sending a keep alive for up to KATO, which can result in the controller detecting a KATO. The following trace demonstrates the issue, taking KATO = 8 for simplicity:
1. t = 0: run nvme_keep_alive_work, no keep-alive sent
2. t = ε: I/O completion seen, set comp_seen = true
3. t = 4: run nvme_keep_alive_work, see comp_seen == true, skip sending keep-alive, set comp_seen = false
4. t = 8: run nvme_keep_alive_work, see comp_seen == false, send a keep-alive command.
Here, there is a delay of 8 - ε between receiving a command completion and sending the next command. With ε small, the controller is likely to detect a keep alive timeout.
Fix this by running nvme_keep_alive_work with a delay of KATO / 4 whenever TBKAS is on. Going through the above trace now gives us a worst-case delay of 4 - ε, which is in line with the recommendation of sending a command every KATO / 2 in the NVMe specification.
--- drivers/nvme/host/core.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +17 -1
@@ -1163,9 +1163,25 @@ EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, NVME_TARGET_PASSTHRU);* The host should send Keep Alive commands at half of the Keep Alive Timeout * accounting for transport roundtrip times [..]. */ +static unsigned long nvme_keep_alive_work_period (struct nvme_ctrl *ctrl) +{ +unsigned long delay = ctrl->kato *HZ /2 ; + +/* +* When using Traffic Based Keep Alive, we need to run +* nvme_keep_alive_work at twice the normal frequency, as one +* command completion can postpone sending a keep alive command +* by up to twice the delay between runs. +*/ +if (ctrl->ctratt &NVME_CTRL_ATTR_TBKAS ) + delay /=2 ; +return delay; +} +static void nvme_queue_keep_alive_work (struct nvme_ctrl *ctrl) { -queue_delayed_work (nvme_wq, &ctrl->ka_work, ctrl->kato *HZ /2 ); +queue_delayed_work (nvme_wq, &ctrl->ka_work, +nvme_keep_alive_work_period (ctrl)); } static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 163/199 nvme: check IO start time when deciding to defer KA
In reply to Greg Kroah-HartmanFrom: Uday Shankar <[email protected]>
[ Upstream commit 774a9636514764ddc0d072ae0d1d1c01a47e6ddd ]
When a command completes, we set a flag which will skip sending a keep alive at the next run of nvme_keep_alive_work when TBKAS is on. However, if the command was submitted long ago, it's possible that the controller may have also restarted its keep alive timer (as a result of receiving the command) long ago. The following trace demonstrates the issue, assuming TBKAS is on and KATO = 8 for simplicity:
1. t = 0: submit I/O commands A, B, C, D, E
2. t = 0.5: commands A, B, C, D, E reach controller, restart its keep alive timer
3. t = 1: A completes
4. t = 2: run nvme_keep_alive_work, see recent completion, do nothing
5. t = 3: B completes
6. t = 4: run nvme_keep_alive_work, see recent completion, do nothing
7. t = 5: C completes
8. t = 6: run nvme_keep_alive_work, see recent completion, do nothing
9. t = 7: D completes
10. t = 8: run nvme_keep_alive_work, see recent completion, do nothing
11. t = 9: E completes
At this point, 8.5 seconds have passed without restarting the controller's keep alive timer, so the controller will detect a keep alive timeout.
Fix this by checking the IO start time when deciding to defer sending a keep alive command. Only set comp_seen if the command started after the most recent run of nvme_keep_alive_work. With this change, the completions of B, C, and D will not set comp_seen and the run of nvme_keep_alive_work at t = 4 will send a keep alive.
--- drivers/nvme/host/core.c | 14 +++++++++++++- drivers/nvme/host/nvme.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +13 -1
@@ -397,7 +397,16 @@ void nvme_complete_rq(struct request *req)trace_nvme_complete_rq (req);nvme_cleanup_cmd (req); -if (ctrl->kas) +/* +* Completions of long-running commands should not be able to +* defer sending of periodic keep alives, since the controller +* may have completed processing such commands a long time ago +* (arbitrarily close to command submission time). +* req->deadline - req->timeout is the command submission time +* in jiffies. +*/ +if (ctrl->kas && + req->deadline - req->timeout >= ctrl->ka_last_check_time) ctrl->comp_seen = true;switch (nvme_decide_disposition (req)) {
@@ -1200,6 +1209,7 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq,return RQ_END_IO_NONE ; } + ctrl->ka_last_check_time = jiffies; ctrl->comp_seen = false;spin_lock_irqsave (&ctrl->lock, flags); if (ctrl->state == NVME_CTRL_LIVE ||
@@ -1218,6 +1228,8 @@ static void nvme_keep_alive_work(struct work_struct *work)bool comp_seen = ctrl->comp_seen;struct request *rq; + ctrl->ka_last_check_time = jiffies; +if ((ctrl->ctratt &NVME_CTRL_ATTR_TBKAS ) && comp_seen) {dev_dbg (ctrl->device,"reschedule traffic based keep-alive timer\n" );
drivers/nvme/host/nvme.h +1 -0
@@ -328,6 +328,7 @@ struct nvme_ctrl {struct delayed_work ka_work;struct delayed_work failfast_work;struct nvme_command ka_cmd; +unsigned long ka_last_check_time;struct work_struct fw_act_work;unsigned long events;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 164/199 nvme: improve handling of long keep alives
In reply to Greg Kroah-HartmanFrom: Uday Shankar <[email protected]>
[ Upstream commit c7275ce6a5fd32ca9f5a6294ed89cf0523181af9 ]
Upon keep alive completion, nvme_keep_alive_work is scheduled with the same delay every time. If keep alive commands are completing slowly, this may cause a keep alive timeout. The following trace illustrates the issue, taking KATO = 8 and TBKAS off for simplicity:
1. t = 0: run nvme_keep_alive_work, send keep alive
2. t = ε: keep alive reaches controller, controller restarts its keep alive timer
3. t = 4: host receives keep alive completion, schedules nvme_keep_alive_work with delay 4
4. t = 8: run nvme_keep_alive_work, send keep alive
Here, a keep alive having RTT of 4 causes a delay of at least 8 - ε between the controller receiving successive keep alives. With ε small, the controller is likely to detect a keep alive timeout.
Fix this by calculating the RTT of the keep alive command, and adjusting the scheduling delay of the next keep alive work accordingly.
--- drivers/nvme/host/core.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +15 -1
@@ -1199,6 +1199,20 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq,struct nvme_ctrl *ctrl = rq->end_io_data;unsigned long flags;bool startka = false; +unsigned long rtt = jiffies - (rq->deadline - rq->timeout); +unsigned long delay =nvme_keep_alive_work_period (ctrl); + +/* +* Subtract off the keepalive RTT so nvme_keep_alive_work runs +* at the desired frequency. +*/ +if (rtt <= delay) { + delay -= rtt; + }else { +dev_warn (ctrl->device,"long keepalive RTT (%u ms)\n" , +jiffies_to_msecs (rtt)); + delay =0 ; + }blk_mq_free_request (rq);
@@ -1217,7 +1231,7 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq, startka = true;spin_unlock_irqrestore (&ctrl->lock, flags);if (startka) -nvme_queue_keep_alive_work (ctrl); +queue_delayed_work (nvme_wq, &ctrl->ka_work, delay);return RQ_END_IO_NONE ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 165/199 Input: soc_button_array - add invalid acpi_index DMI quirk handling
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 20a99a291d564a559cc2fd013b4824a3bb3f1db7 ]
Some devices have a wrong entry in their button array which points to a GPIO which is required in another driver, so soc_button_array must not claim it.
A specific example of this is the Lenovo Yoga Book X90F / X90L, where the PNP0C40 home button entry points to a GPIO which is not a home button and which is required by the lenovo-yogabook driver.
Add a DMI quirk table which can specify an ACPI GPIO resource index which should be skipped; and add an entry for the Lenovo Yoga Book X90F / X90L to this new DMI quirk table.
--- drivers/input/misc/soc_button_array.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/input/misc/soc_button_array.c +30 -0
@@ -108,6 +108,27 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = { {}/* Terminating entry */ }; +/* +* Some devices have a wrong entry which points to a GPIO which is +* required in another driver, so this driver must not claim it. +*/ +static const struct dmi_system_id dmi_invalid_acpi_index[] = { + { +/* +* Lenovo Yoga Book X90F / X90L, the PNP0C40 home button entry +* points to a GPIO which is not a home button and which is +* required by the lenovo-yogabook driver. +*/ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Intel Corporation" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"CHERRYVIEW D1 PLATFORM" ), +DMI_EXACT_MATCH (DMI_PRODUCT_VERSION ,"YETI-11" ), + }, + .driver_data = (void *)1l , + }, + {}/* Terminating entry */ +}; +/* * Get the Nth GPIO number from the ACPI object. */
@@ -137,6 +158,8 @@ soc_button_device_create(struct platform_device *pdev,struct platform_device *pd;struct gpio_keys_button *gpio_keys;struct gpio_keys_platform_data *gpio_keys_pdata; +const struct dmi_system_id *dmi_id; +int invalid_acpi_index =-1 ;int error, gpio, irq;int n_buttons =0 ;
@@ -154,10 +177,17 @@ soc_button_device_create(struct platform_device *pdev, gpio_keys = (void *)(gpio_keys_pdata +1 ); n_buttons =0 ; + dmi_id =dmi_first_match (dmi_invalid_acpi_index); +if (dmi_id) + invalid_acpi_index = (long )dmi_id->driver_data; +for (info = button_info; info->name; info++) {if (info->autorepeat != autorepeat)continue ; +if (info->acpi_index == invalid_acpi_index) +continue ; + error =soc_button_lookup_gpio (&pdev->dev, info->acpi_index, &gpio, &irq);if (error || irq <0 ) {/*
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 166/199 arm64: dts: qcom: sc7280-idp: drop incorrect dai-cells from WCD938x SDW
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ca8fc6814844d8787e7fec61b2544a871ea8b675 ]
The WCD938x audio codec Soundwire interface part is not a DAI and does not allow sound-dai-cells:
sc7280-idp.dtb: codec@0,4: '#sound-dai-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +0 -2
@@ -480,7 +480,6 @@ wcd_rx: codec@0,4 { compatible = "sdw20217010d00"; reg = <0 4>; - #sound-dai-cells = <1>; qcom,rx-port-mapping = <1 2 3 4 5>; }; };
@@ -491,7 +490,6 @@ wcd_tx: codec@0,3 { compatible = "sdw20217010d00"; reg = <0 3>; - #sound-dai-cells = <1>; qcom,tx-port-mapping = <1 2 3 4>; }; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 167/199 arm64: dts: qcom: sc7280-qcard: drop incorrect dai-cells from WCD938x SDW
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 16bd455d0897d1b8b7a9aee2ed51d75b14a34563 ]
The WCD938x audio codec Soundwire interface part is not a DAI and does not allow sound-dai-cells:
sc7280-herobrine-crd.dtb: codec@0,4: '#sound-dai-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi +0 -2
@@ -419,7 +419,6 @@ wcd_rx: codec@0,4 { compatible = "sdw20217010d00"; reg = <0 4>; - #sound-dai-cells = <1>; qcom,rx-port-mapping = <1 2 3 4 5>; }; };
@@ -428,7 +427,6 @@ wcd_tx: codec@0,3 { compatible = "sdw20217010d00"; reg = <0 3>; - #sound-dai-cells = <1>; qcom,tx-port-mapping = <1 2 3 4>; }; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 168/199 s390/cio: unregister device when the only path is gone
In reply to Greg Kroah-HartmanFrom: Vineeth Vijayan <[email protected]>
[ Upstream commit 89c0c62e947a01e7a36b54582fd9c9e346170255 ]
Currently, if the device is offline and all the channel paths are either configured or varied offline, the associated subchannel gets unregistered. Don't unregister the subchannel, instead unregister offline device.
--- drivers/s390/cio/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/s390/cio/device.c +4 -1
@@ -1376,6 +1376,7 @@ void ccw_device_set_notoper(struct ccw_device *cdev)enum io_sch_action {IO_SCH_UNREG ,IO_SCH_ORPH_UNREG , +IO_SCH_UNREG_CDEV ,IO_SCH_ATTACH ,IO_SCH_UNREG_ATTACH ,IO_SCH_ORPH_ATTACH ,
@@ -1408,7 +1409,7 @@ static enum io_sch_action sch_get_action(struct subchannel *sch) }if ((sch->schib.pmcw.pam & sch->opm) ==0 ) {if (ccw_device_notify (cdev,CIO_NO_PATH ) !=NOTIFY_OK ) -return IO_SCH_UNREG ; +return IO_SCH_UNREG_CDEV ;return IO_SCH_DISC ; }if (device_is_disconnected (cdev))
@@ -1470,6 +1471,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)case IO_SCH_ORPH_ATTACH :ccw_device_set_disconnected (cdev);break ; +case IO_SCH_UNREG_CDEV :case IO_SCH_UNREG_ATTACH :case IO_SCH_UNREG :if (!cdev)
@@ -1503,6 +1505,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)if (rc) goto out;break ; +case IO_SCH_UNREG_CDEV :case IO_SCH_UNREG_ATTACH :spin_lock_irqsave (sch->lock, flags);sch_set_cdev (sch,NULL );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 169/199 spi: lpspi: disable lpspi module irq in DMA mode
In reply to Greg Kroah-HartmanFrom: Clark Wang <[email protected]>
[ Upstream commit 9728fb3ce11729aa8c276825ddf504edeb00611d ]
When all bits of IER are set to 0, we still can observe the lpspi irq events when using DMA mode to transfer data.
So disable irq to avoid the too much irq events.
--- drivers/spi/spi-fsl-lpspi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/spi/spi-fsl-lpspi.c +6 -1
@@ -910,9 +910,14 @@ static int fsl_lpspi_probe(struct platform_device *pdev) ret =fsl_lpspi_dma_init (&pdev->dev, fsl_lpspi, controller);if (ret == -EPROBE_DEFER ) goto out_pm_get; -if (ret <0 )dev_err (&pdev->dev,"dma setup error %d, use pio\n" , ret); +else +/* +* disable LPSPI module IRQ when enable DMA mode successfully, +* to prevent the unexpected LPSPI module IRQ events. +*/ +disable_irq (irq); ret =devm_spi_register_controller (&pdev->dev, controller);if (ret <0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 170/199 ASoC: codecs: wcd938x-sdw: do not set can_multi_write flag
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 2d7c2f9272de6347a9cec0fc07708913692c0ae3 ]
regmap-sdw does not support multi register writes, so there is no point in setting this flag. This also leads to incorrect programming of WSA codecs with regmap_multi_reg_write() call.
This invalid configuration should have been rejected by regmap-sdw.
--- sound/soc/codecs/wcd938x-sdw.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/wcd938x-sdw.c +0 -1
@@ -1190,7 +1190,6 @@ static const struct regmap_config wcd938x_regmap_config = { .readable_reg = wcd938x_readable_register, .writeable_reg = wcd938x_writeable_register, .volatile_reg = wcd938x_volatile_register, - .can_multi_write = true, };static const struct sdw_slave_ops wcd9380_slave_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 171/199 ASoC: simple-card: Add missing of_node_put() in case of error
In reply to Greg Kroah-HartmanFrom: Herve Codina <[email protected]>
[ Upstream commit 8938f75a5e35c597a647c28984a0304da7a33d63 ]
In the error path, a of_node_put() for platform is missing. Just add it.
--- sound/soc/generic/simple-card.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/generic/simple-card.c +1 -0
@@ -416,6 +416,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv,if (ret <0 ) {of_node_put (codec); +of_node_put (plat);of_node_put (np); goto error; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 172/199 soundwire: dmi-quirks: add new mapping for HP Spectre x360
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 700581ede41d029403feec935df4616309696fd7 ]
A BIOS/DMI update seems to have broken some devices, let's add a new mapping.
--- drivers/soundwire/dmi-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/soundwire/dmi-quirks.c +7 -0
@@ -99,6 +99,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)intel_tgl_bios, }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"HP" ), + DMI_MATCH(DMI_BOARD_NAME, "8709"), + }, + .driver_data = (void *)intel_tgl_bios, + }, {/* quirk used for NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */ .matches = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 173/199 soundwire: qcom: add proper error paths in qcom_swrm_startup()
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 99e09b9c0ab43346c52f2787ca4e5c4b1798362e ]
Reverse actions in qcom_swrm_startup() error paths to avoid leaking stream memory and keeping runtime PM unbalanced.
--- drivers/soundwire/qcom.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/soundwire/qcom.c +13 -4
@@ -1098,8 +1098,10 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream, } sruntime =sdw_alloc_stream (dai->name); -if (!sruntime) -return -ENOMEM ; +if (!sruntime) { + ret = -ENOMEM ; + goto err_alloc; + } ctrl->sruntime[dai->id] = sruntime;
@@ -1109,12 +1111,19 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream,if (ret <0 && ret != -ENOTSUPP ) {dev_err (dai->dev,"Failed to set sdw stream on %s\n" , codec_dai->name); -sdw_release_stream (sruntime); -return ret; + goto err_set_stream; } }return 0 ; + +err_set_stream: +sdw_release_stream (sruntime); +err_alloc: +pm_runtime_mark_last_busy (ctrl->dev); +pm_runtime_put_autosuspend (ctrl->dev); + +return ret; } static void qcom_swrm_shutdown(struct snd_pcm_substream *substream,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 174/199 platform/x86: int3472: Avoid crash in unregistering regulator gpio
In reply to Greg Kroah-HartmanFrom: Hao Yao <[email protected]>
[ Upstream commit fb109fba728407fa4a84d659b5cb87cd8399d7b3 ]
When int3472 is loaded before GPIO driver, acpi_get_and_request_gpiod() failed but the returned gpio descriptor is not NULL, it will cause panic in later gpiod_put(), so set the gpio_desc to NULL in register error handling to avoid such crash.
--- .../platform/x86/intel/int3472/clk_and_regulator.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/platform/x86/intel/int3472/clk_and_regulator.c +8 -5
@@ -101,9 +101,11 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472, int3472->clock.ena_gpio =acpi_get_and_request_gpiod (path, agpio->pin_table[0 ],"int3472,clk-enable" ); -if (IS_ERR (int3472->clock.ena_gpio)) -return dev_err_probe (int3472->dev,PTR_ERR (int3472->clock.ena_gpio), -"getting clk-enable GPIO\n" ); +if (IS_ERR (int3472->clock.ena_gpio)) { + ret =PTR_ERR (int3472->clock.ena_gpio); + int3472->clock.ena_gpio =NULL ; +return dev_err_probe (int3472->dev, ret,"getting clk-enable GPIO\n" ); + }if (polarity ==GPIO_ACTIVE_LOW )gpiod_toggle_active_low (int3472->clock.ena_gpio);
@@ -199,8 +201,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, int3472->regulator.gpio =acpi_get_and_request_gpiod (path, agpio->pin_table[0 ],"int3472,regulator" );if (IS_ERR (int3472->regulator.gpio)) { -dev_err (int3472->dev,"Failed to get regulator GPIO line\n" ); -return PTR_ERR (int3472->regulator.gpio); + ret =PTR_ERR (int3472->regulator.gpio); + int3472->regulator.gpio =NULL ; +return dev_err_probe (int3472->dev, ret,"getting regulator GPIO\n" ); }/* Ensure the pin is in output mode and non-active state */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 175/199 ASoC: nau8824: Add quirk to active-high jack-detect
In reply to Greg Kroah-HartmanFrom: Edson Juliano Drosdeck <[email protected]>
[ Upstream commit e384dba03e3294ce7ea69e4da558e9bf8f0e8946 ]
Add entries for Positivo laptops: CW14Q01P, K1424G, N14ZP74G to the DMI table, so that active-high jack-detect will work properly on these laptops.
--- sound/soc/codecs/nau8824.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
sound/soc/codecs/nau8824.c +24 -0
@@ -1903,6 +1903,30 @@ static const struct dmi_system_id nau8824_quirk_table[] = { }, .driver_data = (void *)(NAU8824_MONO_SPEAKER), }, + { + /* Positivo CW14Q01P */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), + DMI_MATCH(DMI_BOARD_NAME, "CW14Q01P"), + }, + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH), + }, + { + /* Positivo K1424G */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), + DMI_MATCH(DMI_BOARD_NAME, "K1424G"), + }, + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH), + }, + { + /* Positivo N14ZP74G */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), + DMI_MATCH(DMI_BOARD_NAME, "N14ZP74G"), + }, + .driver_data = (void *)(NAU8824_JD_ACTIVE_HIGH), + }, {} };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 176/199 ASoC: amd: yc: Add Thinkpad Neo14 to quirks list for acp6x
In reply to Greg Kroah-HartmanFrom: Sicong Jiang <[email protected]>
[ Upstream commit 57d1e8900495cf1751cec74db16fe1a0fe47efbb ]
Thinkpad Neo14 Ryzen Edition uses Ryzen 6800H processor, and adding to quirks list for acp6x will enable internal mic.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "21EF"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 177/199 gfs2: Dont get stuck writing page onto itself under direct I/O
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit fa58cc888d67e640e354d8b3ceef877ea167b0cf ]
When a direct I/O write is performed, iomap_dio_rw() invalidates the part of the page cache which the write is going to before carrying out the write. In the odd case, the direct I/O write will be reading from the same page it is writing to. gfs2 carries out writes with page faults disabled, so it should have been obvious that this page invalidation can cause iomap_dio_rw() to never make any progress. Currently, gfs2 will end up in an endless retry loop in gfs2_file_direct_write() instead, though.
Break this endless loop by limiting the number of retries and falling back to buffered I/O after that.
Also simplify should_fault_in_pages() sightly and add a comment to make the above case easier to understand.
--- fs/gfs2/file.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
fs/gfs2/file.c +14 -3
@@ -784,9 +784,13 @@ static inline bool should_fault_in_pages(struct iov_iter *i,if (!user_backed_iter (i))return false; +/* +* Try to fault in multiple pages initially. When that doesn't result +* in any progress, fall back to a single page. +*/ size =PAGE_SIZE ; offs =offset_in_page (iocb->ki_pos); -if (*prev_count != count || !*window_size) { +if (*prev_count != count) {size_t nr_dirtied; nr_dirtied = max(current->nr_dirtied_pause -
@@ -870,6 +874,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,struct gfs2_inode *ip =GFS2_I (inode);size_t prev_count =0 , window_size =0 ;size_t written =0 ; +bool enough_retries;ssize_t ret;/*
@@ -913,11 +918,17 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,if (ret >0 ) written = ret; + enough_retries = prev_count ==iov_iter_count (from) && + window_size <=PAGE_SIZE ;if (should_fault_in_pages (from, iocb, &prev_count, &window_size)) {gfs2_glock_dq (gh); window_size -=fault_in_iov_iter_readable (from, window_size); -if (window_size) - goto retry; +if (window_size) { +if (!enough_retries) + goto retry; +/* fall back to buffered I/O */ + ret =0 ; + } } out_unlock:if (gfs2_holder_queued (gh))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 178/199 s390/purgatory: disable branch profiling
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
[ Upstream commit 03c5c83b70dca3729a3eb488e668e5044bd9a5ea ]
Avoid linker error for randomly generated config file that has CONFIG_BRANCH_PROFILE_NONE enabled and make it similar to riscv, x86 and also to commit 4bf3ec384edf ("s390: disable branch profiling for vdso").
--- arch/s390/purgatory/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/s390/purgatory/Makefile +1 -0
@@ -26,6 +26,7 @@ KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common KBUILD_CFLAGS += -fno-stack-protector +KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 179/199 ASoC: fsl_sai: Enable BCI bit if SAI works on synchronous mode with BYP asserted
In reply to Greg Kroah-HartmanFrom: Chancel Liu <[email protected]>
[ Upstream commit 32cf0046a652116d6a216d575f3049a9ff9dd80d ]
There's an issue on SAI synchronous mode that TX/RX side can't get BCLK from RX/TX it sync with if BYP bit is asserted. It's a workaround to fix it that enable SION of IOMUX pad control and assert BCI.
For example if TX sync with RX which means both TX and RX are using clk form RX and BYP=1. TX can get BCLK only if the following two conditions are valid:
1. SION of RX BCLK IOMUX pad is set to 1
2. BCI of TX is set to 1
--- sound/soc/fsl/fsl_sai.c | 11 +++++++++-- sound/soc/fsl/fsl_sai.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_sai.c +9 -2
@@ -491,14 +491,21 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)regmap_update_bits (sai->regmap, reg,FSL_SAI_CR2_MSEL_MASK ,FSL_SAI_CR2_MSEL (sai->mclk_id[tx])); -if (savediv ==1 ) +if (savediv ==1 ) {regmap_update_bits (sai->regmap, reg,FSL_SAI_CR2_DIV_MASK |FSL_SAI_CR2_BYP ,FSL_SAI_CR2_BYP ); -else +if (fsl_sai_dir_is_synced (sai, adir)) +regmap_update_bits (sai->regmap,FSL_SAI_xCR2 (tx, ofs), +FSL_SAI_CR2_BCI ,FSL_SAI_CR2_BCI ); +else +regmap_update_bits (sai->regmap,FSL_SAI_xCR2 (tx, ofs), +FSL_SAI_CR2_BCI ,0 ); + }else {regmap_update_bits (sai->regmap, reg,FSL_SAI_CR2_DIV_MASK |FSL_SAI_CR2_BYP , savediv /2 -1 ); + }if (sai->soc_data->max_register >=FSL_SAI_MCTL ) {/* SAI is in master mode at this point, so enable MCLK */
sound/soc/fsl/fsl_sai.h +1 -0
@@ -116,6 +116,7 @@/* SAI Transmit and Receive Configuration 2 Register */ #define FSL_SAI_CR2_SYNC BIT(30) +#define FSL_SAI_CR2_BCI BIT(28)#define FSL_SAI_CR2_MSEL_MASK (0x3 << 26)#define FSL_SAI_CR2_MSEL_BUS 0#define FSL_SAI_CR2_MSEL_MCLK1 BIT(26)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 180/199 net: sched: wrap tc_skip_wrapper with CONFIG_RETPOLINE
In reply to Greg Kroah-HartmanFrom: Min-Hua Chen <[email protected]>
[ Upstream commit 8cde87b007dad2e461015ff70352af56ceb02c75 ]
This patch fixes the following sparse warning:
net/sched/sch_api.c:2305:1: sparse: warning: symbol 'tc_skip_wrapper' was not declared. Should it be static?
No functional change intended.
--- net/sched/sch_api.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/sch_api.c +2 -0
@@ -2324,7 +2324,9 @@ static struct pernet_operations psched_net_ops = { .exit = psched_net_exit, }; +#if IS_ENABLED (CONFIG_RETPOLINE )DEFINE_STATIC_KEY_FALSE (tc_skip_wrapper); +#endif static int __init pktsched_init (void ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 181/199 ALSA: hda/realtek: Add "Intel Reference board" and "NUC 13" SSID in the ALC256
In reply to Greg Kroah-HartmanFrom: Sayed, Karimuddin <[email protected]>
[ Upstream commit 1a93f10c5b12bd766a537b24a50fca5373467303 ]
Add "Intel Reference boad" and "Intel NUC 13" SSID in the alc256.
Enable jack headset volume buttons
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -9594,6 +9594,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x10ec ,0x124c ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ),SND_PCI_QUIRK (0x10ec ,0x1252 ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ),SND_PCI_QUIRK (0x10ec ,0x1254 ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ), +SND_PCI_QUIRK (0x10ec ,0x12cc ,"Intel Reference board" ,ALC225_FIXUP_HEADSET_JACK ),SND_PCI_QUIRK (0x10f7 ,0x8338 ,"Panasonic CF-SZ6" ,ALC269_FIXUP_HEADSET_MODE ),SND_PCI_QUIRK (0x144d ,0xc109 ,"Samsung Ativ book 9 (NP900X3G)" ,ALC269_FIXUP_INV_DMIC ), SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
@@ -9814,6 +9815,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x8086 ,0x2074 ,"Intel NUC 8" ,ALC233_FIXUP_INTEL_NUC8_DMIC ),SND_PCI_QUIRK (0x8086 ,0x2080 ,"Intel NUC 8 Rugged" ,ALC256_FIXUP_INTEL_NUC8_RUGGED ),SND_PCI_QUIRK (0x8086 ,0x2081 ,"Intel NUC 10" ,ALC256_FIXUP_INTEL_NUC10 ), +SND_PCI_QUIRK (0x8086 ,0x3038 ,"Intel NUC 13" ,ALC225_FIXUP_HEADSET_JACK ),SND_PCI_QUIRK (0xf111 ,0x0001 ,"Framework Laptop" ,ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE ), #if 0
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 182/199 i2c: mchp-pci1xxxx: Avoid cast to incompatible function type
In reply to Greg Kroah-HartmanFrom: Simon Horman <[email protected]>
[ Upstream commit 7ebfd881abe9e0ea9557b29dab6aa28d294fabb4 ]
Rather than casting pci1xxxx_i2c_shutdown to an incompatible function type, update the type to match that expected by __devm_add_action.
Reported by clang-16 with W-1:
.../i2c-mchp-pci1xxxx.c:1159:29: error: cast from 'void (*)(struct pci1xxxx_i2c *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
ret = devm_add_action(dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/device.h:251:29: note: expanded from macro 'devm_add_action'
__devm_add_action(release, action, data, #action)
^~~~~~
No functional change intended.
Compile tested only.
--- drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-mchp-pci1xxxx.c +4 -2
@@ -1118,8 +1118,10 @@ static int pci1xxxx_i2c_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_i2c_pm_ops, pci1xxxx_i2c_suspend, pci1xxxx_i2c_resume); -static void pci1xxxx_i2c_shutdown (struct pci1xxxx_i2c *i2c) +static void pci1xxxx_i2c_shutdown (void *data) { +struct pci1xxxx_i2c *i2c = data; +pci1xxxx_i2c_config_padctrl (i2c, false);pci1xxxx_i2c_configure_core_reg (i2c, false); }
@@ -1156,7 +1158,7 @@ static int pci1xxxx_i2c_probe_pci(struct pci_dev *pdev,init_completion (&i2c->i2c_xfer_done);pci1xxxx_i2c_init (i2c); - ret =devm_add_action (dev, (void (*)(void *))pci1xxxx_i2c_shutdown, i2c); + ret =devm_add_action (dev, pci1xxxx_i2c_shutdown, i2c);if (ret)return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 183/199 i2c: designware: fix idx_write_cnt in read loop
In reply to Greg Kroah-HartmanFrom: David Zheng <[email protected]>
[ Upstream commit 1acfc6e753ed978b36d722f54e57fe4d1e8a6ffa ]
With IC_INTR_RX_FULL slave interrupt handler reads data in a loop until RX FIFO is empty. When testing with the slave-eeprom, each transaction has 2 bytes for address/index and 1 byte for value, the address byte can be written as data byte due to dropping STOP condition.
In the test below, the master continuously writes to the slave, first 2 bytes are index, 3rd byte is value and follow by a STOP condition.
i2c_write: i2c-3 #0 a=04b f=0000 l=3 [00-D1-D1]
i2c_write: i2c-3 #0 a=04b f=0000 l=3 [00-D2-D2]
i2c_write: i2c-3 #0 a=04b f=0000 l=3 [00-D3-D3]
Upon receiving STOP condition slave eeprom would reset idx_write_cnt so next 2 bytes can be treated as buffer index for upcoming transaction. Supposedly the slave eeprom buffer would be written as
EEPROM[0x00D1] = 0xD1
EEPROM[0x00D2] = 0xD2
EEPROM[0x00D3] = 0xD3
When CPU load is high the slave irq handler may not read fast enough, the interrupt status can be seen as 0x204 with both DW_IC_INTR_STOP_DET (0x200) and DW_IC_INTR_RX_FULL (0x4) bits. The slave device may see the transactions below.
0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1794 : INTR_STAT=0x204 0x1 STATUS SLAVE_ACTIVITY=0x0 : RAW_INTR_STAT=0x1790 : INTR_STAT=0x200 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x1594 : INTR_STAT=0x4
After D1 is received, read loop continues to read 00 which is the first bype of next index. Since STOP condition is ignored by the loop, eeprom buffer index increased to D2 and 00 is written as value.
So the slave eeprom buffer becomes
EEPROM[0x00D1] = 0xD1
EEPROM[0x00D2] = 0x00
EEPROM[0x00D3] = 0xD3
The fix is to use FIRST_DATA_BYTE (bit 11) in IC_DATA_CMD to split the transactions. The first index byte in this case would have bit 11 set. Check this indication to inject I2C_SLAVE_WRITE_REQUESTED event which will reset idx_write_cnt in slave eeprom.
--- drivers/i2c/busses/i2c-designware-core.h | 1 + drivers/i2c/busses/i2c-designware-slave.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/i2c/busses/i2c-designware-core.h +1 -0
@@ -40,6 +40,7 @@#define DW_IC_CON_BUS_CLEAR_CTRL BIT(11)#define DW_IC_DATA_CMD_DAT GENMASK(7, 0) +#define DW_IC_DATA_CMD_FIRST_DATA_BYTE BIT(11)/* * Registers offset
drivers/i2c/busses/i2c-designware-slave.c +4 -0
@@ -176,6 +176,10 @@ static irqreturn_t i2c_dw_isr_slave(int this_irq, void *dev_id) do { regmap_read(dev->map, DW_IC_DATA_CMD, &tmp); + if (tmp & DW_IC_DATA_CMD_FIRST_DATA_BYTE) + i2c_slave_event(dev->slave, + I2C_SLAVE_WRITE_REQUESTED, + &val); val = tmp; i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED, &val);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 184/199 ARM: dts: Fix erroneous ADS touchscreen polarities
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 4a672d500bfd6bb87092c33d5a2572c3d0a1cf83 ]
Several device tree files get the polarity of the pendown-gpios
wrong: this signal is active low. Fix up all incorrect flags, so that operating systems can rely on the flag being correctly set.
--- arch/arm/boot/dts/am57xx-cl-som-am57x.dts | 2 +- arch/arm/boot/dts/at91sam9261ek.dts | 2 +- arch/arm/boot/dts/imx7d-pico-hobbit.dts | 2 +- arch/arm/boot/dts/imx7d-sdb.dts | 2 +- arch/arm/boot/dts/omap3-cm-t3x.dtsi | 2 +- arch/arm/boot/dts/omap3-devkit8000-lcd-common.dtsi | 2 +- arch/arm/boot/dts/omap3-lilly-a83x.dtsi | 2 +- arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi | 2 +- arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi | 2 +- arch/arm/boot/dts/omap3-pandora-common.dtsi | 2 +- arch/arm/boot/dts/omap5-cm-t54.dts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-)
arch/arm/boot/dts/am57xx-cl-som-am57x.dts +1 -1
@@ -527,7 +527,7 @@ interrupt-parent = <&gpio1>; interrupts = <31 0>; - pendown-gpio = <&gpio1 31 0>; + pendown-gpio = <&gpio1 31 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>;
arch/arm/boot/dts/at91sam9261ek.dts +1 -1
@@ -156,7 +156,7 @@ compatible = "ti,ads7843"; interrupts-extended = <&pioC 2 IRQ_TYPE_EDGE_BOTH>; spi-max-frequency = <3000000>; - pendown-gpio = <&pioC 2 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&pioC 2 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <150>; ti,x-max = /bits/ 16 <3830>;
arch/arm/boot/dts/imx7d-pico-hobbit.dts +1 -1
@@ -64,7 +64,7 @@ interrupt-parent = <&gpio2>; interrupts = <7 0>; spi-max-frequency = <1000000>; - pendown-gpio = <&gpio2 7 0>; + pendown-gpio = <&gpio2 7 GPIO_ACTIVE_LOW>; vcc-supply = <®_3p3v>; ti,x-min = /bits/ 16 <0>; ti,x-max = /bits/ 16 <4095>;
arch/arm/boot/dts/imx7d-sdb.dts +1 -1
@@ -205,7 +205,7 @@ pinctrl-0 = <&pinctrl_tsc2046_pendown>; interrupt-parent = <&gpio2>; interrupts = <29 0>; - pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio2 29 GPIO_ACTIVE_LOW>; touchscreen-max-pressure = <255>; wakeup-source; };
arch/arm/boot/dts/omap3-cm-t3x.dtsi +1 -1
@@ -227,7 +227,7 @@ interrupt-parent = <&gpio2>; interrupts = <25 0>; /* gpio_57 */ - pendown-gpio = <&gpio2 25 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio2 25 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>; ti,x-max = /bits/ 16 <0x0fff>;
arch/arm/boot/dts/omap3-devkit8000-lcd-common.dtsi +1 -1
@@ -54,7 +54,7 @@ interrupt-parent = <&gpio1>; interrupts = <27 0>; /* gpio_27 */ - pendown-gpio = <&gpio1 27 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio1 27 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>; ti,x-max = /bits/ 16 <0x0fff>;
arch/arm/boot/dts/omap3-lilly-a83x.dtsi +1 -1
@@ -311,7 +311,7 @@ interrupt-parent = <&gpio1>; interrupts = <8 0>; /* boot6 / gpio_8 */ spi-max-frequency = <1000000>; - pendown-gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>; vcc-supply = <®_vcc3>; pinctrl-names = "default"; pinctrl-0 = <&tsc2048_pins>;
arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi +1 -1
@@ -149,7 +149,7 @@ interrupt-parent = <&gpio4>; interrupts = <18 0>; /* gpio_114 */ - pendown-gpio = <&gpio4 18 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio4 18 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>; ti,x-max = /bits/ 16 <0x0fff>;
arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi +1 -1
@@ -160,7 +160,7 @@ interrupt-parent = <&gpio4>; interrupts = <18 0>; /* gpio_114 */ - pendown-gpio = <&gpio4 18 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio4 18 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>; ti,x-max = /bits/ 16 <0x0fff>;
arch/arm/boot/dts/omap3-pandora-common.dtsi +1 -1
@@ -651,7 +651,7 @@ pinctrl-0 = <&penirq_pins>; interrupt-parent = <&gpio3>; interrupts = <30 IRQ_TYPE_NONE>; /* GPIO_94 */ - pendown-gpio = <&gpio3 30 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio3 30 GPIO_ACTIVE_LOW>; vcc-supply = <&vaux4>; ti,x-min = /bits/ 16 <0>;
arch/arm/boot/dts/omap5-cm-t54.dts +1 -1
@@ -354,7 +354,7 @@ interrupt-parent = <&gpio1>; interrupts = <15 0>; /* gpio1_wk15 */ - pendown-gpio = <&gpio1 15 GPIO_ACTIVE_HIGH>; + pendown-gpio = <&gpio1 15 GPIO_ACTIVE_LOW>; ti,x-min = /bits/ 16 <0x0>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 185/199 null_blk: Fix: memory release when memory_backed=1
In reply to Greg Kroah-HartmanFrom: Nitesh Shetty <[email protected]>
[ Upstream commit 8cfb98196cceec35416041c6b91212d2b99392e4 ]
Memory/pages are not freed, when unloading nullblk driver.
Steps to reproduce issue
1.free -h
total used free shared buff/cache available
Mem: 7.8Gi 260Mi 7.1Gi 3.0Mi 395Mi 7.3Gi
Swap: 0B 0B 0B
2.modprobe null_blk memory_backed=1
3.dd if=/dev/urandom of=/dev/nullb0 oflag=direct bs=1M count=1000
4.modprobe -r null_blk
5.free -h
total used free shared buff/cache available
Mem: 7.8Gi 1.2Gi 6.1Gi 3.0Mi 398Mi 6.3Gi
Swap: 0B 0B 0B--- drivers/block/null_blk/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/null_blk/main.c +1 -0
@@ -2212,6 +2212,7 @@ static void null_destroy_dev(struct nullb *nullb)struct nullb_device *dev = nullb->dev;null_del_dev (nullb); +null_free_device_storage (dev, false);null_free_dev (dev); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 186/199 drm/exynos: vidi: fix a wrong error return
In reply to Greg Kroah-HartmanFrom: Inki Dae <[email protected]>
[ Upstream commit 4a059559809fd1ddbf16f847c4d2237309c08edf ]
Fix a wrong error return by dropping an error return.
When vidi driver is remvoed, if ctx->raw_edid isn't same as fake_edid_info then only what we have to is to free ctx->raw_edid so that driver removing can work correctly - it's not an error case.
--- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_vidi.c +0 -2
@@ -469,8 +469,6 @@ static int vidi_remove(struct platform_device *pdev)if (ctx->raw_edid != (struct edid *)fake_edid_info) {kfree (ctx->raw_edid); ctx->raw_edid =NULL ; - -return -EINVAL ; }component_del (&pdev->dev, &vidi_component_ops);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 187/199 drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl
In reply to Greg Kroah-HartmanFrom: Min Li <[email protected]>
[ Upstream commit 48bfd02569f5db49cc033f259e66d57aa6efc9a3 ]
If it is async, runqueue_node is freed in g2d_runqueue_worker on another worker thread. So in extreme cases, if g2d_runqueue_worker runs first, and then executes the following if statement, there will be use-after-free.
--- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_g2d.c +1 -1
@@ -1335,7 +1335,7 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,/* Let the runqueue know that there is work to do. */ queue_work (g2d->g2d_workq, &g2d->runqueue_work); -if (runqueue_node->async) +if (req->async) goto out;wait_for_completion (&runqueue_node->complete);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 188/199 drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl
In reply to Greg Kroah-HartmanFrom: Min Li <[email protected]>
[ Upstream commit 982b173a6c6d9472730c3116051977e05d17c8c5 ]
Userspace can race to free the gobj(robj converted from), robj should not be accessed again after drm_gem_object_put, otherwith it will result in use-after-free.
--- drivers/gpu/drm/radeon/radeon_gem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_gem.c +1 -3
@@ -459,7 +459,6 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,struct radeon_device *rdev = dev->dev_private;struct drm_radeon_gem_set_domain *args = data;struct drm_gem_object *gobj; -struct radeon_bo *robj;int r;/* for now if someone requests domain CPU -
@@ -472,13 +471,12 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,up_read (&rdev->exclusive_lock);return -ENOENT ; } - robj =gem_to_radeon_bo (gobj); r =radeon_gem_set_domain (gobj, args->read_domains, args->write_domain);drm_gem_object_put (gobj);up_read (&rdev->exclusive_lock); - r =radeon_gem_handle_lockup (robj->rdev, r); + r =radeon_gem_handle_lockup (rdev, r);return r; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 189/199 tools/virtio: Fix arm64 ringtest compilation error
In reply to Greg Kroah-HartmanFrom: Rong Tao <[email protected]>
[ Upstream commit 57380fd1249b20ef772549af2c58ef57b21faba7 ]
Add cpu_relax() for arm64 instead of directly assert(), and add assert.h header file. Also, add smp_wmb and smp_mb for arm64.
Compilation error as follows, avoid __always_inline undefined.
$ make
cc -Wall -pthread -O2 -ggdb -flto -fwhole-program -c -o ring.o ring.c
In file included from ring.c:10:
main.h: In function ‘busy_wait’:
main.h:99:21: warning: implicit declaration of function ‘assert’
[-Wimplicit-function-declaration]
99 | #define cpu_relax() assert(0)
| ^~~~~~
main.h:107:17: note: in expansion of macro ‘cpu_relax’
107 | cpu_relax();
| ^~~~~~~~~
main.h:12:1: note: ‘assert’ is defined in header ‘<assert.h>’; did you
forget to ‘#include <assert.h>’?
11 | #include <stdbool.h>
+++ |+#include <assert.h>
12 |
main.h: At top level:
main.h:143:23: error: expected ‘;’ before ‘void’
143 | static __always_inline
| ^
| ;
144 | void __read_once_size(const volatile void *p, void *res, int
size)
| ~~~~
main.h:158:23: error: expected ‘;’ before ‘void’
158 | static __always_inline void __write_once_size(volatile void *p,
void *res, int size)
| ^~~~~
| ;
make: *** [<builtin>: ring.o] Error 1Message-Id: <[email protected]>
--- tools/virtio/ringtest/main.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/virtio/ringtest/main.h +11 -0
@@ -8,6 +8,7 @@#ifndef MAIN_H #define MAIN_H +#include <assert.h> #include <stdbool.h> extern int param;
@@ -95,6 +96,8 @@ extern unsigned ring_size;#define cpu_relax () asm ("rep; nop" ::: "memory")#elif defined(__s390x__)#define cpu_relax () barrier() +#elif defined(__aarch64__) +#define cpu_relax () asm ("yield" ::: "memory")#else #define cpu_relax () assert(0)#endif
@@ -112,6 +115,8 @@ static inline void busy_wait(void)#if defined(__x86_64__) || defined(__i386__)#define smp_mb () asm volatile("lock; addl $0,-132(%%rsp)" ::: "memory", "cc") +#elif defined(__aarch64__) +#define smp_mb () asm volatile("dmb ish" ::: "memory")#else /* * Not using __ATOMIC_SEQ_CST since gcc docs say they are only synchronized
@@ -136,10 +141,16 @@ static inline void busy_wait(void)#if defined(__i386__) || defined(__x86_64__) || defined(__s390x__)#define smp_wmb () barrier() +#elif defined(__aarch64__) +#define smp_wmb () asm volatile("dmb ishst" ::: "memory")#else #define smp_wmb () smp_release()#endif +#ifndef __always_inline +#define __always_inline inline __attribute__((always_inline)) +#endif +static __always_inline void __read_once_size(const volatile void *p, void *res, int size) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 190/199 vhost_vdpa: tell vqs about the negotiated
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 376daf317753ccb6b1ecbdece66018f7f6313a7f ]
As is done in the net, iscsi, and vsock vhost support, let the vdpa vqs know about the features that have been negotiated. This allows vhost to more safely make decisions based on the features, such as when using PACKED vs split queues.
Message-Id: <[email protected]>
--- drivers/vhost/vdpa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/vhost/vdpa.c +13 -0
@@ -385,7 +385,10 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep) {struct vdpa_device *vdpa = v->vdpa;const struct vdpa_config_ops *ops = vdpa->config; +struct vhost_dev *d = &v->vdev; +u64 actual_features;u64 features; +int i;/* * It's not allowed to change the features after they have
@@ -400,6 +403,16 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep)if (vdpa_set_features (vdpa, features))return -EINVAL ; +/* let the vqs know what has been configured */ + actual_features = ops->get_driver_features (vdpa); +for (i =0 ; i < d->nvqs; ++i) { +struct vhost_virtqueue *vq = d->vqs[i]; + +mutex_lock (&vq->mutex); + vq->acked_features = actual_features; +mutex_unlock (&vq->mutex); + } +return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 191/199 vhost_net: revert upend_idx only on retriable error
In reply to Greg Kroah-HartmanFrom: Andrey Smetanin <[email protected]>
[ Upstream commit 1f5d2e3bab16369d5d4b4020a25db4ab1f4f082c ]
Fix possible virtqueue used buffers leak and corresponding stuck in case of temporary -EIO from sendmsg() which is produced by tun driver while backend device is not up.
In case of no-retriable error and zcopy do not revert upend_idx to pass packet data (that is update used_idx in corresponding vhost_zerocopy_signal_used()) as if packet data has been transferred successfully.
v2: set vq->heads[ubuf->desc].len equal to VHOST_DMA_DONE_LEN in case of fake successful transmit.
Message-Id: <[email protected]>
--- drivers/vhost/net.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/vhost/net.c +8 -3
@@ -935,13 +935,18 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock) err = sock->ops->sendmsg (sock, &msg, len);if (unlikely (err <0 )) { +bool retry = err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS ; +if (zcopy_used) {if (vq->heads[ubuf->desc].len ==VHOST_DMA_IN_PROGRESS )vhost_net_ubuf_put (ubufs); - nvq->upend_idx = ((unsigned )nvq->upend_idx -1 ) - %UIO_MAXIOV ; +if (retry) + nvq->upend_idx = ((unsigned )nvq->upend_idx -1 ) + %UIO_MAXIOV ; +else + vq->heads[ubuf->desc].len =VHOST_DMA_DONE_LEN ; } -if (err == -EAGAIN || err == -ENOMEM || err == -ENOBUFS ) { +if (retry) {vhost_discard_vq_desc (vq,1 );vhost_net_enable_vq (net, vq);break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 192/199 x86/unwind/orc: Add ELF section with ORC version identifier
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit b9f174c811e3ae4ae8959dc57e6adb9990e913f4 ]
Commits ffb1b4a41016 ("x86/unwind/orc: Add 'signal' field to ORC metadata") and fb799447ae29 ("x86,objtool: Split UNWIND_HINT_EMPTY in two") changed the ORC format. Although ORC is internal to the kernel, it's the only way for external tools to get reliable kernel stack traces on x86-64. In particular, the drgn debugger [1] uses ORC for stack unwinding, and these format changes broke it [2]. As the drgn maintainer, I don't care how often or how much the kernel changes the ORC format as long as I have a way to detect the change.
It suffices to store a version identifier in the vmlinux and kernel module ELF files (to use when parsing ORC sections from ELF), and in kernel memory (to use when parsing ORC from a core dump+symbol table). Rather than hard-coding a version number that needs to be manually bumped, Peterz suggested hashing the definitions from orc_types.h. If there is a format change that isn't caught by this, the hashing script can be updated.
This patch adds an .orc_header allocated ELF section containing the 20-byte hash to vmlinux and kernel modules, along with the corresponding __start_orc_header and __stop_orc_header symbols in vmlinux.
1: https://github.com/osandov/drgn
2: https://github.com/osandov/drgn/issues/303
--- arch/x86/Makefile | 12 ++++++++++++ arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/orc_header.h | 19 +++++++++++++++++++ arch/x86/kernel/unwind_orc.c | 3 +++ include/asm-generic/vmlinux.lds.h | 3 +++ scripts/mod/modpost.c | 5 +++++ scripts/orc_hash.sh | 16 ++++++++++++++++ 7 files changed, 59 insertions(+) create mode 100644 arch/x86/include/asm/orc_header.h create mode 100644 scripts/orc_hash.sh
arch/x86/Makefile +12 -0
@@ -305,6 +305,18 @@ ifeq ($(RETPOLINE_CFLAGS),) endif endif +ifdef CONFIG_UNWINDER_ORC +orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h +orc_hash_sh := $(srctree)/scripts/orc_hash.sh +targets += $(orc_hash_h) +quiet_cmd_orc_hash = GEN $@ + cmd_orc_hash = mkdir -p $(dir $@); \ + $(CONFIG_SHELL) $(orc_hash_sh) < $< > $@ +$(orc_hash_h): $(srctree)/arch/x86/include/asm/orc_types.h $(orc_hash_sh) FORCE + $(call if_changed,orc_hash) +archprepare: $(orc_hash_h) +endif + archclean: $(Q)rm -rf $(objtree)/arch/i386 $(Q)rm -rf $(objtree)/arch/x86_64
arch/x86/include/asm/Kbuild +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 +generated-y += orc_hash.h generated-y += syscalls_32.h generated-y += syscalls_64.h generated-y += syscalls_x32.h
arch/x86/include/asm/orc_header.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Copyright (c) Meta Platforms, Inc. and affiliates. */ + +#ifndef _ORC_HEADER_H +#define _ORC_HEADER_H + +#include <linux/types.h> +#include <linux/compiler.h> +#include <asm/orc_hash.h> + +/* +* The header is currently a 20-byte hash of the ORC entry definition; see +* scripts/orc_hash.sh. +*/ +#define ORC_HEADER \ + __used __section(".orc_header") __aligned(4) \ + static const u8 orc_header[] = { ORC_HASH } + +#endif /* _ORC_HEADER_H */
arch/x86/kernel/unwind_orc.c +3 -0
@@ -7,6 +7,9 @@#include <asm/unwind.h> #include <asm/orc_types.h> #include <asm/orc_lookup.h> +#include <asm/orc_header.h> + +ORC_HEADER ;#define orc_warn (fmt, ...) \ printk_deferred_once(KERN_WARNING "WARNING: " fmt, ##__VA_ARGS__)
include/asm-generic/vmlinux.lds.h +3 -0
@@ -839,6 +839,9 @@#ifdef CONFIG_UNWINDER_ORC #define ORC_UNWIND_TABLE \ + .orc_header : AT(ADDR(.orc_header) - LOAD_OFFSET) { \ + BOUNDED_SECTION_BY(.orc_header, _orc_header) \ + } \ . = ALIGN(4); \ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \ BOUNDED_SECTION_BY(.orc_unwind_ip, _orc_unwind_ip) \
scripts/mod/modpost.c +5 -0
@@ -1985,6 +1985,11 @@ static void add_header(struct buffer *b, struct module *mod)buf_printf (b,"#include <linux/vermagic.h>\n" );buf_printf (b,"#include <linux/compiler.h>\n" );buf_printf (b,"\n" ); +buf_printf (b,"#ifdef CONFIG_UNWINDER_ORC\n" ); +buf_printf (b,"#include <asm/orc_header.h>\n" ); +buf_printf (b,"ORC_HEADER;\n" ); +buf_printf (b,"#endif\n" ); +buf_printf (b,"\n" );buf_printf (b,"BUILD_SALT;\n" );buf_printf (b,"BUILD_LTO_INFO;\n" );buf_printf (b,"\n" );
scripts/orc_hash.sh new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) Meta Platforms, Inc. and affiliates. + +set -e + +printf '%s' '#define ORC_HASH ' + +awk ' +/^#define ORC_(REG|TYPE)_/ { print } +/^struct orc_entry {$/ { p=1 } +p { print } +/^}/ { p=0 }' | + sha1sum | + cut -d " " -f 1 | + sed 's/\([0-9a-f]\{2\}\)/0x\1,/g'
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 193/199 x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
In reply to Greg Kroah-HartmanFrom: Dheeraj Kumar Srivastava <[email protected]>
[ Upstream commit 85d38d5810e285d5aec7fb5283107d1da70c12a9 ]
When booting with "intremap=off" and "x2apic_phys" on the kernel command line, the physical x2APIC driver ends up being used even when x2APIC mode is disabled ("intremap=off" disables x2APIC mode). This happens because the first compound condition check in x2apic_phys_probe() is false due to x2apic_mode == 0 and so the following one returns true after default_acpi_madt_oem_check() having already selected the physical x2APIC driver.
This results in the following panic:
kernel BUG at arch/x86/kernel/apic/io_apic.c:2409! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2
Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021
RIP: 0010:setup_IO_APIC+0x9c/0xaf0
Call Trace:
<TASK>
? native_read_msr
apic_intr_mode_init
x86_late_time_init
start_kernel
x86_64_start_reservations
x86_64_start_kernel
secondary_startup_64_no_verify
</TASK>which is:
setup_IO_APIC:
apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); for_each_ioapic(ioapic)
BUG_ON(mp_irqdomain_create(ioapic));
Return 0 to denote that x2APIC has not been enabled when probing the physical x2APIC driver.
[ bp: Massage commit message heavily. ]
--- arch/x86/kernel/apic/x2apic_phys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/x2apic_phys.c +4 -1
@@ -97,7 +97,10 @@ static void init_x2apic_ldr(void)static int x2apic_phys_probe (void ) { -if (x2apic_mode && (x2apic_phys ||x2apic_fadt_phys ())) +if (!x2apic_mode) +return 0 ; + +if (x2apic_phys ||x2apic_fadt_phys ())return 1 ;return apic == &apic_x2apic_phys;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 194/199 i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle
In reply to Greg Kroah-HartmanFrom: Clark Wang <[email protected]>
[ Upstream commit e69b9bc170c6d93ee375a5cbfd15f74c0fb59bdd ]
Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow.
--- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx-lpi2c.c +2 -2
@@ -201,8 +201,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx)/* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */ static int lpi2c_imx_config (struct lpi2c_imx_struct *lpi2c_imx) { -u8 prescale, filt, sethold, clkhi, clklo, datavd; -unsigned int clk_rate, clk_cycle; +u8 prescale, filt, sethold, datavd; +unsigned int clk_rate, clk_cycle, clkhi, clklo;enum lpi2c_imx_pincfg pincfg;unsigned int temp;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 195/199 netfilter: nf_tables: drop module reference after updating chain
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 043d2acf57227db1fdaaa620b2a420acfaa56d6e upstream.
Otherwise the module reference counter is leaked.
Fixes b9703ed44ffb ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
--- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_tables_api.c +2 -0
@@ -2664,6 +2664,8 @@ static int nf_tables_updchain(struct nftnft_trans_basechain (trans) = basechain;INIT_LIST_HEAD (&nft_trans_chain_hooks (trans));list_splice (&hook.list, &nft_trans_chain_hooks (trans)); +if (nla[NFTA_CHAIN_HOOK ]) +module_put (hook.type->owner);nft_trans_commit_list_add_tail (ctx->net, trans);
Greg Kroah-Hartman
maintainerPATCH 196/199 KVM: arm64: Restore GICv2-on-GICv3 functionality
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 1caa71a7a600f7781ce05ef1e84701c459653663 upstream.
When reworking the vgic locking, the vgic distributor registration got simplified, which was a very good cleanup. But just a tad too radical, as we now register the *native* vgic only, ignoring the GICv2-on-GICv3 that allows pre-historic VMs (or so I thought) to run.
As it turns out, QEMU still defaults to GICv2 in some cases, and this breaks Nathan's setup!
Fix it by propagating the *requested* vgic type rather than the host's version.
--- arch/arm64/kvm/vgic/vgic-init.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm64/kvm/vgic/vgic-init.c +7 -4
@@ -446,6 +446,7 @@ int vgic_lazy_init(struct kvm *kvm)int kvm_vgic_map_resources (struct kvm *kvm) {struct vgic_dist *dist = &kvm->arch.vgic; +enum vgic_type type;gpa_t dist_base;int ret =0 ;
@@ -460,10 +461,13 @@ int kvm_vgic_map_resources(struct kvm *kif (!irqchip_in_kernel (kvm)) goto out; -if (dist->vgic_model ==KVM_DEV_TYPE_ARM_VGIC_V2 ) +if (dist->vgic_model ==KVM_DEV_TYPE_ARM_VGIC_V2 ) { ret =vgic_v2_map_resources (kvm); -else + type =VGIC_V2 ; + }else { ret =vgic_v3_map_resources (kvm); + type =VGIC_V3 ; + }if (ret) {__kvm_vgic_destroy (kvm);
@@ -473,8 +477,7 @@ int kvm_vgic_map_resources(struct kvm *k dist_base = dist->vgic_dist_base;mutex_unlock (&kvm->arch.config_lock); - ret =vgic_register_dist_iodev (kvm, dist_base, - kvm_vgic_global_state.type); + ret =vgic_register_dist_iodev (kvm, dist_base, type);if (ret) {kvm_err ("Unable to register VGIC dist MMIO regions\n" );kvm_vgic_destroy (kvm);
Greg Kroah-Hartman
maintainerPATCH 197/199 ksmbd: fix uninitialized pointer read in ksmbd_vfs_rename()
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 48b47f0caaa8a9f05ed803cb4f335fa3a7bfc622 upstream.
Uninitialized rd.delegated_inode can be used in vfs_rename(). Fix this by setting rd.delegated_inode to NULL to avoid the uninitialized read.
--- fs/ksmbd/vfs.c | 1 + 1 file changed, 1 insertion(+)
fs/ksmbd/vfs.c +1 -0
@@ -769,6 +769,7 @@ retry: rd.new_dir = new_path.dentry->d_inode, rd.new_dentry = new_dentry, rd.flags = flags, + rd.delegated_inode =NULL , err =vfs_rename (&rd);if (err)ksmbd_debug (VFS ,"vfs_rename failed err %d\n" , err);
Greg Kroah-Hartman
maintainerPATCH 198/199 ksmbd: fix uninitialized pointer read in smb2_create_link()
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit df14afeed2e6c1bbadef7d2f9c46887bbd6d8d94 upstream.
There is a case that file_present is true and path is uninitialized. This patch change file_present is set to false by default and set to true when patch is initialized.
--- fs/ksmbd/smb2pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ksmbd/smb2pdu.c +3 -3
@@ -5560,7 +5560,7 @@ static int smb2_create_link(struct ksmbd { char *link_name = NULL, *target_name = NULL, *pathname = NULL; struct path path; - bool file_present = true; + bool file_present = false; int rc; if (buf_len < (u64)sizeof(struct smb2_file_link_info) +
@@ -5593,8 +5593,8 @@ static int smb2_create_link(struct ksmbdif (rc) {if (rc != -ENOENT ) goto out; - file_present = false; - } + }else + file_present = true;if (file_info->ReplaceIfExists) {if (file_present) {
Greg Kroah-Hartman
maintainerPATCH 199/199 ksmbd: call putname after using the last component
In reply to Greg Kroah-HartmanFrom: Namjae Jeon <[email protected]>
commit 6fe55c2799bc29624770c26f98ba7b06214f43e0 upstream.
last component point filename struct. Currently putname is called after vfs_path_parent_lookup(). And then last component is used for lookup_one_qstr_excl(). name in last component is freed by previous calling putname(). And It cause file lookup failure when testing generic/464 test of xfstest.
--- fs/ksmbd/vfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ksmbd/vfs.c +6 -2
@@ -86,12 +86,14 @@ static int ksmbd_vfs_path_lookup_locked( err =vfs_path_parent_lookup (filename, flags, &parent_path, &last, &type, root_share_path); -putname (filename); -if (err) +if (err) { +putname (filename);return err; + }if (unlikely (type !=LAST_NORM )) {path_put (&parent_path); +putname (filename);return -ENOENT ; }
@@ -108,12 +110,14 @@ static int ksmbd_vfs_path_lookup_locked( path->dentry = d; path->mnt = share_conf->vfs_path.mnt;path_put (&parent_path); +putname (filename);return 0 ; err_out:inode_unlock (parent_path.dentry->d_inode);path_put (&parent_path); +putname (filename);return -ENOENT ; }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.3:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
130 tests: 130 pass, 0 failLinux version: 6.3.10-rc1-g3d49488718bf
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
Hi Greg
6.3.10-rc1
compiles, boots and runs here on x86_64
(AMD Ryzen 5 PRO 4650G, Slackware64-15.0)
Hi Greg,
Quoted 10 lines
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, June 26, 2023 7:08 PMThis is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
Thank you for the release!
CIP configurations built and booted okay with Linux 6.3.10-rc1 (3d49488718bf):
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/912372689
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/commits/linux-6.3.y
Kind regards, Chris
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
Build results:
total: 153 pass: 153 fail: 0 Qemu test results: total: 520 pass: 520 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.3.10-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.3.y
* git commit: 3d49488718bf7f62bf7e49db5f677e4ad0d5a900
* git describe: v6.3.9-200-g3d49488718bf
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.3.y/build/v6.3.9-200-g3d49488718bf
## Test Regressions (compared to v6.3.9)
## Metric Regressions (compared to v6.3.9)
## Test Fixes (compared to v6.3.9)
## Metric Fixes (compared to v6.3.9)
## Test result summary
total: 189021, pass: 155522, fail: 3063, skip: 30272, xfail: 164
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 145 total, 144 passed, 1 failed
* arm64: 54 total, 53 passed, 1 failed
* i386: 41 total, 40 passed, 1 failed
* mips: 30 total, 28 passed, 2 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 38 total, 36 passed, 2 failed
* riscv: 26 total, 25 passed, 1 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 8 passed, 0 failed
* x86_64: 46 total, 46 passed, 0 failed
## Test suites summary
* boot
* fwts
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Cheers,
Conor.
Quoted 9 lines
This is the start of the stable review cycle for the 6.3.10 release. There are 199 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 28 Jun 2023 18:07:23 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my x86_64 and ARM64 test systems. No errors or regressions.
Thanks.