From: Adamos Ttofari <attofari(a)amazon.de>
mainline inclusion
from mainline-v6.9-rc1
commit 10e4b5166df9ff7a2d5316138ca668b42d004422
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZ3E
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
Commit 672365477ae8 ("x86/fpu: Update XFD state where required") and
commit 8bf26758ca96 ("x86/fpu: Add XFD state to fpstate") introduced a
per CPU variable xfd_state to keep the MSR_IA32_XFD value cached, in
order to avoid unnecessary writes to the MSR.
On CPU hotplug MSR_IA32_XFD is reset to the init_fpstate.xfd, which
wipes out any stale state. But the per CPU cached xfd value is not
reset, which brings them out of sync.
As a consequence a subsequent xfd_update_state() might fail to update
the MSR which in turn can result in XRSTOR raising a #NM in kernel
space, which crashes the kernel.
To fix this, introduce xfd_set_state() to write xfd_state together
with MSR_IA32_XFD, and use it in all places that set MSR_IA32_XFD.
Fixes: 672365477ae8 ("x86/fpu: Update XFD state where required")
Signed-off-by: Adamos Ttofari <attofari(a)amazon.de>
Signed-off-by: Chang S. Bae <chang.seok.bae(a)intel.com>
Signed-off-by: Ingo Molnar <mingo(a)kernel.org>
Reviewed-by: Thomas Gleixner <tglx(a)linutronix.de>
Link: https://lore.kernel.org/r/20240322230439.456571-1-chang.seok.bae@intel.com
Closes: https://lore.kernel.org/lkml/20230511152818.13839-1-attofari@amazon.de
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
arch/x86/kernel/fpu/xstate.c | 5 +++--
arch/x86/kernel/fpu/xstate.h | 14 ++++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 6ceb0996e23a..78dcdf348218 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -176,10 +176,11 @@ void fpu__init_cpu_xstate(void)
* Must happen after CR4 setup and before xsetbv() to allow KVM
* lazy passthrough. Write independent of the dynamic state static
* key as that does not work on the boot CPU. This also ensures
- * that any stale state is wiped out from XFD.
+ * that any stale state is wiped out from XFD. Reset the per CPU
+ * xfd cache too.
*/
if (cpu_feature_enabled(X86_FEATURE_XFD))
- wrmsrl(MSR_IA32_XFD, init_fpstate.xfd);
+ xfd_set_state(init_fpstate.xfd);
/*
* XCR_XFEATURE_ENABLED_MASK (aka. XCR0) sets user features
diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
index 8707ba0f1a8b..6536c416ba2e 100644
--- a/arch/x86/kernel/fpu/xstate.h
+++ b/arch/x86/kernel/fpu/xstate.h
@@ -151,20 +151,26 @@ static inline void xfd_validate_state(struct fpstate *fpstate, u64 mask, bool rs
#endif
#ifdef CONFIG_X86_64
+static inline void xfd_set_state(u64 xfd)
+{
+ wrmsrl(MSR_IA32_XFD, xfd);
+ __this_cpu_write(xfd_state, xfd);
+}
+
static inline void xfd_update_state(struct fpstate *fpstate)
{
if (fpu_state_size_dynamic()) {
u64 xfd = fpstate->xfd;
- if (__this_cpu_read(xfd_state) != xfd) {
- wrmsrl(MSR_IA32_XFD, xfd);
- __this_cpu_write(xfd_state, xfd);
- }
+ if (__this_cpu_read(xfd_state) != xfd)
+ xfd_set_state(xfd);
}
}
extern int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu);
#else
+static inline void xfd_set_state(u64 xfd) { }
+
static inline void xfd_update_state(struct fpstate *fpstate) { }
static inline int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu) {
--
2.25.1
From: Adamos Ttofari <attofari(a)amazon.de>
mainline inclusion
from mainline-v6.9-rc1
commit 10e4b5166df9ff7a2d5316138ca668b42d004422
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZ3E
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
Commit 672365477ae8 ("x86/fpu: Update XFD state where required") and
commit 8bf26758ca96 ("x86/fpu: Add XFD state to fpstate") introduced a
per CPU variable xfd_state to keep the MSR_IA32_XFD value cached, in
order to avoid unnecessary writes to the MSR.
On CPU hotplug MSR_IA32_XFD is reset to the init_fpstate.xfd, which
wipes out any stale state. But the per CPU cached xfd value is not
reset, which brings them out of sync.
As a consequence a subsequent xfd_update_state() might fail to update
the MSR which in turn can result in XRSTOR raising a #NM in kernel
space, which crashes the kernel.
To fix this, introduce xfd_set_state() to write xfd_state together
with MSR_IA32_XFD, and use it in all places that set MSR_IA32_XFD.
Fixes: 672365477ae8 ("x86/fpu: Update XFD state where required")
Signed-off-by: Adamos Ttofari <attofari(a)amazon.de>
Signed-off-by: Chang S. Bae <chang.seok.bae(a)intel.com>
Signed-off-by: Ingo Molnar <mingo(a)kernel.org>
Reviewed-by: Thomas Gleixner <tglx(a)linutronix.de>
Link: https://lore.kernel.org/r/20240322230439.456571-1-chang.seok.bae@intel.com
Closes: https://lore.kernel.org/lkml/20230511152818.13839-1-attofari@amazon.de
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
---
arch/x86/kernel/fpu/xstate.c | 5 +++--
arch/x86/kernel/fpu/xstate.h | 14 ++++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 6ceb0996e23a..78dcdf348218 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -176,10 +176,11 @@ void fpu__init_cpu_xstate(void)
* Must happen after CR4 setup and before xsetbv() to allow KVM
* lazy passthrough. Write independent of the dynamic state static
* key as that does not work on the boot CPU. This also ensures
- * that any stale state is wiped out from XFD.
+ * that any stale state is wiped out from XFD. Reset the per CPU
+ * xfd cache too.
*/
if (cpu_feature_enabled(X86_FEATURE_XFD))
- wrmsrl(MSR_IA32_XFD, init_fpstate.xfd);
+ xfd_set_state(init_fpstate.xfd);
/*
* XCR_XFEATURE_ENABLED_MASK (aka. XCR0) sets user features
diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h
index 8707ba0f1a8b..6536c416ba2e 100644
--- a/arch/x86/kernel/fpu/xstate.h
+++ b/arch/x86/kernel/fpu/xstate.h
@@ -151,20 +151,26 @@ static inline void xfd_validate_state(struct fpstate *fpstate, u64 mask, bool rs
#endif
#ifdef CONFIG_X86_64
+static inline void xfd_set_state(u64 xfd)
+{
+ wrmsrl(MSR_IA32_XFD, xfd);
+ __this_cpu_write(xfd_state, xfd);
+}
+
static inline void xfd_update_state(struct fpstate *fpstate)
{
if (fpu_state_size_dynamic()) {
u64 xfd = fpstate->xfd;
- if (__this_cpu_read(xfd_state) != xfd) {
- wrmsrl(MSR_IA32_XFD, xfd);
- __this_cpu_write(xfd_state, xfd);
- }
+ if (__this_cpu_read(xfd_state) != xfd)
+ xfd_set_state(xfd);
}
}
extern int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu);
#else
+static inline void xfd_set_state(u64 xfd) { }
+
static inline void xfd_update_state(struct fpstate *fpstate) { }
static inline int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu) {
--
2.25.1
From: Ido Schimmel <idosch(a)nvidia.com>
stable inclusion
from stable-v5.10.216
commit 09846c2309b150b8ce4e0ce96f058197598fc530
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9QRA8
CVE: CVE-2024-36006
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
--------------------------------
[ Upstream commit b377add0f0117409c418ddd6504bd682ebe0bf79 ]
Both the function that migrates all the chunks within a region and the
function that migrates all the entries within a chunk call
list_first_entry() on the respective lists without checking that the
lists are not empty. This is incorrect usage of the API, which leads to
the following warning [1].
Fix by returning if the lists are empty as there is nothing to migrate
in this case.
[1]
WARNING: CPU: 0 PID: 6437 at drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c:1266 mlxsw_sp_acl_tcam_vchunk_migrate_all+0x1f1/0>
Modules linked in:
CPU: 0 PID: 6437 Comm: kworker/0:37 Not tainted 6.9.0-rc3-custom-00883-g94a65f079ef6 #39
Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
RIP: 0010:mlxsw_sp_acl_tcam_vchunk_migrate_all+0x1f1/0x2c0
[...]
Call Trace:
<TASK>
mlxsw_sp_acl_tcam_vregion_rehash_work+0x6c/0x4a0
process_one_work+0x151/0x370
worker_thread+0x2cb/0x3e0
kthread+0xd0/0x100
ret_from_fork+0x34/0x50
ret_from_fork_asm+0x1a/0x30
</TASK>
Fixes: 6f9579d4e302 ("mlxsw: spectrum_acl: Remember where to continue rehash migration")
Signed-off-by: Ido Schimmel <idosch(a)nvidia.com>
Tested-by: Alexander Zubkov <green(a)qrator.net>
Reviewed-by: Petr Machata <petrm(a)nvidia.com>
Signed-off-by: Petr Machata <petrm(a)nvidia.com>
Reviewed-by: Simon Horman <horms(a)kernel.org>
Link: https://lore.kernel.org/r/4628e9a22d1d84818e28310abbbc498e7bc31bc9.17137971…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
Signed-off-by: Zhengchao Shao <shaozhengchao(a)huawei.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
index d3f99c6b3cae..6f3e82675cc2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
@@ -1263,6 +1263,9 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
return 0;
}
+ if (list_empty(&vchunk->ventry_list))
+ goto out;
+
/* If the migration got interrupted, we have the ventry to start from
* stored in context.
*/
@@ -1312,6 +1315,7 @@ mlxsw_sp_acl_tcam_vchunk_migrate_one(struct mlxsw_sp *mlxsw_sp,
}
}
+out:
mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk, ctx);
return 0;
}
@@ -1325,6 +1329,9 @@ mlxsw_sp_acl_tcam_vchunk_migrate_all(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_vchunk *vchunk;
int err;
+ if (list_empty(&vregion->vchunk_list))
+ return 0;
+
/* If the migration got interrupted, we have the vchunk
* we are working on stored in context.
*/
--
2.34.1
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: f3f9407325616af0ea4e2399d86d31f8571fa55f
commit: b8f3220637be1736c165c289c634f27841ac4e01 [7647/9681] livepatch: add arch hook before doing klp_resolve_symbols
config: x86_64-randconfig-073-20240521 (https://download.01.org/0day-ci/archive/20240522/202405220709.iFr8nwBK-lkp@…)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240522/202405220709.iFr8nwBK-lkp@…)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405220709.iFr8nwBK-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/livepatch/core.c:97:12: warning: no previous prototype for function 'arch_klp_init_func' [-Wmissing-prototypes]
97 | int __weak arch_klp_init_func(struct klp_object *obj, struct klp_func *func)
| ^
kernel/livepatch/core.c:97:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
97 | int __weak arch_klp_init_func(struct klp_object *obj, struct klp_func *func)
| ^
| static
>> kernel/livepatch/core.c:216:13: warning: no previous prototype for function 'arch_klp_skip_resolve' [-Wmissing-prototypes]
216 | bool __weak arch_klp_skip_resolve(unsigned int type)
| ^
kernel/livepatch/core.c:216:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
216 | bool __weak arch_klp_skip_resolve(unsigned int type)
| ^
| static
kernel/livepatch/core.c:1767:12: warning: no previous prototype for function 'arch_klp_check_activeness_func' [-Wmissing-prototypes]
1767 | int __weak arch_klp_check_activeness_func(struct klp_func *func, int enable,
| ^
kernel/livepatch/core.c:1767:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
1767 | int __weak arch_klp_check_activeness_func(struct klp_func *func, int enable,
| ^
| static
kernel/livepatch/core.c:2022:14: warning: no previous prototype for function 'arch_klp_mem_alloc' [-Wmissing-prototypes]
2022 | void __weak *arch_klp_mem_alloc(size_t size)
| ^
kernel/livepatch/core.c:2022:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2022 | void __weak *arch_klp_mem_alloc(size_t size)
| ^
| static
kernel/livepatch/core.c:2027:13: warning: no previous prototype for function 'arch_klp_mem_free' [-Wmissing-prototypes]
2027 | void __weak arch_klp_mem_free(void *mem)
| ^
kernel/livepatch/core.c:2027:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2027 | void __weak arch_klp_mem_free(void *mem)
| ^
| static
kernel/livepatch/core.c:2063:13: warning: no previous prototype for function 'arch_klp_set_brk_func' [-Wmissing-prototypes]
2063 | void __weak arch_klp_set_brk_func(struct klp_func_node *func_node, void *new_func)
| ^
kernel/livepatch/core.c:2063:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2063 | void __weak arch_klp_set_brk_func(struct klp_func_node *func_node, void *new_func)
| ^
| static
6 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for DRM_I915_DEBUG_GEM
Depends on [n]: HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && DRM_I915_WERROR [=n]
Selected by [m]:
- DRM_I915_DEBUG [=y] && HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && !COMPILE_TEST [=n]
vim +/arch_klp_skip_resolve +216 kernel/livepatch/core.c
214
215 #ifdef CONFIG_LIVEPATCH_WO_FTRACE
> 216 bool __weak arch_klp_skip_resolve(unsigned int type)
217 {
218 return false;
219 }
220 #endif
221
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: f3f9407325616af0ea4e2399d86d31f8571fa55f
commit: 4332dbb07181359cccca3ba757ef54e434fb1296 [9619/9677] Add kh40000_direct_dma_ops for KH-40000 platform
config: x86_64-randconfig-102-20240521 (https://download.01.org/0day-ci/archive/20240522/202405220034.VMppwRxc-lkp@…)
compiler: gcc-10 (Ubuntu 10.5.0-1ubuntu1) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240522/202405220034.VMppwRxc-lkp@…)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405220034.VMppwRxc-lkp@intel.com/
All warnings (new ones prefixed by >>):
arch/x86/kernel/zhaoxin_kh40000.c: In function 'kh40000_sync_single_dma_for_cpu':
arch/x86/kernel/zhaoxin_kh40000.c:87:33: error: implicit declaration of function 'iommu_get_dma_domain'; did you mean 'iommu_is_dma_domain'? [-Werror=implicit-function-declaration]
87 | struct iommu_domain *domain = iommu_get_dma_domain(dev);
| ^~~~~~~~~~~~~~~~~~~~
| iommu_is_dma_domain
>> arch/x86/kernel/zhaoxin_kh40000.c:87:33: warning: initialization of 'struct iommu_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
cc1: some warnings being treated as errors
vim +87 arch/x86/kernel/zhaoxin_kh40000.c
64
65 static void kh40000_sync_single_dma_for_cpu(struct device *dev, dma_addr_t paddr,
66 enum dma_data_direction dir, bool is_iommu)
67 {
68 u8 vid;
69 struct pci_dev *pci;
70 u64 dma_mask = *dev->dma_mask;
71
72 /* check direction */
73 if ((dir != DMA_FROM_DEVICE) && (dir != DMA_BIDIRECTIONAL))
74 return;
75
76 /* check dma capability */
77 if (dma_mask <= DMA_BIT_MASK(32))
78 return;
79
80 /* check device type */
81 pci = kh40000_get_pci_dev(dev);
82 if (pci == NULL)
83 return;
84
85 /* get real physical address */
86 if (is_iommu) {
> 87 struct iommu_domain *domain = iommu_get_dma_domain(dev);
88
89 paddr = iommu_iova_to_phys(domain, paddr);
90 if (!paddr)
91 return;
92 }
93
94 /* check node or not */
95 if ((zhaoxin_patch_code & ZHAOXIN_P2CW_NODE_CHECK)
96 && pfn_to_nid(PFN_DOWN(paddr)) == dev_to_node(dev))
97 return;
98
99 /* flush data by one pci read cycle */
100 pci_read_config_byte(pci, PCI_VENDOR_ID, &vid);
101 }
102
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9R3F8
CVE: NA
--------------------------------
There are many link error when QOS_SCHED_DYNAMIC_AFFINITY = y &&
FAIR_CGROUP_SCHED=n.
The QOS_SCHED_DYNAMIC_AFFINITY feature need FAIR_CGROUP_SCHED has been
selected first.
Fixes: 229f5c1f3868 ("sched: Introduce dynamic affinity for cfs scheduler")
Signed-off-by: Yipeng Zou <zouyipeng(a)huawei.com>
---
init/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/init/Kconfig b/init/Kconfig
index 69bd400daeb3..d6422dc138d8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1069,6 +1069,7 @@ endif #CGROUP_SCHED
config QOS_SCHED_DYNAMIC_AFFINITY
bool "qos dynamic affinity"
depends on CPUSETS
+ depends on FAIR_CGROUP_SCHED
default n
help
This feature lets you allocate preferred cpus to taskgroup. If enabled,
--
2.34.1
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9R3F8
CVE: NA
--------------------------------
There are many link error when QOS_SCHED_DYNAMIC_AFFINITY = y &&
FAIR_CGROUP_SCHED=n.
The QOS_SCHED_DYNAMIC_AFFINITY feature need FAIR_CGROUP_SCHED has been
selected first.
Fixes: 890af1b1e1d5 ("sched: Introduce dynamic affinity for cfs scheduler")
Signed-off-by: Yipeng Zou <zouyipeng(a)huawei.com>
---
init/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/init/Kconfig b/init/Kconfig
index 4b16ac2efda8..dc49f231294a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1128,6 +1128,7 @@ endif #CGROUP_SCHED
config QOS_SCHED_DYNAMIC_AFFINITY
bool "qos dynamic affinity"
depends on CPUSETS
+ depends on FAIR_CGROUP_SCHED
default n
help
This feature lets you allocate preferred cpus to taskgroup. If enabled,
--
2.34.1
hulk inclusion
category: bugfix
bugzilla: 189922, https://gitee.com/openeuler/kernel/issues/I9PXKA
CVE: NA
--------------------------------
The current implimentation of partitions for loop has several issues.
'loop_device' is at the gendisk level, but it uses 'lo_device' to store
block_device. A gendisk can have multiple block_devices, and 'lo_device'
can be set to anyone of them through loop_configure().
This usage can lead to a null-ptr-deref issue. If 'lo_device' is set to
a block_device of partition, this partition is closed and 'bd_openers' is
dec to 0, the 'bd_disk' of that block_device will be set to NULL in
__blkdev_put(). In this case, Accessing 'lo_device->bd_disk' will trigger
the issue. The problem can be reproduced as follows:
1. create loop device loop0 and create a partition loop0p1.
2. submit the ioctl LOOP_CLR_FD by loop0.
3. submit the ioctl LOOP_SET_FD by loop0p1.
4. submit ioctl such as LOOP_SET_STATUS by loop0.
Fix it by using 'lo->lo_disk' instead of 'lo->lo_device->bd_disk' for
kobject_uevent().
Fixes: c01a21b77722 ("loop: Fix occasional uevent drop")
Fixes: c3473c63542d ("generate "change" uevent for loop device")
Signed-off-by: Li Nan <linan122(a)huawei.com>
---
drivers/block/loop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index c64b22ce2bec..8eefd1462c3f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -243,7 +243,7 @@ static void loop_set_size(struct loop_device *lo, loff_t size)
bd_set_nr_sectors(bdev, size);
if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, false))
- kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
+ kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
}
static inline int
@@ -1250,7 +1250,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
if (bdev) {
bd_set_nr_sectors(bdev, 0);
/* let user-space know about this change */
- kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
+ kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
}
mapping_set_gfp_mask(filp->f_mapping, gfp);
/* This is safe: open() is still holding a reference. */
--
2.39.2