{"id":"CVE-2026-139390","state":"PUBLISHED","title":"ocfs2: fix possible deadlock between nfs_sync_rwlock and fs_reclaim","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: fix possible deadlock between nfs_sync_rwlock and fs_reclaim\n\nsyzbot detected a circular locking dependency on &osb->nfs_sync_rwlock:\n\n       CPU0                    CPU1\n       ----                    ----\n  lock(fs_reclaim);\n                               lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);\n                               lock(fs_reclaim);\n  rlock(&osb->nfs_sync_rwlock);\n\n *** DEADLOCK ***\n\nChain exists of:\n  &osb->nfs_sync_rwlock --> &ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE] --> fs_reclaim\n\nCPU0 is kswapd.  The dentry shrinker runs under fs_reclaim and reaches\nocfs2_delete_inode() through ->evict_inode():\n\nkswapd\n balance_pgdat\n  shrink_node\n   shrink_slab\n    super_cache_scan\n     prune_dcache_sb\n      shrink_dentry_list\n       dentry_kill\n        ocfs2_dentry_iput\n         evict\n          ocfs2_evict_inode\n           ocfs2_delete_inode\n            ocfs2_nfs_sync_lock\n             down_read(&osb->nfs_sync_rwlock)      //C0: grabbing\n\nCPU1 is a task deleting an inode.  It takes nfs_sync_rwlock first, then\nthe orphan dir and inode alloc system inode i_rwsems, and allocates the\nmetadata reservation with GFP_KERNEL while holding them:\n\nevict\n ocfs2_evict_inode\n  ocfs2_delete_inode\n  + ocfs2_nfs_sync_lock\n  |  down_read(&osb->nfs_sync_rwlock)              //C1: hold\n  + ocfs2_wipe_inode\n     + inode_lock(orphan_dir_inode)                //C1: hold\n     + ocfs2_truncate_for_delete\n     |  ocfs2_commit_truncate\n     |   ocfs2_remove_btree_range\n     |    ocfs2_reserve_blocks_for_rec_trunc\n     |     ocfs2_reserve_new_metadata_blocks\n     |      kzalloc_obj()                          //C1: grabbing\n     |      // GFP_KERNEL -> might_alloc -> fs_reclaim_acquire\n     + ocfs2_remove_inode\n        inode_lock(inode_alloc_inode)\n\njbd2 pins allocations to GFP_NOFS for the lifetime of a transaction\nhandle, but these reservations are made before ocfs2_start_trans(), so\nfs_reclaim is acquired with ocfs2 locks still held and the cycle closes.\n\nThe same cycle is reachable from ocfs2_get_dentry() and\nocfs2_get_parent(), which hold nfs_sync_rwlock for write across\nocfs2_test_inode_bit() and ocfs2_iget().\n\nThis is more than a lockdep artifact.  A GFP_KERNEL allocation under the\norphan dir i_rwsem enters direct reclaim, which runs the shrinkers, which\ncan evict another ocfs2 inode and re-enter ocfs2_wipe_inode() on the same\ntask; the second inode_lock() on the singleton orphan dir inode then\nself-deadlocks, since i_rwsem is not recursive.\n\nEstablish a GFP_NOFS allocation context for the whole nfs_sync_rwlock\ncritical section so that nothing holding it can recurse into filesystem\nreclaim.  Do it in ocfs2_nfs_sync_lock()/ocfs2_nfs_sync_unlock() rather\nthan at the call sites, so that future callers cannot forget it.","publishedAt":"2026-11-30T13:34:18.800Z","updatedAt":"2026-11-30T13:34:18.800Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"7b40fe4a02b4375f86fc468f3a9bef414ff578ed","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"054916b3dc1f27b24d1c5af6cc02f46d877e4da0","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"503227c6de8e577f3276189257b44aafe09c25a2","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"69dd04f8b738455c2b5ac482004459fffb805af4","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"551d89f8240c18ab1ae14334f2216393023b1209","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"bb38748e1c1c75b6c21f0a1378310f932fccee72","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"cc044ce077f43a77fcb0d3bb8333c4e200aa50b8","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"169bc4d16a8efa7852b101fdaa4c028505cd6750","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/dlmglue.c","fs/ocfs2/dlmglue.h","fs/ocfs2/export.c","fs/ocfs2/inode.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.30","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.30","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/dlmglue.c","fs/ocfs2/dlmglue.h","fs/ocfs2/export.c","fs/ocfs2/inode.c"]}],"references":["https://git.kernel.org/stable/c/7b40fe4a02b4375f86fc468f3a9bef414ff578ed","https://git.kernel.org/stable/c/054916b3dc1f27b24d1c5af6cc02f46d877e4da0","https://git.kernel.org/stable/c/503227c6de8e577f3276189257b44aafe09c25a2","https://git.kernel.org/stable/c/69dd04f8b738455c2b5ac482004459fffb805af4","https://git.kernel.org/stable/c/551d89f8240c18ab1ae14334f2216393023b1209","https://git.kernel.org/stable/c/bb38748e1c1c75b6c21f0a1378310f932fccee72","https://git.kernel.org/stable/c/cc044ce077f43a77fcb0d3bb8333c4e200aa50b8","https://git.kernel.org/stable/c/169bc4d16a8efa7852b101fdaa4c028505cd6750"],"weaknesses":[],"ingestedAt":"2026-11-30T13:48:04.491Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139390.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139390","state":"PUBLISHED","datePublished":"2026-11-30T13:34:18.800Z","dateUpdated":"2026-11-30T13:34:18.800Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.931Z"},"containers":{"cna":{"title":"ocfs2: fix possible deadlock between nfs_sync_rwlock and fs_reclaim","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nocfs2: fix possible deadlock between nfs_sync_rwlock and fs_reclaim\n\nsyzbot detected a circular locking dependency on &osb->nfs_sync_rwlock:\n\n       CPU0                    CPU1\n       ----                    ----\n  lock(fs_reclaim);\n                               lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);\n                               lock(fs_reclaim);\n  rlock(&osb->nfs_sync_rwlock);\n\n *** DEADLOCK ***\n\nChain exists of:\n  &osb->nfs_sync_rwlock --> &ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE] --> fs_reclaim\n\nCPU0 is kswapd.  The dentry shrinker runs under fs_reclaim and reaches\nocfs2_delete_inode() through ->evict_inode():\n\nkswapd\n balance_pgdat\n  shrink_node\n   shrink_slab\n    super_cache_scan\n     prune_dcache_sb\n      shrink_dentry_list\n       dentry_kill\n        ocfs2_dentry_iput\n         evict\n          ocfs2_evict_inode\n           ocfs2_delete_inode\n            ocfs2_nfs_sync_lock\n             down_read(&osb->nfs_sync_rwlock)      //C0: grabbing\n\nCPU1 is a task deleting an inode.  It takes nfs_sync_rwlock first, then\nthe orphan dir and inode alloc system inode i_rwsems, and allocates the\nmetadata reservation with GFP_KERNEL while holding them:\n\nevict\n ocfs2_evict_inode\n  ocfs2_delete_inode\n  + ocfs2_nfs_sync_lock\n  |  down_read(&osb->nfs_sync_rwlock)              //C1: hold\n  + ocfs2_wipe_inode\n     + inode_lock(orphan_dir_inode)                //C1: hold\n     + ocfs2_truncate_for_delete\n     |  ocfs2_commit_truncate\n     |   ocfs2_remove_btree_range\n     |    ocfs2_reserve_blocks_for_rec_trunc\n     |     ocfs2_reserve_new_metadata_blocks\n     |      kzalloc_obj()                          //C1: grabbing\n     |      // GFP_KERNEL -> might_alloc -> fs_reclaim_acquire\n     + ocfs2_remove_inode\n        inode_lock(inode_alloc_inode)\n\njbd2 pins allocations to GFP_NOFS for the lifetime of a transaction\nhandle, but these reservations are made before ocfs2_start_trans(), so\nfs_reclaim is acquired with ocfs2 locks still held and the cycle closes.\n\nThe same cycle is reachable from ocfs2_get_dentry() and\nocfs2_get_parent(), which hold nfs_sync_rwlock for write across\nocfs2_test_inode_bit() and ocfs2_iget().\n\nThis is more than a lockdep artifact.  A GFP_KERNEL allocation under the\norphan dir i_rwsem enters direct reclaim, which runs the shrinkers, which\ncan evict another ocfs2 inode and re-enter ocfs2_wipe_inode() on the same\ntask; the second inode_lock() on the singleton orphan dir inode then\nself-deadlocks, since i_rwsem is not recursive.\n\nEstablish a GFP_NOFS allocation context for the whole nfs_sync_rwlock\ncritical section so that nothing holding it can recurse into filesystem\nreclaim.  Do it in ocfs2_nfs_sync_lock()/ocfs2_nfs_sync_unlock() rather\nthan at the call sites, so that future callers cannot forget it."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"7b40fe4a02b4375f86fc468f3a9bef414ff578ed","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"054916b3dc1f27b24d1c5af6cc02f46d877e4da0","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"503227c6de8e577f3276189257b44aafe09c25a2","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"69dd04f8b738455c2b5ac482004459fffb805af4","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"551d89f8240c18ab1ae14334f2216393023b1209","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"bb38748e1c1c75b6c21f0a1378310f932fccee72","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"cc044ce077f43a77fcb0d3bb8333c4e200aa50b8","versionType":"git"},{"version":"6ca497a83e592d64e050c4d04b6dedb8c915f39a","status":"affected","lessThan":"169bc4d16a8efa7852b101fdaa4c028505cd6750","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/dlmglue.c","fs/ocfs2/dlmglue.h","fs/ocfs2/export.c","fs/ocfs2/inode.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.30","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.30","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ocfs2/dlmglue.c","fs/ocfs2/dlmglue.h","fs/ocfs2/export.c","fs/ocfs2/inode.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/7b40fe4a02b4375f86fc468f3a9bef414ff578ed"},{"url":"https://git.kernel.org/stable/c/054916b3dc1f27b24d1c5af6cc02f46d877e4da0"},{"url":"https://git.kernel.org/stable/c/503227c6de8e577f3276189257b44aafe09c25a2"},{"url":"https://git.kernel.org/stable/c/69dd04f8b738455c2b5ac482004459fffb805af4"},{"url":"https://git.kernel.org/stable/c/551d89f8240c18ab1ae14334f2216393023b1209"},{"url":"https://git.kernel.org/stable/c/bb38748e1c1c75b6c21f0a1378310f932fccee72"},{"url":"https://git.kernel.org/stable/c/cc044ce077f43a77fcb0d3bb8333c4e200aa50b8"},{"url":"https://git.kernel.org/stable/c/169bc4d16a8efa7852b101fdaa4c028505cd6750"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:34:18.800Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}