linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree()
@ 2022-06-01 14:00 Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 02/11] ARM: OMAP1: clock: Fix UART rate reporting algorithm Sasha Levin
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zixuan Fu, TOTE Robot, Dave Kleikamp, Sasha Levin, shaggy,
	jfs-discussion

From: Zixuan Fu <r33s3n6@gmail.com>

[ Upstream commit 0d4837fdb796f99369cf7691d33de1b856bcaf1f ]

In our fault-injection testing, the variable "nblocks" in dbFree() can be
zero when kmalloc_array() fails in dtSearch(). In this case, the variable
 "mp" in dbFree() would be NULL and then it is dereferenced in
"write_metapage(mp)".

The failure log is listed as follows:

[   13.824137] BUG: kernel NULL pointer dereference, address: 0000000000000020
...
[   13.827416] RIP: 0010:dbFree+0x5f7/0x910 [jfs]
[   13.834341] Call Trace:
[   13.834540]  <TASK>
[   13.834713]  txFreeMap+0x7b4/0xb10 [jfs]
[   13.835038]  txUpdateMap+0x311/0x650 [jfs]
[   13.835375]  jfs_lazycommit+0x5f2/0xc70 [jfs]
[   13.835726]  ? sched_dynamic_update+0x1b0/0x1b0
[   13.836092]  kthread+0x3c2/0x4a0
[   13.836355]  ? txLockFree+0x160/0x160 [jfs]
[   13.836763]  ? kthread_unuse_mm+0x160/0x160
[   13.837106]  ret_from_fork+0x1f/0x30
[   13.837402]  </TASK>
...

This patch adds a NULL check of "mp" before "write_metapage(mp)" is called.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Zixuan Fu <r33s3n6@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/jfs/jfs_dmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 6dac48e29d28..a07fbb60ac3c 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -398,7 +398,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
 	}
 
 	/* write the last buffer. */
-	write_metapage(mp);
+	if (mp)
+		write_metapage(mp);
 
 	IREAD_UNLOCK(ipbmap);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 02/11] ARM: OMAP1: clock: Fix UART rate reporting algorithm
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds Sasha Levin
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Janusz Krzysztofik, Tony Lindgren, Arnd Bergmann, Sasha Levin,
	paul, aaro.koskinen, linux, linux-omap, linux-arm-kernel

From: Janusz Krzysztofik <jmkrzyszt@gmail.com>

[ Upstream commit 338d5d476cde853dfd97378d20496baabc2ce3c0 ]

Since its introduction to the mainline kernel, omap1_uart_recalc() helper
makes incorrect use of clk->enable_bit as a ready to use bitmap mask while
it only provides the bit number.  Fix it.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/mach-omap1/clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 034b89499bd7..a3599696e7cc 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(clockfw_lock);
 unsigned long omap1_uart_recalc(struct clk *clk)
 {
 	unsigned int val = __raw_readl(clk->enable_reg);
-	return val & clk->enable_bit ? 48000000 : 12000000;
+	return val & 1 << clk->enable_bit ? 48000000 : 12000000;
 }
 
 unsigned long omap1_sossi_recalc(struct clk *clk)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 02/11] ARM: OMAP1: clock: Fix UART rate reporting algorithm Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 17:19   ` Reinette Chatre
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 04/11] fat: add ratelimit to fat*_ent_bread() Sasha Levin
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Shaopeng Tan, Reinette Chatre, Fenghua Yu, Shuah Khan,
	Sasha Levin, shuah, linux-kselftest

From: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>

[ Upstream commit e2e3fb6ef0d6548defbe0be6e092397aaa92f3a1 ]

When testing on a Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz the resctrl
selftests fail due to timeout after exceeding the default time limit of
45 seconds. On this system the test takes about 68 seconds.
Since the failing test by default accesses a fixed size of memory, the
execution time should not vary significantly between different environment.
A new default of 120 seconds should be sufficient yet easy to customize
with the introduction of the "settings" file for reference.

Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/testing/selftests/resctrl/settings | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 tools/testing/selftests/resctrl/settings

diff --git a/tools/testing/selftests/resctrl/settings b/tools/testing/selftests/resctrl/settings
new file mode 100644
index 000000000000..a383f3d4565b
--- /dev/null
+++ b/tools/testing/selftests/resctrl/settings
@@ -0,0 +1,3 @@
+# If running time is longer than 120 seconds when new tests are added in
+# the future, increase timeout here.
+timeout=120
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 04/11] fat: add ratelimit to fat*_ent_bread()
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 02/11] ARM: OMAP1: clock: Fix UART rate reporting algorithm Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 05/11] ARM: versatile: Add missing of_node_put in dcscb_init Sasha Levin
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: OGAWA Hirofumi, qianfan, Andrew Morton, Sasha Levin

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

[ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ]

fat*_ent_bread() can be the cause of too many report on I/O error path.
So use fat_msg_ratelimit() instead.

Link: https://lkml.kernel.org/r/87bkxogfeq.fsf@mail.parknet.co.jp
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Reported-by: qianfan <qianfanguijin@163.com>
Tested-by: qianfan <qianfanguijin@163.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/fat/fatent.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 0129d4d07a54..b0b1a71c07b7 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -92,7 +92,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent,
 err_brelse:
 	brelse(bhs[0]);
 err:
-	fat_msg(sb, KERN_ERR, "FAT read failed (blocknr %llu)", (llu)blocknr);
+	fat_msg_ratelimit(sb, KERN_ERR, "FAT read failed (blocknr %llu)",
+			  (llu)blocknr);
 	return -EIO;
 }
 
@@ -105,8 +106,8 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent,
 	fatent->fat_inode = MSDOS_SB(sb)->fat_inode;
 	fatent->bhs[0] = sb_bread(sb, blocknr);
 	if (!fatent->bhs[0]) {
-		fat_msg(sb, KERN_ERR, "FAT read failed (blocknr %llu)",
-		       (llu)blocknr);
+		fat_msg_ratelimit(sb, KERN_ERR, "FAT read failed (blocknr %llu)",
+				  (llu)blocknr);
 		return -EIO;
 	}
 	fatent->nr_bhs = 1;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 05/11] ARM: versatile: Add missing of_node_put in dcscb_init
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (2 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 04/11] fat: add ratelimit to fat*_ent_bread() Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 06/11] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM Sasha Levin
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Peng Wu, Linus Walleij, Arnd Bergmann, Sasha Levin, liviu.dudau,
	sudeep.holla, lorenzo.pieralisi, linux, linux-arm-kernel

From: Peng Wu <wupeng58@huawei.com>

[ Upstream commit 23b44f9c649bbef10b45fa33080cd8b4166800ae ]

The device_node pointer is returned by of_find_compatible_node
with refcount incremented. We should use of_node_put() to avoid
the refcount leak.

Signed-off-by: Peng Wu <wupeng58@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220428230356.69418-1-linus.walleij@linaro.org'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/mach-vexpress/dcscb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c
index 5cedcf572104..3e86cff1d4d3 100644
--- a/arch/arm/mach-vexpress/dcscb.c
+++ b/arch/arm/mach-vexpress/dcscb.c
@@ -146,6 +146,7 @@ static int __init dcscb_init(void)
 	if (!node)
 		return -ENODEV;
 	dcscb_base = of_iomap(node, 0);
+	of_node_put(node);
 	if (!dcscb_base)
 		return -EADDRNOTAVAIL;
 	cfg = readl_relaxed(dcscb_base + DCS_CFG_R);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 06/11] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (3 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 05/11] ARM: versatile: Add missing of_node_put in dcscb_init Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 07/11] ARM: hisi: Add missing of_node_put after of_find_compatible_node Sasha Levin
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Krzysztof Kozlowski, Rob Herring, Sasha Levin, robh+dt,
	krzysztof.kozlowski+dt, devicetree, linux-arm-kernel,
	linux-samsung-soc

From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

[ Upstream commit f038e8186fbc5723d7d38c6fa1d342945107347e ]

The Samsung s524ad0xd1 EEPROM should use atmel,24c128 fallback,
according to the AT24 EEPROM bindings.

Reported-by: Rob Herring <robh@kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220426183443.243113-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/exynos5250-smdk5250.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 54e79f6887ff..3dda0569f86a 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -129,7 +129,7 @@ &i2c_0 {
 	samsung,i2c-max-bus-freq = <20000>;
 
 	eeprom@50 {
-		compatible = "samsung,s524ad0xd1";
+		compatible = "samsung,s524ad0xd1", "atmel,24c128";
 		reg = <0x50>;
 	};
 
@@ -288,7 +288,7 @@ &i2c_1 {
 	samsung,i2c-max-bus-freq = <20000>;
 
 	eeprom@51 {
-		compatible = "samsung,s524ad0xd1";
+		compatible = "samsung,s524ad0xd1", "atmel,24c128";
 		reg = <0x51>;
 	};
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 07/11] ARM: hisi: Add missing of_node_put after of_find_compatible_node
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (4 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 06/11] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 08/11] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() Sasha Levin
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Peng Wu, Wei Xu, Sasha Levin, linux, linux-arm-kernel

From: Peng Wu <wupeng58@huawei.com>

[ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ]

of_find_compatible_node  will increment the refcount of the returned
device_node. Calling of_node_put() to avoid the refcount leak

Signed-off-by: Peng Wu <wupeng58@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/mach-hisi/platsmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
index e1d67648d5d0..fccceab33325 100644
--- a/arch/arm/mach-hisi/platsmp.c
+++ b/arch/arm/mach-hisi/platsmp.c
@@ -70,14 +70,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
 		}
 		ctrl_base = of_iomap(np, 0);
 		if (!ctrl_base) {
+			of_node_put(np);
 			pr_err("failed to map address\n");
 			return;
 		}
 		if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
+			of_node_put(np);
 			pr_err("failed to find smp-offset property\n");
 			return;
 		}
 		ctrl_base += offset;
+		of_node_put(np);
 	}
 }
 
@@ -163,6 +166,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)
 	if (WARN_ON(!node))
 		return -1;
 	ctrl_base = of_iomap(node, 0);
+	of_node_put(node);
 
 	/* set the secondary core boot from DDR */
 	remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 08/11] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (5 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 07/11] ARM: hisi: Add missing of_node_put after of_find_compatible_node Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 09/11] powerpc/xics: fix refcount leak in icp_opal_init() Sasha Levin
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yicong Yang, Jay Zhou, Bjorn Helgaas, Sasha Levin, linux-pci

From: Yicong Yang <yangyicong@hisilicon.com>

[ Upstream commit a91ee0e9fca9d7501286cfbced9b30a33e52740a ]

The sysfs sriov_numvfs_store() path acquires the device lock before the
config space access lock:

  sriov_numvfs_store
    device_lock                 # A (1) acquire device lock
    sriov_configure
      vfio_pci_sriov_configure  # (for example)
        vfio_pci_core_sriov_configure
          pci_disable_sriov
            sriov_disable
              pci_cfg_access_lock
                pci_wait_cfg    # B (4) wait for dev->block_cfg_access == 0

Previously, pci_dev_lock() acquired the config space access lock before the
device lock:

  pci_dev_lock
    pci_cfg_access_lock
      dev->block_cfg_access = 1 # B (2) set dev->block_cfg_access = 1
    device_lock                 # A (3) wait for device lock

Any path that uses pci_dev_lock(), e.g., pci_reset_function(), may
deadlock with sriov_numvfs_store() if the operations occur in the sequence
(1) (2) (3) (4).

Avoid the deadlock by reversing the order in pci_dev_lock() so it acquires
the device lock before the config space access lock, the same as the
sriov_numvfs_store() path.

[bhelgaas: combined and adapted commit log from Jay Zhou's independent
subsequent posting:
https://lore.kernel.org/r/20220404062539.1710-1-jianjay.zhou@huawei.com]
Link: https://lore.kernel.org/linux-pci/1583489997-17156-1-git-send-email-yangyicong@hisilicon.com/
Also-posted-by: Jay Zhou <jianjay.zhou@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pci/pci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2cf13578fe75..e6e0012269cd 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4079,18 +4079,18 @@ static int __pci_dev_reset(struct pci_dev *dev, int probe)
 
 static void pci_dev_lock(struct pci_dev *dev)
 {
-	pci_cfg_access_lock(dev);
 	/* block PM suspend, driver probe, etc. */
 	device_lock(&dev->dev);
+	pci_cfg_access_lock(dev);
 }
 
 /* Return 1 on successful lock, 0 on contention */
 static int pci_dev_trylock(struct pci_dev *dev)
 {
-	if (pci_cfg_access_trylock(dev)) {
-		if (device_trylock(&dev->dev))
+	if (device_trylock(&dev->dev)) {
+		if (pci_cfg_access_trylock(dev))
 			return 1;
-		pci_cfg_access_unlock(dev);
+		device_unlock(&dev->dev);
 	}
 
 	return 0;
@@ -4098,8 +4098,8 @@ static int pci_dev_trylock(struct pci_dev *dev)
 
 static void pci_dev_unlock(struct pci_dev *dev)
 {
-	device_unlock(&dev->dev);
 	pci_cfg_access_unlock(dev);
+	device_unlock(&dev->dev);
 }
 
 /**
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 09/11] powerpc/xics: fix refcount leak in icp_opal_init()
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (6 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 08/11] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 10/11] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled Sasha Levin
  2022-06-01 14:01 ` [PATCH AUTOSEL 4.9 11/11] drm: fix EDID struct for old ARM OABI format Sasha Levin
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Lv Ruyi, Zeal Robot, Michael Ellerman, Sasha Levin, maz,
	nick.child, linuxppc-dev

From: Lv Ruyi <lv.ruyi@zte.com.cn>

[ Upstream commit 5dd9e27ea4a39f7edd4bf81e9e70208e7ac0b7c9 ]

The of_find_compatible_node() function returns a node pointer with
refcount incremented, use of_node_put() on it when done.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220402013419.2410298-1-lv.ruyi@zte.com.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/sysdev/xics/icp-opal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics/icp-opal.c
index b53f80f0b4d8..80a4fa6dcc55 100644
--- a/arch/powerpc/sysdev/xics/icp-opal.c
+++ b/arch/powerpc/sysdev/xics/icp-opal.c
@@ -199,6 +199,7 @@ int icp_opal_init(void)
 
 	printk("XICS: Using OPAL ICP fallbacks\n");
 
+	of_node_put(np);
 	return 0;
 }
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 10/11] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (7 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 09/11] powerpc/xics: fix refcount leak in icp_opal_init() Sasha Levin
@ 2022-06-01 14:00 ` Sasha Levin
  2022-06-01 14:01 ` [PATCH AUTOSEL 4.9 11/11] drm: fix EDID struct for old ARM OABI format Sasha Levin
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Finn Thain, kernel test robot, Randy Dunlap, Christophe Leroy,
	Michael Ellerman, Sasha Levin, benh, arnd, adobriyan, masahiroy,
	yebin10, linuxppc-dev

From: Finn Thain <fthain@linux-m68k.org>

[ Upstream commit 86ce436e30d86327c9f5260f718104ae7b21f506 ]

drivers/macintosh/via-pmu-event.o: In function `via_pmu_event':
via-pmu-event.c:(.text+0x44): undefined reference to `input_event'
via-pmu-event.c:(.text+0x68): undefined reference to `input_event'
via-pmu-event.c:(.text+0x94): undefined reference to `input_event'
via-pmu-event.c:(.text+0xb8): undefined reference to `input_event'
drivers/macintosh/via-pmu-event.o: In function `via_pmu_event_init':
via-pmu-event.c:(.init.text+0x20): undefined reference to `input_allocate_device'
via-pmu-event.c:(.init.text+0xc4): undefined reference to `input_register_device'
via-pmu-event.c:(.init.text+0xd4): undefined reference to `input_free_device'
make[1]: *** [Makefile:1155: vmlinux] Error 1
make: *** [Makefile:350: __build_one_by_one] Error 2

Don't call into the input subsystem unless CONFIG_INPUT is built-in.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/5edbe76ce68227f71e09af4614cc4c1bd61c7ec8.1649326292.git.fthain@linux-m68k.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/macintosh/Kconfig   | 4 ++++
 drivers/macintosh/Makefile  | 3 ++-
 drivers/macintosh/via-pmu.c | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index d28690f6e262..9e226e143473 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -87,6 +87,10 @@ config ADB_PMU
 	  this device; you should do so if your machine is one of those
 	  mentioned above.
 
+config ADB_PMU_EVENT
+	def_bool y
+	depends on ADB_PMU && INPUT=y
+
 config ADB_PMU_LED
 	bool "Support for the Power/iBook front LED"
 	depends on ADB_PMU
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index 383ba920085b..8513c8aa2faf 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -11,7 +11,8 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN)	+= mac_hid.o
 obj-$(CONFIG_INPUT_ADBHID)	+= adbhid.o
 obj-$(CONFIG_ANSLCD)		+= ans-lcd.o
 
-obj-$(CONFIG_ADB_PMU)		+= via-pmu.o via-pmu-event.o
+obj-$(CONFIG_ADB_PMU)		+= via-pmu.o
+obj-$(CONFIG_ADB_PMU_EVENT)	+= via-pmu-event.o
 obj-$(CONFIG_ADB_PMU_LED)	+= via-pmu-led.o
 obj-$(CONFIG_PMAC_BACKLIGHT)	+= via-pmu-backlight.o
 obj-$(CONFIG_ADB_CUDA)		+= via-cuda.o
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 32c696799300..9bdb7d2055b1 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1439,7 +1439,7 @@ pmu_handle_data(unsigned char *data, int len)
 		pmu_pass_intr(data, len);
 		/* len == 6 is probably a bad check. But how do I
 		 * know what PMU versions send what events here? */
-		if (len == 6) {
+		if (IS_ENABLED(CONFIG_ADB_PMU_EVENT) && len == 6) {
 			via_pmu_event(PMU_EVT_POWER, !!(data[1]&8));
 			via_pmu_event(PMU_EVT_LID, data[1]&1);
 		}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH AUTOSEL 4.9 11/11] drm: fix EDID struct for old ARM OABI format
  2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
                   ` (8 preceding siblings ...)
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 10/11] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled Sasha Levin
@ 2022-06-01 14:01 ` Sasha Levin
  9 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-01 14:01 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Linus Torvalds, Sudip Mukherjee, Arnd Bergmann,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Sasha Levin, dri-devel

From: Linus Torvalds <torvalds@linux-foundation.org>

[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]

When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc
will force alignment of all structures and unions to a word boundary
(see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX"
option if you're a gcc person), even when the members of said structures
do not want or need said alignment.

This completely messes up the structure alignment of 'struct edid' on
those targets, because even though all the embedded structures are
marked with "__attribute__((packed))", the unions that contain them are
not.

This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count
and size helpers"), but the bug is pre-existing.  That commit just made
the structure layout problem cause a build failure due to the addition
of the

        BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);

sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().

This legacy union alignment should probably not be used in the first
place, but we can fix the layout by adding the packed attribute to the
union entries even when each member is already packed and it shouldn't
matter in a sane build environment.

You can see this issue with a trivial test program:

  union {
	struct {
		char c[5];
	};
	struct {
		char d;
		unsigned e;
	} __attribute__((packed));
  } a = { "1234" };

where building this with a normal "gcc -S" will result in the expected
5-byte size of said union:

	.type	a, @object
	.size	a, 5

but with an ARM compiler and the old ABI:

    arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c

you get

	.type	a, %object
	.size	a, 8

instead, because even though each member of the union is packed, the
union itself still gets aligned.

This was reported by Sudip for the spear3xx_defconfig target.

Link: https://lore.kernel.org/lkml/YpCUzStDnSgQLNFN@debian/
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/drm/drm_edid.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index c3a7d440bc11..514a02095983 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -114,7 +114,7 @@ struct detailed_data_monitor_range {
 			u8 supported_scalings;
 			u8 preferred_refresh;
 		} __attribute__((packed)) cvt;
-	} formula;
+	} __attribute__((packed)) formula;
 } __attribute__((packed));
 
 struct detailed_data_wpindex {
@@ -147,7 +147,7 @@ struct detailed_non_pixel {
 		struct detailed_data_wpindex color;
 		struct std_timing timings[6];
 		struct cvt_timing cvt[4];
-	} data;
+	} __attribute__((packed)) data;
 } __attribute__((packed));
 
 #define EDID_DETAIL_EST_TIMINGS 0xf7
@@ -165,7 +165,7 @@ struct detailed_timing {
 	union {
 		struct detailed_pixel_timing pixel_data;
 		struct detailed_non_pixel other_data;
-	} data;
+	} __attribute__((packed)) data;
 } __attribute__((packed));
 
 #define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds
  2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds Sasha Levin
@ 2022-06-01 17:19   ` Reinette Chatre
  2022-06-05 13:40     ` Sasha Levin
  0 siblings, 1 reply; 13+ messages in thread
From: Reinette Chatre @ 2022-06-01 17:19 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: Shaopeng Tan, Fenghua Yu, Shuah Khan, shuah, linux-kselftest

Dear Stable Team,

I received the below notice about this commit being considered for
4.9 as well as other notices for it being considered for 4.14, 4.19,
5.4, 5.10, 5.15, 5.17, and 5.18.

I do not believe this commit is appropriate for stable because:
- It forms part of a series and without the other accompanying patches
  from that series it does not do anything. Series is at:
  https://lore.kernel.org/lkml/20220323081227.1603991-1-tan.shaopeng@jp.fujitsu.com/
- The original series was not not submitted for inclusion to stable and
  none of its patches have a Fixes: tag.
- The series this patch forms part of aims to port resctrl_tests to the
  kselftest framework and I do not believe such a change matches stable
  criteria.

Reinette

On 6/1/2022 7:00 AM, Sasha Levin wrote:
> From: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> 
> [ Upstream commit e2e3fb6ef0d6548defbe0be6e092397aaa92f3a1 ]
> 
> When testing on a Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz the resctrl
> selftests fail due to timeout after exceeding the default time limit of
> 45 seconds. On this system the test takes about 68 seconds.
> Since the failing test by default accesses a fixed size of memory, the
> execution time should not vary significantly between different environment.
> A new default of 120 seconds should be sufficient yet easy to customize
> with the introduction of the "settings" file for reference.
> 
> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
> Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  tools/testing/selftests/resctrl/settings | 3 +++
>  1 file changed, 3 insertions(+)
>  create mode 100644 tools/testing/selftests/resctrl/settings
> 
> diff --git a/tools/testing/selftests/resctrl/settings b/tools/testing/selftests/resctrl/settings
> new file mode 100644
> index 000000000000..a383f3d4565b
> --- /dev/null
> +++ b/tools/testing/selftests/resctrl/settings
> @@ -0,0 +1,3 @@
> +# If running time is longer than 120 seconds when new tests are added in
> +# the future, increase timeout here.
> +timeout=120

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds
  2022-06-01 17:19   ` Reinette Chatre
@ 2022-06-05 13:40     ` Sasha Levin
  0 siblings, 0 replies; 13+ messages in thread
From: Sasha Levin @ 2022-06-05 13:40 UTC (permalink / raw)
  To: Reinette Chatre
  Cc: linux-kernel, stable, Shaopeng Tan, Fenghua Yu, Shuah Khan,
	shuah, linux-kselftest

On Wed, Jun 01, 2022 at 10:19:45AM -0700, Reinette Chatre wrote:
>Dear Stable Team,
>
>I received the below notice about this commit being considered for
>4.9 as well as other notices for it being considered for 4.14, 4.19,
>5.4, 5.10, 5.15, 5.17, and 5.18.
>
>I do not believe this commit is appropriate for stable because:
>- It forms part of a series and without the other accompanying patches
>  from that series it does not do anything. Series is at:
>  https://lore.kernel.org/lkml/20220323081227.1603991-1-tan.shaopeng@jp.fujitsu.com/
>- The original series was not not submitted for inclusion to stable and
>  none of its patches have a Fixes: tag.
>- The series this patch forms part of aims to port resctrl_tests to the
>  kselftest framework and I do not believe such a change matches stable
>  criteria.

Sure, I'll drop it, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-06-05 13:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 14:00 [PATCH AUTOSEL 4.9 01/11] fs: jfs: fix possible NULL pointer dereference in dbFree() Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 02/11] ARM: OMAP1: clock: Fix UART rate reporting algorithm Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 03/11] selftests/resctrl: Change the default limited time to 120 seconds Sasha Levin
2022-06-01 17:19   ` Reinette Chatre
2022-06-05 13:40     ` Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 04/11] fat: add ratelimit to fat*_ent_bread() Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 05/11] ARM: versatile: Add missing of_node_put in dcscb_init Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 06/11] ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 07/11] ARM: hisi: Add missing of_node_put after of_find_compatible_node Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 08/11] PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 09/11] powerpc/xics: fix refcount leak in icp_opal_init() Sasha Levin
2022-06-01 14:00 ` [PATCH AUTOSEL 4.9 10/11] macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled Sasha Levin
2022-06-01 14:01 ` [PATCH AUTOSEL 4.9 11/11] drm: fix EDID struct for old ARM OABI format Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).