From: Jinfeng Wang <[email protected]>

This is to fix the following kernel hang,which is introduced by the
merge commit(a62d8c9cbabb11f1ddf081814589293f439dfabf)
CPU: 28 PID: 357890 Comm: memfd_create03 Tainted: G      D           
5.10.232-yocto-standard #1
Hardware name: Intel Corporation S2600CP/S2600CP, BIOS 
RMLSDP.86I.R4.26.D674.1304190022 04/19/2013
RIP: 0010:fput_many+0x7/0xa0
Code: 8b 83 f0 00 00 00 49 89 84 24 f0 00 00 00 5b 4c 89 e0 41 5c 5d c3 cc cc 
cc cc 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 89 f6 <f0> 48 29 77 38 75 60 55 
48 89 e5 41 54 49 89 fc 65 48 8b 3c 25 00
RSP: 0018:ffffbaae0992bd40 EFLAGS: 00010282
RAX: 00000000fffffff4 RBX: 0000000000000000 RCX: 000000000504011c
RDX: 000000000000076c RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffbaae0992bd48 R08: ffffffffa9b1a8b0 R09: 0000000000000001
R10: ffff9efb88475450 R11: ffff9efb88475838 R12: 0000000000000000
R13: 00007fb774400000 R14: 0000000000000000 R15: ffff9efc7eead940
FS:  00007fb774902740(0000) GS:ffff9f025ec00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000038 CR3: 0000000111ea8002 CR4: 00000000001706e0
Call Trace:
 ? __die_body.cold+0x1a/0x1f
 ? __die+0x2b/0x37
 ? no_context.constprop.0+0x11e/0x300
 ? memory_failure_queue_kick+0x40/0x40
 ? __bad_area_nosemaphore+0x45/0x150
 ? preempt_count_add+0x54/0xc0
 ? bad_area_nosemaphore+0x16/0x20
 ? do_user_addr_fault+0x253/0x3f0
 ? kmemleak_free+0x35/0x40
 ? exc_page_fault+0x56/0x130
 ? asm_exc_page_fault+0x1e/0x30
 ? fput_many+0x7/0xa0
 ? fput+0x13/0x20
 vma_do_fput+0x22/0x50
 mmap_region+0x651/0x710
 do_mmap+0x46a/0x5d0
 vm_mmap_pgoff+0xc6/0x100
 ksys_mmap_pgoff+0x1e9/0x230
 ? fpregs_assert_state_consistent+0x2a/0x50
 ? exit_to_user_mode_prepare+0x36/0x130
 __x64_sys_mmap+0x33/0x50
 do_syscall_64+0x38/0x50
 entry_SYSCALL_64_after_hwframe+0x67/0xd1

Signed-off-by: Jinfeng Wang <[email protected]>
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 0ecbf6fa6b20..43e40491f891 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1896,8 +1896,8 @@ static unsigned long __mmap_region(struct file *file, 
unsigned long addr,
        return addr;
 
 unmap_and_free_file_vma:
-       vma->vm_file = NULL;
        vma_fput(vma);
+       vma->vm_file = NULL;
 
        /* Undo any partial mapping done by a device driver. */
        unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end);
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#14772): 
https://lists.yoctoproject.org/g/linux-yocto/message/14772
Mute This Topic: https://lists.yoctoproject.org/mt/111136611/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

  • [linux-yocto][v5.10/standard... Wang, Jinfeng (CN) via lists.yoctoproject.org

Reply via email to