{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2022-49834",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-05-01T14:05:17.228Z",
        "datePublished": "2025-05-01T14:09:52.076Z",
        "dateUpdated": "2026-08-05T08:56:25.358Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T08:56:25.358Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nnilfs2: fix use-after-free bug of ns_writer on remount\n\nIf a nilfs2 filesystem is downgraded to read-only due to metadata\ncorruption on disk and is remounted read/write, or if emergency read-only\nremount is performed, detaching a log writer and synchronizing the\nfilesystem can be done at the same time.\n\nIn these cases, use-after-free of the log writer (hereinafter\nnilfs->ns_writer) can happen as shown in the scenario below:\n\n Task1                               Task2\n --------------------------------    ------------------------------\n nilfs_construct_segment\n   nilfs_segctor_sync\n     init_wait\n     init_waitqueue_entry\n     add_wait_queue\n     schedule\n                                     nilfs_remount (R/W remount case)\n\t\t\t\t       nilfs_attach_log_writer\n                                         nilfs_detach_log_writer\n                                           nilfs_segctor_destroy\n                                             kfree\n     finish_wait\n       _raw_spin_lock_irqsave\n         __raw_spin_lock_irqsave\n           do_raw_spin_lock\n             debug_spin_lock_before  <-- use-after-free\n\nWhile Task1 is sleeping, nilfs->ns_writer is freed by Task2.  After Task1\nwaked up, Task1 accesses nilfs->ns_writer which is already freed.  This\nscenario diagram is based on the Shigeru Yoshida's post [1].\n\nThis patch fixes the issue by not detaching nilfs->ns_writer on remount so\nthat this UAF race doesn't happen.  Along with this change, this patch\nalso inserts a few necessary read-only checks with superblock instance\nwhere only the ns_writer pointer was used to check if the filesystem is\nread-only."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
                        "baseScore": 7.8,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:L - The UAF is reached only through local VFS remount and concurrent sync/fsync on a mounted nilfs2 volume (nilfs_remount → nilfs_detach_log_writer / nilfs_attach_log_writer racing nilfs_construct_segment → nilfs_segctor_sync); nilfs2 is FS_REQUIRES_DEV with no network-facing parser.\nAC:L - The attacker controls both sides of the race—issuing fsync/NILFS_IOCTL_SYNC/writeback that sleeps in nilfs_segctor_sync while concurrently remounting ro/rw to free ns_writer—so success does not depend on conditions outside attacker influence; syzbot reproduced it.\nPR:L - Although remount checks CAP_SYS_ADMIN in sb->s_user_ns and nilfs2 lacks FS_USERNS_MOUNT, an unprivileged desktop/kiosk user can mount a crafted or removable nilfs2 image via udisks2/polkit and have that privileged helper perform remount while driving ordinary fsync/sync, matching CVE-2022-49850.\nUI:N - In the automount/udisks scenario the attacker supplies the volume, obtains the mount, and drives both the syncing thread and the remount themselves; no separate victim action is required.\nS:U - This is a standard in-kernel heap use-after-free within the host kernel's authority and does not cross a VM, IOMMU, or sandbox boundary.\nC:H - kfree of nilfs_sc_info while another task still holds a pointer into it (finish_wait on sc_wait_request) is a classic heap UAF; reclaim/spray of that object enables arbitrary kernel read primitives.\nI:H - The same UAF of the segment-constructor object lets an attacker control freed wait-queue and related state consumed after wakeup, enabling write/control-flow hijacking consistent with treating exploitable kernel UAFs as High integrity.\nA:H - Even without full exploitation, use of the freed ns_writer in finish_wait/spinlock paths causes kernel oops/panic, fully impacting availability per UAF guidance."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "fs/nilfs2/segment.c",
                        "fs/nilfs2/super.c"
                    ],
                    "versions": [
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "b2fbf10040216ef5ee270773755fc2f5da65b749",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "39a3ed68270b079c6b874d4e4727a512b9b4882c",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "b4736ab5542112fe0a40f140a0a0b072954f34da",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "9b162e81045266a2d5b44df9dffdf05c54de9cca",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "4feedde5486c07ea79787839153a71ca71329c7d",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "afbd1188382a75f6cfe22c0b68533f7f9664f182",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "b152300d5a1ba4258dacf9916bff20e6a8c7603b",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "fe5f171bb272946ce5fbf843ce2f8467d0d41b9a",
                            "lessThan": "8cccf05fe857a18ee26e20d11a8455a73ffd4efd",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "fs/nilfs2/segment.c",
                        "fs/nilfs2/super.c"
                    ],
                    "versions": [
                        {
                            "version": "2.6.34",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "2.6.34",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.9.334",
                            "lessThanOrEqual": "4.9.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.14.300",
                            "lessThanOrEqual": "4.14.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.19.267",
                            "lessThanOrEqual": "4.19.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.4.225",
                            "lessThanOrEqual": "5.4.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.155",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.79",
                            "lessThanOrEqual": "5.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.0.9",
                            "lessThanOrEqual": "6.0.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "4.9.334"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "4.14.300"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "4.19.267"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "5.4.225"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "5.10.155"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "5.15.79"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "6.0.9"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.34",
                                    "versionEndExcluding": "6.1"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/b2fbf10040216ef5ee270773755fc2f5da65b749"
                },
                {
                    "url": "https://git.kernel.org/stable/c/39a3ed68270b079c6b874d4e4727a512b9b4882c"
                },
                {
                    "url": "https://git.kernel.org/stable/c/b4736ab5542112fe0a40f140a0a0b072954f34da"
                },
                {
                    "url": "https://git.kernel.org/stable/c/9b162e81045266a2d5b44df9dffdf05c54de9cca"
                },
                {
                    "url": "https://git.kernel.org/stable/c/4feedde5486c07ea79787839153a71ca71329c7d"
                },
                {
                    "url": "https://git.kernel.org/stable/c/afbd1188382a75f6cfe22c0b68533f7f9664f182"
                },
                {
                    "url": "https://git.kernel.org/stable/c/b152300d5a1ba4258dacf9916bff20e6a8c7603b"
                },
                {
                    "url": "https://git.kernel.org/stable/c/8cccf05fe857a18ee26e20d11a8455a73ffd4efd"
                }
            ],
            "title": "nilfs2: fix use-after-free bug of ns_writer on remount",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}