|
41 | 41 |
|
42 | 42 | #include <linux/device-mapper.h>
|
43 | 43 |
|
| 44 | +#include "dm-audit.h" |
| 45 | + |
44 | 46 | #define DM_MSG_PREFIX "crypt"
|
45 | 47 |
|
46 | 48 | /*
|
@@ -1362,8 +1364,12 @@ static int crypt_convert_block_aead(struct crypt_config *cc,
|
1362 | 1364 |
|
1363 | 1365 | if (r == -EBADMSG) {
|
1364 | 1366 | char b[BDEVNAME_SIZE];
|
1365 |
| - DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b), |
1366 |
| - (unsigned long long)le64_to_cpu(*sector)); |
| 1367 | + sector_t s = le64_to_cpu(*sector); |
| 1368 | + |
| 1369 | + DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", |
| 1370 | + bio_devname(ctx->bio_in, b), s); |
| 1371 | + dm_audit_log_bio(DM_MSG_PREFIX, "integrity-aead", |
| 1372 | + ctx->bio_in, s, 0); |
1367 | 1373 | }
|
1368 | 1374 |
|
1369 | 1375 | if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
|
@@ -2173,8 +2179,12 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
|
2173 | 2179 |
|
2174 | 2180 | if (error == -EBADMSG) {
|
2175 | 2181 | char b[BDEVNAME_SIZE];
|
2176 |
| - DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b), |
2177 |
| - (unsigned long long)le64_to_cpu(*org_sector_of_dmreq(cc, dmreq))); |
| 2182 | + sector_t s = le64_to_cpu(*org_sector_of_dmreq(cc, dmreq)); |
| 2183 | + |
| 2184 | + DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", |
| 2185 | + bio_devname(ctx->bio_in, b), s); |
| 2186 | + dm_audit_log_bio(DM_MSG_PREFIX, "integrity-aead", |
| 2187 | + ctx->bio_in, s, 0); |
2178 | 2188 | io->error = BLK_STS_PROTECTION;
|
2179 | 2189 | } else if (error < 0)
|
2180 | 2190 | io->error = BLK_STS_IOERR;
|
@@ -2734,6 +2744,8 @@ static void crypt_dtr(struct dm_target *ti)
|
2734 | 2744 | dm_crypt_clients_n--;
|
2735 | 2745 | crypt_calculate_pages_per_client();
|
2736 | 2746 | spin_unlock(&dm_crypt_clients_lock);
|
| 2747 | + |
| 2748 | + dm_audit_log_dtr(DM_MSG_PREFIX, ti, 1); |
2737 | 2749 | }
|
2738 | 2750 |
|
2739 | 2751 | static int crypt_ctr_ivmode(struct dm_target *ti, const char *ivmode)
|
@@ -3362,9 +3374,11 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
3362 | 3374 | ti->num_flush_bios = 1;
|
3363 | 3375 | ti->limit_swap_bios = true;
|
3364 | 3376 |
|
| 3377 | + dm_audit_log_ctr(DM_MSG_PREFIX, ti, 1); |
3365 | 3378 | return 0;
|
3366 | 3379 |
|
3367 | 3380 | bad:
|
| 3381 | + dm_audit_log_ctr(DM_MSG_PREFIX, ti, 0); |
3368 | 3382 | crypt_dtr(ti);
|
3369 | 3383 | return ret;
|
3370 | 3384 | }
|
|
0 commit comments