mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Read integrity profile info from top level device.
When formating device with --integrity-inline option there's a check if underlying device properly advertise integrity profile support. The check did not work properly for partition device nodes. We have to read integrity profile info from top level block device. Fixes: #964.
This commit is contained in:
@@ -1004,12 +1004,26 @@ int device_is_zoned(struct device *device)
|
|||||||
|
|
||||||
int device_is_nop_dif(struct device *device, uint32_t *tag_size)
|
int device_is_nop_dif(struct device *device, uint32_t *tag_size)
|
||||||
{
|
{
|
||||||
|
char *base_device_path;
|
||||||
|
int r;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (stat(device_path(device), &st) < 0)
|
/*
|
||||||
|
* For partition devices, check integrity profile on the base device.
|
||||||
|
* Partition device nodes don't advertise integrity profile directly
|
||||||
|
* via sysfs attributes.
|
||||||
|
*/
|
||||||
|
base_device_path = crypt_get_base_device(device_path(device));
|
||||||
|
if (base_device_path) {
|
||||||
|
r = stat(base_device_path, &st);
|
||||||
|
free(base_device_path);
|
||||||
|
} else
|
||||||
|
r = stat(device_path(device), &st);
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!S_ISBLK(st.st_mode))
|
if (!S_ISBLK(st.st_mode))
|
||||||
|
|||||||
Reference in New Issue
Block a user