]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Mon, 31 Oct 2022 15:23:39 +0000 (11:23 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 31 Oct 2022 15:23:39 +0000 (11:23 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
20 files changed:
queue-4.9/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch [new file with mode: 0644]
queue-4.9/alsa-aoa-fix-i2s-device-accounting.patch [new file with mode: 0644]
queue-4.9/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch [new file with mode: 0644]
queue-4.9/arc-iounmap-arg-is-volatile.patch [new file with mode: 0644]
queue-4.9/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch [new file with mode: 0644]
queue-4.9/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch [new file with mode: 0644]
queue-4.9/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch [new file with mode: 0644]
queue-4.9/kcm-annotate-data-races-around-kcm-rx_psock.patch [new file with mode: 0644]
queue-4.9/kcm-annotate-data-races-around-kcm-rx_wait.patch [new file with mode: 0644]
queue-4.9/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch [new file with mode: 0644]
queue-4.9/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch [new file with mode: 0644]
queue-4.9/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch [new file with mode: 0644]
queue-4.9/media-vivid-s_fbuf-add-more-sanity-checks.patch [new file with mode: 0644]
queue-4.9/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch [new file with mode: 0644]
queue-4.9/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch [new file with mode: 0644]
queue-4.9/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch [new file with mode: 0644]
queue-4.9/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch [new file with mode: 0644]
queue-4.9/openvswitch-switch-from-warn-to-pr_warn.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch [new file with mode: 0644]

diff --git a/queue-4.9/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch b/queue-4.9/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch
new file mode 100644 (file)
index 0000000..5a544bf
--- /dev/null
@@ -0,0 +1,37 @@
+From 94ca3d2c015e7fda3f373b047d0ae522ebdfc9e2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:30:25 +0800
+Subject: ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]
+
+If device_register() fails in snd_ac97_dev_register(), it should
+call put_device() to give up reference, or the name allocated in
+dev_set_name() is leaked.
+
+Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/ac97/ac97_codec.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
+index a7f1e4ef3f88..4a420f4303a7 100644
+--- a/sound/pci/ac97/ac97_codec.c
++++ b/sound/pci/ac97/ac97_codec.c
+@@ -1965,6 +1965,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
+                    snd_ac97_get_short_name(ac97));
+       if ((err = device_register(&ac97->dev)) < 0) {
+               ac97_err(ac97, "Can't register ac97 bus\n");
++              put_device(&ac97->dev);
+               ac97->dev.bus = NULL;
+               return err;
+       }
+-- 
+2.35.1
+
diff --git a/queue-4.9/alsa-aoa-fix-i2s-device-accounting.patch b/queue-4.9/alsa-aoa-fix-i2s-device-accounting.patch
new file mode 100644 (file)
index 0000000..21746ac
--- /dev/null
@@ -0,0 +1,49 @@
+From 89ac200776613098ed7cebf128624ddf7bac4729 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 08:52:33 +0200
+Subject: ALSA: aoa: Fix I2S device accounting
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit f1fae475f10a26b7e34da4ff2e2f19b7feb3548e ]
+
+i2sbus_add_dev() is supposed to return the number of probed devices,
+i.e. either 1 or 0.  However, i2sbus_add_dev() has one error handling
+that returns -ENODEV; this will screw up the accumulation number
+counted in the caller, i2sbus_probe().
+
+Fix the return value to 0 and add the comment for better understanding
+for readers.
+
+Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
+Link: https://lore.kernel.org/r/20221027065233.13292-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/aoa/soundbus/i2sbus/core.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
+index c016df586992..2811e1f1e2fa 100644
+--- a/sound/aoa/soundbus/i2sbus/core.c
++++ b/sound/aoa/soundbus/i2sbus/core.c
+@@ -148,6 +148,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
+       return rc;
+ }
++/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
+ /* FIXME: look at device node refcounting */
+ static int i2sbus_add_dev(struct macio_dev *macio,
+                         struct i2sbus_control *control,
+@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+        * either as the second one in that case is just a modem. */
+       if (!ok) {
+               kfree(dev);
+-              return -ENODEV;
++              return 0;
+       }
+       mutex_init(&dev->lock);
+-- 
+2.35.1
+
diff --git a/queue-4.9/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch b/queue-4.9/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch
new file mode 100644 (file)
index 0000000..0d7fb30
--- /dev/null
@@ -0,0 +1,42 @@
+From 1465f69de7a3ea5e5f4bc81c69dc3da7f045d77d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 09:34:38 +0800
+Subject: ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 4a4c8482e370d697738a78dcd7bf2780832cb712 ]
+
+dev_set_name() in soundbus_add_one() allocates memory for name, it need be
+freed when of_device_register() fails, call soundbus_dev_put() to give up
+the reference that hold in device_initialize(), so that it can be freed in
+kobject_cleanup() when the refcount hit to 0. And other resources are also
+freed in i2sbus_release_dev(), so it can return 0 directly.
+
+Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221027013438.991920-1-yangyingliang@huawei.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/aoa/soundbus/i2sbus/core.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
+index 000b58522106..c016df586992 100644
+--- a/sound/aoa/soundbus/i2sbus/core.c
++++ b/sound/aoa/soundbus/i2sbus/core.c
+@@ -302,6 +302,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+       if (soundbus_add_one(&dev->sound)) {
+               printk(KERN_DEBUG "i2sbus: device registration error!\n");
++              if (dev->sound.ofdev.dev.kobj.state_initialized) {
++                      soundbus_dev_put(&dev->sound);
++                      return 0;
++              }
+               goto err;
+       }
+-- 
+2.35.1
+
diff --git a/queue-4.9/arc-iounmap-arg-is-volatile.patch b/queue-4.9/arc-iounmap-arg-is-volatile.patch
new file mode 100644 (file)
index 0000000..f2362ff
--- /dev/null
@@ -0,0 +1,59 @@
+From 3d2ef397de19c32cb5441ad55b0cb7a08c463b9a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 9 Oct 2022 19:28:46 -0700
+Subject: arc: iounmap() arg is volatile
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit c44f15c1c09481d50fd33478ebb5b8284f8f5edb ]
+
+Add 'volatile' to iounmap()'s argument to prevent build warnings.
+This make it the same as other major architectures.
+
+Placates these warnings: (12 such warnings)
+
+../drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe':
+../drivers/video/fbdev/riva/fbdev.c:2067:42: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Werror=discarded-qualifiers]
+ 2067 |                 iounmap(default_par->riva.PRAMIN);
+
+Fixes: 1162b0701b14b ("ARC: I/O and DMA Mappings")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Cc: Vineet Gupta <vgupta@kernel.org>
+Cc: linux-snps-arc@lists.infradead.org
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Vineet Gupta <vgupta@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arc/include/asm/io.h | 2 +-
+ arch/arc/mm/ioremap.c     | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
+index 2f39d9b3886e..19d0cab60a39 100644
+--- a/arch/arc/include/asm/io.h
++++ b/arch/arc/include/asm/io.h
+@@ -35,7 +35,7 @@ static inline void ioport_unmap(void __iomem *addr)
+ {
+ }
+-extern void iounmap(const void __iomem *addr);
++extern void iounmap(const volatile void __iomem *addr);
+ #define ioremap_nocache(phy, sz)      ioremap(phy, sz)
+ #define ioremap_wc(phy, sz)           ioremap(phy, sz)
+diff --git a/arch/arc/mm/ioremap.c b/arch/arc/mm/ioremap.c
+index 9881bd740ccc..0719b1280ef8 100644
+--- a/arch/arc/mm/ioremap.c
++++ b/arch/arc/mm/ioremap.c
+@@ -95,7 +95,7 @@ void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
+ EXPORT_SYMBOL(ioremap_prot);
+-void iounmap(const void __iomem *addr)
++void iounmap(const volatile void __iomem *addr)
+ {
+       /* weird double cast to handle phys_addr_t > 32 bits */
+       if (arc_uncached_addr_space((phys_addr_t)(u32)addr))
+-- 
+2.35.1
+
diff --git a/queue-4.9/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch b/queue-4.9/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch
new file mode 100644 (file)
index 0000000..f37ae57
--- /dev/null
@@ -0,0 +1,60 @@
+From 7f1465a380d24715b751b41ec0ff4769b9f4e8b8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 19:48:07 +0800
+Subject: can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in
+ error path
+
+From: Dongliang Mu <dzm91@hust.edu.cn>
+
+[ Upstream commit 3e5b3418827cefb5e1cc658806f02965791b8f07 ]
+
+The commit 1149108e2fbf ("can: mscan: improve clock API use") only
+adds put_clock() in mpc5xxx_can_remove() function, forgetting to add
+put_clock() in the error handling code.
+
+Fix this bug by adding put_clock() in the error handling code.
+
+Fixes: 1149108e2fbf ("can: mscan: improve clock API use")
+Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
+Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@pengutronix.de
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/can/mscan/mpc5xxx_can.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
+index 2949a381a94d..21993ba7ae2a 100644
+--- a/drivers/net/can/mscan/mpc5xxx_can.c
++++ b/drivers/net/can/mscan/mpc5xxx_can.c
+@@ -336,14 +336,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
+                                              &mscan_clksrc);
+       if (!priv->can.clock.freq) {
+               dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+       err = register_mscandev(dev, mscan_clksrc);
+       if (err) {
+               dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
+                       DRV_NAME, err);
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+       dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
+@@ -351,7 +351,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
+       return 0;
+-exit_free_mscan:
++exit_put_clock:
++      if (data->put_clock)
++              data->put_clock(ofdev);
+       free_candev(dev);
+ exit_dispose_irq:
+       irq_dispose_mapping(irq);
+-- 
+2.35.1
+
diff --git a/queue-4.9/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch b/queue-4.9/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch
new file mode 100644 (file)
index 0000000..a0d75ac
--- /dev/null
@@ -0,0 +1,54 @@
+From a790dbc4f71defac805f79d9230d4a15cfb9a165 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Sep 2022 13:55:48 -0700
+Subject: drm/msm: Fix return type of mdp4_lvds_connector_mode_valid
+
+From: Nathan Huckleberry <nhuck@google.com>
+
+[ Upstream commit 0b33a33bd15d5bab73b87152b220a8d0153a4587 ]
+
+The mode_valid field in drm_connector_helper_funcs is expected to be of
+type:
+enum drm_mode_status (* mode_valid) (struct drm_connector *connector,
+                                     struct drm_display_mode *mode);
+
+The mismatched return type breaks forward edge kCFI since the underlying
+function definition does not match the function hook definition.
+
+The return type of mdp4_lvds_connector_mode_valid should be changed from
+int to enum drm_mode_status.
+
+Reported-by: Dan Carpenter <error27@gmail.com>
+Link: https://github.com/ClangBuiltLinux/linux/issues/1703
+Cc: llvm@lists.linux.dev
+Signed-off-by: Nathan Huckleberry <nhuck@google.com>
+Fixes: 3e87599b68e7 ("drm/msm/mdp4: add LVDS panel support")
+Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Patchwork: https://patchwork.freedesktop.org/patch/502878/
+Link: https://lore.kernel.org/r/20220913205551.155128-1-nhuck@google.com
+Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
+index 353429b05733..905391ea55da 100644
+--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
++++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
+@@ -71,8 +71,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
+       return ret;
+ }
+-static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
+-                               struct drm_display_mode *mode)
++static enum drm_mode_status
++mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
++                             struct drm_display_mode *mode)
+ {
+       struct mdp4_lvds_connector *mdp4_lvds_connector =
+                       to_mdp4_lvds_connector(connector);
+-- 
+2.35.1
+
diff --git a/queue-4.9/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch b/queue-4.9/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch
new file mode 100644 (file)
index 0000000..8a1cc4d
--- /dev/null
@@ -0,0 +1,129 @@
+From ec0d5d6828bdace2575ce9ffb29353f5d5668fa6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 03:05:24 -0700
+Subject: i40e: Fix ethtool rx-flow-hash setting for X722
+
+From: Slawomir Laba <slawomirx.laba@intel.com>
+
+[ Upstream commit 54b5af5a438076082d482cab105b1bd484ab5074 ]
+
+When enabling flow type for RSS hash via ethtool:
+
+ethtool -N $pf rx-flow-hash tcp4|tcp6|udp4|udp6 s|d
+
+the driver would fail to setup this setting on X722
+device since it was using the mask on the register
+dedicated for X710 devices.
+
+Apply a different mask on the register when setting the
+RSS hash for the X722 device.
+
+When displaying the flow types enabled via ethtool:
+
+ethtool -n $pf rx-flow-hash tcp4|tcp6|udp4|udp6
+
+the driver would print wrong values for X722 device.
+
+Fix this issue by testing masks for X722 device in
+i40e_get_rss_hash_opts function.
+
+Fixes: eb0dd6e4a3b3 ("i40e: Allow RSS Hash set with less than four parameters")
+Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
+Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
+Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
+Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Link: https://lore.kernel.org/r/20221024100526.1874914-1-jacob.e.keller@intel.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/intel/i40e/i40e_ethtool.c    | 31 ++++++++++++++-----
+ drivers/net/ethernet/intel/i40e/i40e_type.h   |  4 +++
+ 2 files changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+index f4569461dcb8..71105a6c231d 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+@@ -2263,10 +2263,17 @@ static int i40e_get_rss_hash_opts(struct i40e_pf *pf, struct ethtool_rxnfc *cmd)
+               if (cmd->flow_type == TCP_V4_FLOW ||
+                   cmd->flow_type == UDP_V4_FLOW) {
+-                      if (i_set & I40E_L3_SRC_MASK)
+-                              cmd->data |= RXH_IP_SRC;
+-                      if (i_set & I40E_L3_DST_MASK)
+-                              cmd->data |= RXH_IP_DST;
++                      if (hw->mac.type == I40E_MAC_X722) {
++                              if (i_set & I40E_X722_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_X722_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      } else {
++                              if (i_set & I40E_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      }
+               } else if (cmd->flow_type == TCP_V6_FLOW ||
+                         cmd->flow_type == UDP_V6_FLOW) {
+                       if (i_set & I40E_L3_V6_SRC_MASK)
+@@ -2419,12 +2426,15 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
+ /**
+  * i40e_get_rss_hash_bits - Read RSS Hash bits from register
++ * @hw: hw structure
+  * @nfc: pointer to user request
+  * @i_setc bits currently set
+  *
+  * Returns value of bits to be set per user request
+  **/
+-static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc)
++static u64 i40e_get_rss_hash_bits(struct i40e_hw *hw,
++                                struct ethtool_rxnfc *nfc,
++                                u64 i_setc)
+ {
+       u64 i_set = i_setc;
+       u64 src_l3 = 0, dst_l3 = 0;
+@@ -2443,8 +2453,13 @@ static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc)
+               dst_l3 = I40E_L3_V6_DST_MASK;
+       } else if (nfc->flow_type == TCP_V4_FLOW ||
+                 nfc->flow_type == UDP_V4_FLOW) {
+-              src_l3 = I40E_L3_SRC_MASK;
+-              dst_l3 = I40E_L3_DST_MASK;
++              if (hw->mac.type == I40E_MAC_X722) {
++                      src_l3 = I40E_X722_L3_SRC_MASK;
++                      dst_l3 = I40E_X722_L3_DST_MASK;
++              } else {
++                      src_l3 = I40E_L3_SRC_MASK;
++                      dst_l3 = I40E_L3_DST_MASK;
++              }
+       } else {
+               /* Any other flow type are not supported here */
+               return i_set;
+@@ -2553,7 +2568,7 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
+                                              flow_pctype)) |
+                       ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
+                                              flow_pctype)) << 32);
+-              i_set = i40e_get_rss_hash_bits(nfc, i_setc);
++              i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_pctype),
+                                 (u32)i_set);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_pctype),
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
+index bd5f13bef83c..a855de9ff1c1 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
+@@ -1542,6 +1542,10 @@ struct i40e_lldp_variables {
+ #define I40E_PFQF_CTL_0_HASHLUTSIZE_512       0x00010000
+ /* INPUT SET MASK for RSS, flow director, and flexible payload */
++#define I40E_X722_L3_SRC_SHIFT                49
++#define I40E_X722_L3_SRC_MASK         (0x3ULL << I40E_X722_L3_SRC_SHIFT)
++#define I40E_X722_L3_DST_SHIFT                41
++#define I40E_X722_L3_DST_MASK         (0x3ULL << I40E_X722_L3_DST_SHIFT)
+ #define I40E_L3_SRC_SHIFT             47
+ #define I40E_L3_SRC_MASK              (0x3ULL << I40E_L3_SRC_SHIFT)
+ #define I40E_L3_V6_SRC_SHIFT          43
+-- 
+2.35.1
+
diff --git a/queue-4.9/kcm-annotate-data-races-around-kcm-rx_psock.patch b/queue-4.9/kcm-annotate-data-races-around-kcm-rx_psock.patch
new file mode 100644 (file)
index 0000000..9ab7211
--- /dev/null
@@ -0,0 +1,101 @@
+From 0e8bb641f7bfcaf75a7b190899757fb08860d1f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 22:45:11 +0000
+Subject: kcm: annotate data-races around kcm->rx_psock
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 15e4dabda11b0fa31d510a915d1a580f47dfc92e ]
+
+kcm->rx_psock can be read locklessly in kcm_rfree().
+Annotate the read and writes accordingly.
+
+We do the same for kcm->rx_wait in the following patch.
+
+syzbot reported:
+BUG: KCSAN: data-race in kcm_rfree / unreserve_rx_kcm
+
+write to 0xffff888123d827b8 of 8 bytes by task 2758 on cpu 1:
+unreserve_rx_kcm+0x72/0x1f0 net/kcm/kcmsock.c:313
+kcm_rcv_strparser+0x2b5/0x3a0 net/kcm/kcmsock.c:373
+__strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
+strp_recv+0x6d/0x80 net/strparser/strparser.c:335
+tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
+strp_read_sock net/strparser/strparser.c:358 [inline]
+do_strp_work net/strparser/strparser.c:406 [inline]
+strp_work+0xe8/0x180 net/strparser/strparser.c:415
+process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
+worker_thread+0x618/0xa70 kernel/workqueue.c:2436
+kthread+0x1a9/0x1e0 kernel/kthread.c:376
+ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
+
+read to 0xffff888123d827b8 of 8 bytes by task 5859 on cpu 0:
+kcm_rfree+0x14c/0x220 net/kcm/kcmsock.c:181
+skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
+skb_release_all net/core/skbuff.c:852 [inline]
+__kfree_skb net/core/skbuff.c:868 [inline]
+kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
+kfree_skb include/linux/skbuff.h:1216 [inline]
+kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
+____sys_recvmsg+0x16c/0x2e0
+___sys_recvmsg net/socket.c:2743 [inline]
+do_recvmmsg+0x2f1/0x710 net/socket.c:2837
+__sys_recvmmsg net/socket.c:2916 [inline]
+__do_sys_recvmmsg net/socket.c:2939 [inline]
+__se_sys_recvmmsg net/socket.c:2932 [inline]
+__x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+value changed: 0xffff88812971ce00 -> 0x0000000000000000
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 0 PID: 5859 Comm: syz-executor.3 Not tainted 6.0.0-syzkaller-12189-g19d17ab7c68b-dirty #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
+
+Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/kcm/kcmsock.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index 2f3cd09ee0df..9ba4ac8053b2 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -178,7 +178,7 @@ static void kcm_rfree(struct sk_buff *skb)
+       /* For reading rx_wait and rx_psock without holding lock */
+       smp_mb__after_atomic();
+-      if (!kcm->rx_wait && !kcm->rx_psock &&
++      if (!kcm->rx_wait && !READ_ONCE(kcm->rx_psock) &&
+           sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) {
+               spin_lock_bh(&mux->rx_lock);
+               kcm_rcv_ready(kcm);
+@@ -283,7 +283,8 @@ static struct kcm_sock *reserve_rx_kcm(struct kcm_psock *psock,
+       kcm->rx_wait = false;
+       psock->rx_kcm = kcm;
+-      kcm->rx_psock = psock;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, psock);
+       spin_unlock_bh(&mux->rx_lock);
+@@ -310,7 +311,8 @@ static void unreserve_rx_kcm(struct kcm_psock *psock,
+       spin_lock_bh(&mux->rx_lock);
+       psock->rx_kcm = NULL;
+-      kcm->rx_psock = NULL;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, NULL);
+       /* Commit kcm->rx_psock before sk_rmem_alloc_get to sync with
+        * kcm_rfree
+-- 
+2.35.1
+
diff --git a/queue-4.9/kcm-annotate-data-races-around-kcm-rx_wait.patch b/queue-4.9/kcm-annotate-data-races-around-kcm-rx_wait.patch
new file mode 100644 (file)
index 0000000..f9b598d
--- /dev/null
@@ -0,0 +1,130 @@
+From 90116132e6e3afd0fe1356f96430dc71e95fbfb5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 22:45:12 +0000
+Subject: kcm: annotate data-races around kcm->rx_wait
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 0c745b5141a45a076f1cb9772a399f7ebcb0948a ]
+
+kcm->rx_psock can be read locklessly in kcm_rfree().
+Annotate the read and writes accordingly.
+
+syzbot reported:
+
+BUG: KCSAN: data-race in kcm_rcv_strparser / kcm_rfree
+
+write to 0xffff88810784e3d0 of 1 bytes by task 1823 on cpu 1:
+reserve_rx_kcm net/kcm/kcmsock.c:283 [inline]
+kcm_rcv_strparser+0x250/0x3a0 net/kcm/kcmsock.c:363
+__strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
+strp_recv+0x6d/0x80 net/strparser/strparser.c:335
+tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
+strp_read_sock net/strparser/strparser.c:358 [inline]
+do_strp_work net/strparser/strparser.c:406 [inline]
+strp_work+0xe8/0x180 net/strparser/strparser.c:415
+process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
+worker_thread+0x618/0xa70 kernel/workqueue.c:2436
+kthread+0x1a9/0x1e0 kernel/kthread.c:376
+ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
+
+read to 0xffff88810784e3d0 of 1 bytes by task 17869 on cpu 0:
+kcm_rfree+0x121/0x220 net/kcm/kcmsock.c:181
+skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
+skb_release_all net/core/skbuff.c:852 [inline]
+__kfree_skb net/core/skbuff.c:868 [inline]
+kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
+kfree_skb include/linux/skbuff.h:1216 [inline]
+kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
+____sys_recvmsg+0x16c/0x2e0
+___sys_recvmsg net/socket.c:2743 [inline]
+do_recvmmsg+0x2f1/0x710 net/socket.c:2837
+__sys_recvmmsg net/socket.c:2916 [inline]
+__do_sys_recvmmsg net/socket.c:2939 [inline]
+__se_sys_recvmmsg net/socket.c:2932 [inline]
+__x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+value changed: 0x01 -> 0x00
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 0 PID: 17869 Comm: syz-executor.2 Not tainted 6.1.0-rc1-syzkaller-00010-gbb1a1146467a-dirty #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
+
+Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/kcm/kcmsock.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index 9ba4ac8053b2..b464c711e9c0 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -162,7 +162,8 @@ static void kcm_rcv_ready(struct kcm_sock *kcm)
+       /* Buffer limit is okay now, add to ready list */
+       list_add_tail(&kcm->wait_rx_list,
+                     &kcm->mux->kcm_rx_waiters);
+-      kcm->rx_wait = true;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, true);
+ }
+ static void kcm_rfree(struct sk_buff *skb)
+@@ -178,7 +179,7 @@ static void kcm_rfree(struct sk_buff *skb)
+       /* For reading rx_wait and rx_psock without holding lock */
+       smp_mb__after_atomic();
+-      if (!kcm->rx_wait && !READ_ONCE(kcm->rx_psock) &&
++      if (!READ_ONCE(kcm->rx_wait) && !READ_ONCE(kcm->rx_psock) &&
+           sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) {
+               spin_lock_bh(&mux->rx_lock);
+               kcm_rcv_ready(kcm);
+@@ -237,7 +238,8 @@ static void requeue_rx_msgs(struct kcm_mux *mux, struct sk_buff_head *head)
+               if (kcm_queue_rcv_skb(&kcm->sk, skb)) {
+                       /* Should mean socket buffer full */
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+                       /* Commit rx_wait to read in kcm_free */
+                       smp_wmb();
+@@ -280,7 +282,8 @@ static struct kcm_sock *reserve_rx_kcm(struct kcm_psock *psock,
+       kcm = list_first_entry(&mux->kcm_rx_waiters,
+                              struct kcm_sock, wait_rx_list);
+       list_del(&kcm->wait_rx_list);
+-      kcm->rx_wait = false;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, false);
+       psock->rx_kcm = kcm;
+       /* paired with lockless reads in kcm_rfree() */
+@@ -1240,7 +1243,8 @@ static void kcm_recv_disable(struct kcm_sock *kcm)
+       if (!kcm->rx_psock) {
+               if (kcm->rx_wait) {
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+               }
+               requeue_rx_msgs(mux, &kcm->sk.sk_receive_queue);
+@@ -1800,7 +1804,8 @@ static void kcm_done(struct kcm_sock *kcm)
+       if (kcm->rx_wait) {
+               list_del(&kcm->wait_rx_list);
+-              kcm->rx_wait = false;
++              /* paired with lockless reads in kcm_rfree() */
++              WRITE_ONCE(kcm->rx_wait, false);
+       }
+       /* Move any pending receive messages to other kcm sockets */
+       requeue_rx_msgs(mux, &sk->sk_receive_queue);
+-- 
+2.35.1
+
diff --git a/queue-4.9/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch b/queue-4.9/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch
new file mode 100644 (file)
index 0000000..57aaff5
--- /dev/null
@@ -0,0 +1,48 @@
+From 531ac9100e6bcdf1f2e894a7b5df85bb11faf895 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 09:00:34 +0100
+Subject: media: v4l2-dv-timings: add sanity checks for blanking values
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 4b6d66a45ed34a15721cb9e11492fa1a24bc83df ]
+
+Add sanity checks to v4l2_valid_dv_timings() to ensure that the provided
+blanking values are reasonable.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: b18787ed1ce3 ([media] v4l2-dv-timings: add new helper module)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/v4l2-core/v4l2-dv-timings.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
+index 730a7c392c1d..12e04ac6a9ee 100644
+--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
++++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
+@@ -171,6 +171,20 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t,
+           (bt->interlaced && !(caps & V4L2_DV_BT_CAP_INTERLACED)) ||
+           (!bt->interlaced && !(caps & V4L2_DV_BT_CAP_PROGRESSIVE)))
+               return false;
++
++      /* sanity checks for the blanking timings */
++      if (!bt->interlaced &&
++          (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))
++              return false;
++      if (bt->hfrontporch > 2 * bt->width ||
++          bt->hsync > 1024 || bt->hbackporch > 1024)
++              return false;
++      if (bt->vfrontporch > 4096 ||
++          bt->vsync > 128 || bt->vbackporch > 4096)
++              return false;
++      if (bt->interlaced && (bt->il_vfrontporch > 4096 ||
++          bt->il_vsync > 128 || bt->il_vbackporch > 4096))
++              return false;
+       return fnc == NULL || fnc(t, fnc_handle);
+ }
+ EXPORT_SYMBOL_GPL(v4l2_valid_dv_timings);
+-- 
+2.35.1
+
diff --git a/queue-4.9/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch b/queue-4.9/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch
new file mode 100644 (file)
index 0000000..3234d7f
--- /dev/null
@@ -0,0 +1,38 @@
+From 0dcf03fc5856463eea1f700eaa2e48aa1af0d541 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Oct 2022 16:46:17 +0100
+Subject: media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check
+ 'interlaced'
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 8da7f0976b9071b528c545008de9d10cc81883b1 ]
+
+If it is a progressive (non-interlaced) format, then ignore the
+interlaced timing values.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: 7f68127fa11f ([media] videodev2.h: defines to calculate blanking and frame sizes)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/uapi/linux/videodev2.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index 7f34d3c67648..4a38dc2a61e6 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -1318,7 +1318,8 @@ struct v4l2_bt_timings {
+       ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
+ #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
+       ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \
+-       (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
++       ((bt)->interlaced ? \
++        ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0))
+ #define V4L2_DV_BT_FRAME_HEIGHT(bt) \
+       ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
+-- 
+2.35.1
+
diff --git a/queue-4.9/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch b/queue-4.9/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch
new file mode 100644 (file)
index 0000000..075e4e2
--- /dev/null
@@ -0,0 +1,75 @@
+From f639c27c4631460fd9ed432ace526d498d7d02c7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 15:18:46 +0100
+Subject: media: vivid: dev->bitmap_cap wasn't freed in all cases
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 1f65ea411cc7b6ff128d82a3493d7b5648054e6f ]
+
+Whenever the compose width/height values change, the dev->bitmap_cap
+vmalloc'ed array must be freed and dev->bitmap_cap set to NULL.
+
+This was done in some places, but not all. This is only an issue if
+overlay support is enabled and the bitmap clipping is used.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/vivid/vivid-vid-cap.c | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
+index a32910ac90bd..198b26687b57 100644
+--- a/drivers/media/platform/vivid/vivid-vid-cap.c
++++ b/drivers/media/platform/vivid/vivid-vid-cap.c
+@@ -455,6 +455,12 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
+       tpg_reset_source(&dev->tpg, dev->src_rect.width, dev->src_rect.height, dev->field_cap);
+       dev->crop_cap = dev->src_rect;
+       dev->crop_bounds_cap = dev->src_rect;
++      if (dev->bitmap_cap &&
++          (dev->compose_cap.width != dev->crop_cap.width ||
++           dev->compose_cap.height != dev->crop_cap.height)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       dev->compose_cap = dev->crop_cap;
+       if (V4L2_FIELD_HAS_T_OR_B(dev->field_cap))
+               dev->compose_cap.height /= 2;
+@@ -863,6 +869,8 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
+       struct vivid_dev *dev = video_drvdata(file);
+       struct v4l2_rect *crop = &dev->crop_cap;
+       struct v4l2_rect *compose = &dev->compose_cap;
++      unsigned orig_compose_w = compose->width;
++      unsigned orig_compose_h = compose->height;
+       unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev->field_cap) ? 2 : 1;
+       int ret;
+@@ -979,17 +987,17 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
+                       s->r.height /= factor;
+               }
+               v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect);
+-              if (dev->bitmap_cap && (compose->width != s->r.width ||
+-                                      compose->height != s->r.height)) {
+-                      vfree(dev->bitmap_cap);
+-                      dev->bitmap_cap = NULL;
+-              }
+               *compose = s->r;
+               break;
+       default:
+               return -EINVAL;
+       }
++      if (dev->bitmap_cap && (compose->width != orig_compose_w ||
++                              compose->height != orig_compose_h)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       tpg_s_crop_compose(&dev->tpg, crop, compose);
+       return 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-4.9/media-vivid-s_fbuf-add-more-sanity-checks.patch b/queue-4.9/media-vivid-s_fbuf-add-more-sanity-checks.patch
new file mode 100644 (file)
index 0000000..d13132d
--- /dev/null
@@ -0,0 +1,90 @@
+From 0111c486d552c65ffef19d961d700ceba93e96cd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Oct 2022 15:32:28 +0100
+Subject: media: vivid: s_fbuf: add more sanity checks
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit f8bcaf714abfc94818dff8c0db84d750433984f4 ]
+
+VIDIOC_S_FBUF is by definition a scary ioctl, which is why only root
+can use it. But at least check if the framebuffer parameters match that
+of one of the framebuffer created by vivid, and reject anything else.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/vivid/vivid-core.c    | 22 ++++++++++++++++++++
+ drivers/media/platform/vivid/vivid-core.h    |  2 ++
+ drivers/media/platform/vivid/vivid-vid-cap.c |  9 +++++++-
+ 3 files changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
+index 5464fefbaab9..52d9dadbc49a 100644
+--- a/drivers/media/platform/vivid/vivid-core.c
++++ b/drivers/media/platform/vivid/vivid-core.c
+@@ -302,6 +302,28 @@ static int vidioc_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *a
+       return vivid_vid_out_g_fbuf(file, fh, a);
+ }
++/*
++ * Only support the framebuffer of one of the vivid instances.
++ * Anything else is rejected.
++ */
++bool vivid_validate_fb(const struct v4l2_framebuffer *a)
++{
++      struct vivid_dev *dev;
++      int i;
++
++      for (i = 0; i < n_devs; i++) {
++              dev = vivid_devs[i];
++              if (!dev || !dev->video_pbase)
++                      continue;
++              if ((unsigned long)a->base == dev->video_pbase &&
++                  a->fmt.width <= dev->display_width &&
++                  a->fmt.height <= dev->display_height &&
++                  a->fmt.bytesperline <= dev->display_byte_stride)
++                      return true;
++      }
++      return false;
++}
++
+ static int vidioc_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *a)
+ {
+       struct video_device *vdev = video_devdata(file);
+diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h
+index a7daa40d0a49..2b661b4eb9ca 100644
+--- a/drivers/media/platform/vivid/vivid-core.h
++++ b/drivers/media/platform/vivid/vivid-core.h
+@@ -561,4 +561,6 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
+       return dev->output_type[dev->output] == HDMI;
+ }
++bool vivid_validate_fb(const struct v4l2_framebuffer *a);
++
+ #endif
+diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
+index 82621260fc34..a32910ac90bd 100644
+--- a/drivers/media/platform/vivid/vivid-vid-cap.c
++++ b/drivers/media/platform/vivid/vivid-vid-cap.c
+@@ -1232,7 +1232,14 @@ int vivid_vid_cap_s_fbuf(struct file *file, void *fh,
+               return -EINVAL;
+       if (a->fmt.bytesperline < (a->fmt.width * fmt->bit_depth[0]) / 8)
+               return -EINVAL;
+-      if (a->fmt.height * a->fmt.bytesperline < a->fmt.sizeimage)
++      if (a->fmt.bytesperline > a->fmt.sizeimage / a->fmt.height)
++              return -EINVAL;
++
++      /*
++       * Only support the framebuffer of one of the vivid instances.
++       * Anything else is rejected.
++       */
++      if (!vivid_validate_fb(a))
+               return -EINVAL;
+       dev->fb_vbase_cap = phys_to_virt((unsigned long)a->base);
+-- 
+2.35.1
+
diff --git a/queue-4.9/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch b/queue-4.9/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch
new file mode 100644 (file)
index 0000000..667b3df
--- /dev/null
@@ -0,0 +1,39 @@
+From d4d5213faa79811270d6422fdfc346f254262d5c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 21:00:11 +0800
+Subject: net: ehea: fix possible memory leak in ehea_register_port()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 0e7ce23a917a9cc83ca3c779fbba836bca3bcf1e ]
+
+If of_device_register() returns error, the of node and the
+name allocated in dev_set_name() is leaked, call put_device()
+to give up the reference that was set in device_initialize(),
+so that of node is put in logical_port_release() and the name
+is freed in kobject_cleanup().
+
+Fixes: 1acf2318dd13 ("ehea: dynamic add / remove port")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221025130011.1071357-1-yangyingliang@huawei.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+index 6c70cba92df0..89f112d0c9f4 100644
+--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+@@ -2937,6 +2937,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
+       ret = of_device_register(&port->ofdev);
+       if (ret) {
+               pr_err("failed to register device. ret=%d\n", ret);
++              put_device(&port->ofdev.dev);
+               goto out;
+       }
+-- 
+2.35.1
+
diff --git a/queue-4.9/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch b/queue-4.9/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch
new file mode 100644 (file)
index 0000000..51aabd3
--- /dev/null
@@ -0,0 +1,121 @@
+From e8a4e8d9d1a5109cdf7f0973b8c07f43ba20625d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 10:42:13 +0800
+Subject: net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit d266935ac43d57586e311a087510fe6a084af742 ]
+
+When the ops_init() interface is invoked to initialize the net, but
+ops->init() fails, data is released. However, the ptr pointer in
+net->gen is invalid. In this case, when nfqnl_nf_hook_drop() is invoked
+to release the net, invalid address access occurs.
+
+The process is as follows:
+setup_net()
+       ops_init()
+               data = kzalloc(...)   ---> alloc "data"
+               net_assign_generic()  ---> assign "date" to ptr in net->gen
+               ...
+               ops->init()           ---> failed
+               ...
+               kfree(data);          ---> ptr in net->gen is invalid
+       ...
+       ops_exit_list()
+               ...
+               nfqnl_nf_hook_drop()
+                       *q = nfnl_queue_pernet(net) ---> q is invalid
+
+The following is the Call Trace information:
+BUG: KASAN: use-after-free in nfqnl_nf_hook_drop+0x264/0x280
+Read of size 8 at addr ffff88810396b240 by task ip/15855
+Call Trace:
+<TASK>
+dump_stack_lvl+0x8e/0xd1
+print_report+0x155/0x454
+kasan_report+0xba/0x1f0
+nfqnl_nf_hook_drop+0x264/0x280
+nf_queue_nf_hook_drop+0x8b/0x1b0
+__nf_unregister_net_hook+0x1ae/0x5a0
+nf_unregister_net_hooks+0xde/0x130
+ops_exit_list+0xb0/0x170
+setup_net+0x7ac/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+</TASK>
+
+Allocated by task 15855:
+kasan_save_stack+0x1e/0x40
+kasan_set_track+0x21/0x30
+__kasan_kmalloc+0xa1/0xb0
+__kmalloc+0x49/0xb0
+ops_init+0xe7/0x410
+setup_net+0x5aa/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Freed by task 15855:
+kasan_save_stack+0x1e/0x40
+kasan_set_track+0x21/0x30
+kasan_save_free_info+0x2a/0x40
+____kasan_slab_free+0x155/0x1b0
+slab_free_freelist_hook+0x11b/0x220
+__kmem_cache_free+0xa4/0x360
+ops_init+0xb9/0x410
+setup_net+0x5aa/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Fixes: f875bae06533 ("net: Automatically allocate per namespace data.")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/net_namespace.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
+index 48854eae294f..6ff81ccfb25b 100644
+--- a/net/core/net_namespace.c
++++ b/net/core/net_namespace.c
+@@ -94,6 +94,7 @@ static int net_assign_generic(struct net *net, int id, void *data)
+ static int ops_init(const struct pernet_operations *ops, struct net *net)
+ {
++      struct net_generic *ng;
+       int err = -ENOMEM;
+       void *data = NULL;
+@@ -112,7 +113,13 @@ static int ops_init(const struct pernet_operations *ops, struct net *net)
+       if (!err)
+               return 0;
++      if (ops->id && ops->size) {
+ cleanup:
++              ng = rcu_dereference_protected(net->gen,
++                                             lockdep_is_held(&pernet_ops_rwsem));
++              ng->ptr[*ops->id] = NULL;
++      }
++
+       kfree(data);
+ out:
+-- 
+2.35.1
+
diff --git a/queue-4.9/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch b/queue-4.9/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch
new file mode 100644 (file)
index 0000000..8f10f4d
--- /dev/null
@@ -0,0 +1,39 @@
+From 4de6de295917c54205554472db45f3a360e9885c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 21:13:38 +0800
+Subject: net: ksz884x: fix missing pci_disable_device() on error in
+ pcidev_init()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 5da6d65590a0698199df44d095e54b0ed1708178 ]
+
+pci_disable_device() need be called while module exiting, switch to use
+pcim_enable(), pci_disable_device() will be called in pcim_release()
+while unbinding device.
+
+Fixes: 8ca86fd83eae ("net: Micrel KSZ8841/2 PCI Ethernet driver")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221024131338.2848959-1-yangyingliang@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/micrel/ksz884x.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
+index 280e761d3a97..83c7345a04ef 100644
+--- a/drivers/net/ethernet/micrel/ksz884x.c
++++ b/drivers/net/ethernet/micrel/ksz884x.c
+@@ -6932,7 +6932,7 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id)
+       char banner[sizeof(version)];
+       struct ksz_switch *sw = NULL;
+-      result = pci_enable_device(pdev);
++      result = pcim_enable_device(pdev);
+       if (result)
+               return result;
+-- 
+2.35.1
+
diff --git a/queue-4.9/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch b/queue-4.9/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch
new file mode 100644 (file)
index 0000000..82fdfec
--- /dev/null
@@ -0,0 +1,35 @@
+From f0a004851c725f24e6039f7b98d087dcc8c22e53 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 09:32:24 +0800
+Subject: net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
+
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+
+[ Upstream commit 9c1eaa27ec599fcc25ed4970c0b73c247d147a2b ]
+
+The ndo_start_xmit() method must not free skb when returning
+NETDEV_TX_BUSY, since caller is going to requeue freed skb.
+
+Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")
+Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/lantiq_etop.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
+index a167fd7ee13e..1a2c1a309d22 100644
+--- a/drivers/net/ethernet/lantiq_etop.c
++++ b/drivers/net/ethernet/lantiq_etop.c
+@@ -488,7 +488,6 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
+       len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
+       if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
+-              dev_kfree_skb_any(skb);
+               netdev_err(dev, "tx ring full\n");
+               netif_tx_stop_queue(txq);
+               return NETDEV_TX_BUSY;
+-- 
+2.35.1
+
diff --git a/queue-4.9/openvswitch-switch-from-warn-to-pr_warn.patch b/queue-4.9/openvswitch-switch-from-warn-to-pr_warn.patch
new file mode 100644 (file)
index 0000000..fbeefe4
--- /dev/null
@@ -0,0 +1,42 @@
+From 75ce93fd373c1f6c1d01863fdb903216543f052d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 06:50:17 -0400
+Subject: openvswitch: switch from WARN to pr_warn
+
+From: Aaron Conole <aconole@redhat.com>
+
+[ Upstream commit fd954cc1919e35cb92f78671cab6e42d661945a3 ]
+
+As noted by Paolo Abeni, pr_warn doesn't generate any splat and can still
+preserve the warning to the user that feature downgrade occurred.  We
+likely cannot introduce other kinds of checks / enforcement here because
+syzbot can generate different genl versions to the datapath.
+
+Reported-by: syzbot+31cde0bef4bbf8ba2d86@syzkaller.appspotmail.com
+Fixes: 44da5ae5fbea ("openvswitch: Drop user features if old user space attempted to create datapath")
+Cc: Thomas Graf <tgraf@suug.ch>
+Signed-off-by: Aaron Conole <aconole@redhat.com>
+Acked-by: Ilya Maximets <i.maximets@ovn.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/openvswitch/datapath.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
+index 10423757e781..56999d8528a4 100644
+--- a/net/openvswitch/datapath.c
++++ b/net/openvswitch/datapath.c
+@@ -1556,7 +1556,8 @@ static void ovs_dp_reset_user_features(struct sk_buff *skb, struct genl_info *in
+       if (IS_ERR(dp))
+               return;
+-      WARN(dp->user_features, "Dropping previously announced user features\n");
++      pr_warn("%s: Dropping previously announced user features\n",
++              ovs_dp_name(dp));
+       dp->user_features = 0;
+ }
+-- 
+2.35.1
+
index 7559705c434c1f098436f1da33849e0bad68ed3e..1249533890de0c9c5b7ef4b601800c981506ad35 100644 (file)
@@ -23,3 +23,22 @@ xen-gntdev-don-t-ignore-kernel-unmapping-error.patch
 xen-gntdev-prevent-leaking-grants.patch
 mm-hugetlb-take-hugetlb_lock-before-decrementing-h-resv_huge_pages.patch
 net-ieee802154-fix-error-return-code-in-dgram_bind.patch
+drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch
+arc-iounmap-arg-is-volatile.patch
+alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch
+kcm-annotate-data-races-around-kcm-rx_psock.patch
+kcm-annotate-data-races-around-kcm-rx_wait.patch
+net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch
+net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch
+tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch
+can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch
+media-vivid-s_fbuf-add-more-sanity-checks.patch
+media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch
+media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch
+media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch
+i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch
+net-ksz884x-fix-missing-pci_disable_device-on-error-.patch
+alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch
+alsa-aoa-fix-i2s-device-accounting.patch
+openvswitch-switch-from-warn-to-pr_warn.patch
+net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch
diff --git a/queue-4.9/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch b/queue-4.9/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch
new file mode 100644 (file)
index 0000000..b39f1f3
--- /dev/null
@@ -0,0 +1,65 @@
+From c21d901ffaf4ad393484be166a3cfd5d0e30d5aa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 17:08:21 +0000
+Subject: tcp: fix indefinite deferral of RTO with SACK reneging
+
+From: Neal Cardwell <ncardwell@google.com>
+
+[ Upstream commit 3d2af9cce3133b3bc596a9d065c6f9d93419ccfb ]
+
+This commit fixes a bug that can cause a TCP data sender to repeatedly
+defer RTOs when encountering SACK reneging.
+
+The bug is that when we're in fast recovery in a scenario with SACK
+reneging, every time we get an ACK we call tcp_check_sack_reneging()
+and it can note the apparent SACK reneging and rearm the RTO timer for
+srtt/2 into the future. In some SACK reneging scenarios that can
+happen repeatedly until the receive window fills up, at which point
+the sender can't send any more, the ACKs stop arriving, and the RTO
+fires at srtt/2 after the last ACK. But that can take far too long
+(O(10 secs)), since the connection is stuck in fast recovery with a
+low cwnd that cannot grow beyond ssthresh, even if more bandwidth is
+available.
+
+This fix changes the logic in tcp_check_sack_reneging() to only rearm
+the RTO timer if data is cumulatively ACKed, indicating forward
+progress. This avoids this kind of nearly infinite loop of RTO timer
+re-arming. In addition, this meets the goals of
+tcp_check_sack_reneging() in handling Windows TCP behavior that looks
+temporarily like SACK reneging but is not really.
+
+Many thanks to Jakub Kicinski and Neil Spring, who reported this issue
+and provided critical packet traces that enabled root-causing this
+issue. Also, many thanks to Jakub Kicinski for testing this fix.
+
+Fixes: 5ae344c949e7 ("tcp: reduce spurious retransmits due to transient SACK reneging")
+Reported-by: Jakub Kicinski <kuba@kernel.org>
+Reported-by: Neil Spring <ntspring@fb.com>
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Cc: Yuchung Cheng <ycheng@google.com>
+Tested-by: Jakub Kicinski <kuba@kernel.org>
+Link: https://lore.kernel.org/r/20221021170821.1093930-1-ncardwell.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_input.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
+index 9c7f716aab44..98ff1e34e04f 100644
+--- a/net/ipv4/tcp_input.c
++++ b/net/ipv4/tcp_input.c
+@@ -2053,7 +2053,8 @@ void tcp_enter_loss(struct sock *sk)
+  */
+ static bool tcp_check_sack_reneging(struct sock *sk, int flag)
+ {
+-      if (flag & FLAG_SACK_RENEGING) {
++      if (flag & FLAG_SACK_RENEGING &&
++          flag & FLAG_SND_UNA_ADVANCED) {
+               struct tcp_sock *tp = tcp_sk(sk);
+               unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4),
+                                         msecs_to_jiffies(10));
+-- 
+2.35.1
+