From: Samu Nuutamo <samu.nuutamo(a)vincit.fi>
[ Upstream commit 333e22db228f0bd0c839553015a6a8d3db4ba569 ]
When tsi-as-adc is configured it is possible for in7[0123]_input read to
return an incorrect value if a concurrent read to in[456]_input is
performed. This is caused by a concurrent manipulation of the mux
channel without proper locking as hwmon and mfd use different locks for
synchronization.
Switch hwmon to use the same lock as mfd when accessing the TSI channel.
Fixes: 4f16cab19a3d5 ("hwmon: da9052: Add support for TSI channel")
Signed-off-by: Samu Nuutamo <samu.nuutamo(a)vincit.fi>
[rebase to current master, reword commit message slightly]
Signed-off-by: Sebastian Reichel <sebastian.reichel(a)collabora.com>
Signed-off-by: Guenter Roeck <linux(a)roeck-us.net>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
drivers/hwmon/da9052-hwmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
index 53b517dbe7e6..4af2fc309c28 100644
--- a/drivers/hwmon/da9052-hwmon.c
+++ b/drivers/hwmon/da9052-hwmon.c
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev,
int channel = to_sensor_dev_attr(devattr)->index;
int ret;
- mutex_lock(&hwmon->hwmon_lock);
+ mutex_lock(&hwmon->da9052->auxadc_lock);
ret = __da9052_read_tsi(dev, channel);
- mutex_unlock(&hwmon->hwmon_lock);
+ mutex_unlock(&hwmon->da9052->auxadc_lock);
if (ret < 0)
return ret;
--
2.25.1
commit 634efb750435 ("selftests: bpf: Reset global state between
reuseport test runs") uses a macro RET_IF which doesn't exist in
the v4.19 tree. It is defined as follows:
#define RET_IF(condition, tag, format...) ({
if (CHECK_FAIL(condition)) {
printf(tag " " format);
return;
}
})
CHECK_FAIL in turn is defined as:
#define CHECK_FAIL(condition) ({
int __ret = !!(condition);
int __save_errno = errno;
if (__ret) {
test__fail();
fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);
}
errno = __save_errno;
__ret;
})
Replace occurences of RET_IF with CHECK. This will abort the test binary
if clearing the intermediate state fails.
Fixes: 634efb750435 ("selftests: bpf: Reset global state between reuseport test runs")
Reported-by: kernel test robot <rong.a.chen(a)intel.com>
Signed-off-by: Lorenz Bauer <lmb(a)cloudflare.com>
---
tools/testing/selftests/bpf/test_select_reuseport.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
index cdbbdab2725f..b14d25bfa830 100644
--- a/tools/testing/selftests/bpf/test_select_reuseport.c
+++ b/tools/testing/selftests/bpf/test_select_reuseport.c
@@ -616,13 +616,13 @@ static void cleanup_per_test(void)
for (i = 0; i < NR_RESULTS; i++) {
err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
- RET_IF(err, "reset elem in result_map",
- "i:%u err:%d errno:%d\n", i, err, errno);
+ CHECK(err, "reset elem in result_map",
+ "i:%u err:%d errno:%d\n", i, err, errno);
}
err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
- RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
- err, errno);
+ CHECK(err, "reset line number in linum_map", "err:%d errno:%d\n",
+ err, errno);
for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
close(sk_fds[i]);
--
2.20.1
On 2020-06-02 18:38, Robin Murphy wrote:
> Unlike the other instances which represent a complete loss of
> consistency within the rcache mechanism itself, or a fundamental
> and obvious misconfiguration by an IOMMU driver, the BUG_ON() in
> iova_magazine_free_pfns() can be provoked at more or less any time
> in a "spooky action-at-a-distance" manner by any old device driver
> passing nonsense to dma_unmap_*() which then propagates through to
> queue_iova().
>
> Not only is this well outside the IOVA layer's control, it's also
> nowhere near fatal enough to justify panicking anyway - all that
> really achieves is to make debugging the offending driver more
> difficult. Let's simply WARN and otherwise ignore bogus PFNs.
>
> Reported-by: Prakash Gupta <guptap(a)codeaurora.org>
> Signed-off-by: Robin Murphy <robin.murphy(a)arm.com>
> ---
> drivers/iommu/iova.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Copying stable(a)vger.kernel.org
You can add
Reviewed-by: Prakash Gupta <guptap(a)codeaurora.org>
> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
> index 0e6a9536eca6..612cbf668adf 100644
> --- a/drivers/iommu/iova.c
> +++ b/drivers/iommu/iova.c
> @@ -811,7 +811,9 @@ iova_magazine_free_pfns(struct iova_magazine *mag,
> struct iova_domain *iovad)
> for (i = 0 ; i < mag->size; ++i) {
> struct iova *iova = private_find_iova(iovad, mag->pfns[i]);
>
> - BUG_ON(!iova);
> + if (WARN_ON(!iova))
> + continue;
> +
> private_free_iova(iovad, iova);
> }
From: SeongJae Park <sjpark(a)amazon.de>
This commit recommends the patches to replace 'blacklist' and
'whitelist' with the 'blocklist' and 'allowlist', because the new
suggestions are incontrovertible, doesn't make people hurt, and more
self-explanatory.
Signed-off-by: SeongJae Park <sjpark(a)amazon.de>
---
scripts/spelling.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index d9cd24cf0d40..ea785568d8b8 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -230,6 +230,7 @@ beter||better
betweeen||between
bianries||binaries
bitmast||bitmask
+blacklist||blocklist
boardcast||broadcast
borad||board
boundry||boundary
@@ -1495,6 +1496,7 @@ whcih||which
whenver||whenever
wheter||whether
whe||when
+whitelist||allowlist
wierd||weird
wiil||will
wirte||write
--
2.17.1
A 5-level paging capable machine can have memory above 46-bit in the
physical address space. This memory is only addressable in the 5-level
paging mode: we don't have enough virtual address space to create direct
mapping for such memory in the 4-level paging mode
Teach KASLR to avoid memory regions above MAXMEM or truncate the region
if the end is above MAXMEM.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov(a)linux.intel.com>
Reviewed-by: Dave Hansen <dave.hansen(a)intel.com>
Cc: stable(a)vger.kernel.org # v4.14
---
arch/x86/boot/compressed/kaslr.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index d7408af55738..99db18eeb40e 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -695,7 +695,18 @@ static bool process_mem_region(struct mem_vector *region,
unsigned long long minimum,
unsigned long long image_size)
{
+ unsigned long long end;
int i;
+
+ /* Cannot access memory region above MAXMEM: skip it. */
+ if (region->start >= MAXMEM)
+ return 0;
+
+ /* Truncate the region if the end is above MAXMEM */
+ end = region->start + region->size;
+ end = min_t(unsigned long long, end, MAXMEM - 1);
+ region->size = end - region->start;
+
/*
* If no immovable memory found, or MEMORY_HOTREMOVE disabled,
* use @region directly.
--
2.26.2