CVE-2025-39791
Full vulnerability record from the local CVENow database.
Description
In the Linux kernel, the following vulnerability has been resolved: dm: dm-crypt: Do not partially accept write BIOs with zoned targets Read and write operations issued to a dm-crypt target may be split according to the dm-crypt internal limits defined by the max_read_size and max_write_size module parameters (default is 128 KB). The intent is to improve processing time of large BIOs by splitting them into smaller operations that can be parallelized on different CPUs. For zoned dm-crypt targets, this BIO splitting is still done but without the parallel execution to ensure that the issuing order of write operations to the underlying devices remains sequential. However, the splitting itself causes other problems: 1) Since dm-crypt relies on the block layer zone write plugging to handle zone append emulation using regular write operations, the reminder of a split write BIO will always be plugged into the target zone write plugged. Once the on-going write BIO finishes, this reminder BIO is unplugged and issued from the zone write plug work. If this reminder BIO itself needs to be split, the reminder will be re-issued and plugged again, but that causes a call to a blk_queue_enter(), which may block if a queue freeze operation was initiated. This results in a deadlock as DM submission still holds BIOs that the queue freeze side is waiting for. 2) dm-crypt relies on the emulation done by the block layer using regular write operations for processing zone append operations. This still requires to properly return the written sector as the BIO sector of the original BIO. However, this can be done correctly only and only if there is a single clone BIO used for processing the original zone append operation issued by the user. If the size of a zone append operation is larger than dm-crypt max_write_size, then the orginal BIO will be split and processed as a chain of regular write operations. Such chaining result in an incorrect written sector being returned to the zone append issuer using the original BIO sector. This in turn results in file system data corruptions using xfs or btrfs. Fix this by modifying get_max_request_size() to always return the size of the BIO to avoid it being split with dm_accpet_partial_bio() in crypt_map(). get_max_request_size() is renamed to get_max_request_sectors() to clarify the unit of the value returned and its interface is changed to take a struct dm_target pointer and a pointer to the struct bio being processed. In addition to this change, to ensure that crypt_alloc_buffer() works correctly, set the dm-crypt device max_hw_sectors limit to be at most BIO_MAX_VECS << PAGE_SECTORS_SHIFT (1 MB with a 4KB page architecture). This forces DM core to split write BIOs before passing them to crypt_map(), and thus guaranteeing that dm-crypt can always accept an entire write BIO without needing to split it. This change does not have any effect on the read path of dm-crypt. Read operations can still be split and the BIO fragments processed in parallel. There is also no impact on the performance of the write path given that all zone write BIOs were already processed inline instead of in parallel. This change also does not affect in any way regular dm-crypt block devices.
View original CVE JSON
{
"id": "CVE-2025-39791",
"sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"published": "2025-09-11T17:15:45.517",
"lastModified": "2026-10-19T21:10:00.160",
"vulnStatus": "Modified",
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\ndm: dm-crypt: Do not partially accept write BIOs with zoned targets\n\nRead and write operations issued to a dm-crypt target may be split\naccording to the dm-crypt internal limits defined by the max_read_size\nand max_write_size module parameters (default is 128 KB). The intent is\nto improve processing time of large BIOs by splitting them into smaller\noperations that can be parallelized on different CPUs.\n\nFor zoned dm-crypt targets, this BIO splitting is still done but without\nthe parallel execution to ensure that the issuing order of write\noperations to the underlying devices remains sequential. However, the\nsplitting itself causes other problems:\n\n1) Since dm-crypt relies on the block layer zone write plugging to\n handle zone append emulation using regular write operations, the\n reminder of a split write BIO will always be plugged into the target\n zone write plugged. Once the on-going write BIO finishes, this\n reminder BIO is unplugged and issued from the zone write plug work.\n If this reminder BIO itself needs to be split, the reminder will be\n re-issued and plugged again, but that causes a call to a\n blk_queue_enter(), which may block if a queue freeze operation was\n initiated. This results in a deadlock as DM submission still holds\n BIOs that the queue freeze side is waiting for.\n\n2) dm-crypt relies on the emulation done by the block layer using\n regular write operations for processing zone append operations. This\n still requires to properly return the written sector as the BIO\n sector of the original BIO. However, this can be done correctly only\n and only if there is a single clone BIO used for processing the\n original zone append operation issued by the user. If the size of a\n zone append operation is larger than dm-crypt max_write_size, then\n the orginal BIO will be split and processed as a chain of regular\n write operations. Such chaining result in an incorrect written sector\n being returned to the zone append issuer using the original BIO\n sector. This in turn results in file system data corruptions using\n xfs or btrfs.\n\nFix this by modifying get_max_request_size() to always return the size\nof the BIO to avoid it being split with dm_accpet_partial_bio() in\ncrypt_map(). get_max_request_size() is renamed to\nget_max_request_sectors() to clarify the unit of the value returned\nand its interface is changed to take a struct dm_target pointer and a\npointer to the struct bio being processed. In addition to this change,\nto ensure that crypt_alloc_buffer() works correctly, set the dm-crypt\ndevice max_hw_sectors limit to be at most\nBIO_MAX_VECS << PAGE_SECTORS_SHIFT (1 MB with a 4KB page architecture).\nThis forces DM core to split write BIOs before passing them to\ncrypt_map(), and thus guaranteeing that dm-crypt can always accept an\nentire write BIO without needing to split it.\n\nThis change does not have any effect on the read path of dm-crypt. Read\noperations can still be split and the BIO fragments processed in\nparallel. There is also no impact on the performance of the write path\ngiven that all zone write BIOs were already processed inline instead of\nin parallel.\n\nThis change also does not affect in any way regular dm-crypt block\ndevices."
},
{
"lang": "es",
"value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ndm: dm-crypt: No aceptar parcialmente BIOs de escritura con destinos zonificados\n\nLas operaciones de lectura y escritura emitidas a un destino dm-crypt pueden dividirse según los límites internos de dm-crypt definidos por los parámetros del módulo max_read_size y max_write_size (el valor predeterminado es 128 KB). La intención es mejorar el tiempo de procesamiento de BIOs grandes dividiéndolos en operaciones más pequeñas que pueden paralelizarse en diferentes CPUs.\n\nPara destinos dm-crypt zonificados, esta división de BIOs todavía se realiza pero sin la ejecución paralela para asegurar que el orden de emisión de las operaciones de escritura a los dispositivos subyacentes permanezca secuencial. Sin embargo, la división en sí causa otros problemas:\n\n1) Dado que dm-crypt se basa en el 'zone write plugging' de la capa de bloques para manejar la emulación de 'zone append' utilizando operaciones de escritura regulares, el resto de un BIO de escritura dividido siempre se 'enchufará' en el 'zone write plugged' de destino. Una vez que el BIO de escritura en curso finaliza, este BIO restante se 'desenchufa' y se emite desde el trabajo de 'zone write plug'. Si este BIO restante necesita ser dividido, el resto será reemitido y 'enchufado' de nuevo, pero eso provoca una llamada a blk_queue_enter(), que puede bloquearse si se inició una operación de congelación de cola. Esto resulta en un interbloqueo ya que la presentación de DM todavía retiene BIOs que el lado de congelación de cola está esperando.\n\n2) dm-crypt se basa en la emulación realizada por la capa de bloques utilizando operaciones de escritura regulares para procesar operaciones de 'zone append'. Esto todavía requiere devolver correctamente el sector escrito como el sector BIO del BIO original. Sin embargo, esto solo se puede hacer correctamente si hay un único BIO clon utilizado para procesar la operación de 'zone append' original emitida por el usuario. Si el tamaño de una operación de 'zone append' es mayor que dm-crypt max_write_size, entonces el BIO original se dividirá y procesará como una cadena de operaciones de escritura regulares. Dicha encadenación resulta en que se devuelve un sector escrito incorrecto al emisor de 'zone append' utilizando el sector BIO original. Esto a su vez resulta en corrupciones de datos del sistema de archivos utilizando xfs o btrfs.\n\nSolucione esto modificando get_max_request_size() para que siempre devuelva el tamaño del BIO para evitar que se divida con dm_accpet_partial_bio() en crypt_map(). get_max_request_size() se renombra a get_max_request_sectors() para aclarar la unidad del valor devuelto y su interfaz se cambia para que tome un puntero a struct dm_target y un puntero a la struct bio que se está procesando. Además de este cambio, para asegurar que crypt_alloc_buffer() funcione correctamente, establezca el límite max_hw_sectors del dispositivo dm-crypt en un máximo de BIO_MAX_VECS << PAGE_SECTORS_SHIFT (1 MB con una arquitectura de página de 4KB). Esto obliga al núcleo de DM a dividir los BIOs de escritura antes de pasarlos a crypt_map(), y así garantizando que dm-crypt siempre pueda aceptar un BIO de escritura completo sin necesidad de dividirlo.\n\nEste cambio no tiene ningún efecto en la ruta de lectura de dm-crypt. Las operaciones de lectura aún pueden dividirse y los fragmentos de BIO procesarse en paralelo. Tampoco hay impacto en el rendimiento de la ruta de escritura dado que todos los BIOs de escritura de zona ya se procesaban en línea en lugar de en paralelo.\n\nEste cambio tampoco afecta de ninguna manera a los dispositivos de bloques dm-crypt regulares."
}
],
"affected": [
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"affectedData": [
{
"vendor": "Linux",
"product": "Linux",
"defaultStatus": "unaffected",
"programFiles": [
"drivers/md/dm-crypt.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"versions": [
{
"version": "f211268ed1f9bdf48f06a3ead5f5d88437450579",
"lessThan": "8864616719b6bbf92356bc89ff544b0cd484c656",
"versionType": "git",
"status": "affected"
},
{
"version": "f211268ed1f9bdf48f06a3ead5f5d88437450579",
"lessThan": "52a2c4c60470352acf9cde7a2dfa661c1e67e796",
"versionType": "git",
"status": "affected"
},
{
"version": "f211268ed1f9bdf48f06a3ead5f5d88437450579",
"lessThan": "e549663849e5bb3b985dc2d293069f0d9747ae72",
"versionType": "git",
"status": "affected"
}
]
},
{
"vendor": "Linux",
"product": "Linux",
"defaultStatus": "affected",
"programFiles": [
"drivers/md/dm-crypt.c"
],
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"versions": [
{
"version": "6.10",
"status": "affected"
},
{
"version": "0",
"lessThan": "6.10",
"versionType": "semver",
"status": "unaffected"
},
{
"version": "6.12.44",
"lessThanOrEqual": "6.12.*",
"versionType": "semver",
"status": "unaffected"
},
{
"version": "6.16.4",
"lessThanOrEqual": "6.16.*",
"versionType": "semver",
"status": "unaffected"
},
{
"version": "6.17",
"lessThanOrEqual": "*",
"versionType": "original_commit_for_fix",
"status": "unaffected"
}
]
}
]
}
],
"metrics": {
"cvssMetricV31": [
{
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"type": "Secondary",
"cvssData": {
"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",
"attackVector": "LOCAL",
"attackComplexity": "LOW",
"privilegesRequired": "LOW",
"userInteraction": "NONE",
"scope": "UNCHANGED",
"confidentialityImpact": "HIGH",
"integrityImpact": "HIGH",
"availabilityImpact": "HIGH"
},
"exploitabilityScore": 1.8,
"impactScore": 5.9
},
{
"source": "[email protected]",
"type": "Primary",
"cvssData": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"baseScore": 5.5,
"baseSeverity": "MEDIUM",
"attackVector": "LOCAL",
"attackComplexity": "LOW",
"privilegesRequired": "LOW",
"userInteraction": "NONE",
"scope": "UNCHANGED",
"confidentialityImpact": "NONE",
"integrityImpact": "NONE",
"availabilityImpact": "HIGH"
},
"exploitabilityScore": 1.8,
"impactScore": 3.6
}
],
"ssvcV203": [
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"ssvcData": {
"timestamp": "2026-10-15T21:54:11.714412Z",
"id": "CVE-2025-39791",
"options": [
{
"exploitation": "none"
},
{
"automatable": "no"
},
{
"technicalImpact": "total"
}
],
"role": "CISA Coordinator",
"version": "2.0.3"
}
}
]
},
"weaknesses": [
{
"source": "[email protected]",
"type": "Primary",
"description": [
{
"lang": "en",
"value": "CWE-667"
}
]
}
],
"configurations": [
{
"nodes": [
{
"operator": "OR",
"negate": false,
"cpeMatch": [
{
"vulnerable": true,
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionStartIncluding": "6.10",
"versionEndExcluding": "6.12.44",
"matchCriteriaId": "489EF11B-3951-48B6-8DCA-E6B0DDAF7910"
},
{
"vulnerable": true,
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionStartIncluding": "6.13",
"versionEndExcluding": "6.16.4",
"matchCriteriaId": "AFC28995-B8C3-4B68-8CB6-78E792B6629D"
}
]
}
]
}
],
"references": [
{
"url": "https://git.kernel.org/stable/c/52a2c4c60470352acf9cde7a2dfa661c1e67e796",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"tags": [
"Patch"
]
},
{
"url": "https://git.kernel.org/stable/c/8864616719b6bbf92356bc89ff544b0cd484c656",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"tags": [
"Patch"
]
},
{
"url": "https://git.kernel.org/stable/c/e549663849e5bb3b985dc2d293069f0d9747ae72",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"tags": [
"Patch"
]
}
]
}