diff mbox series

[1/2] dm-crypt: print device name in integrity error message.

Message ID 20190515142231.30590-1-gmazyland@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series [1/2] dm-crypt: print device name in integrity error message. | expand

Commit Message

Milan Broz May 15, 2019, 2:22 p.m. UTC
This message should better identify the device with the integrity failure.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
---
 drivers/md/dm-crypt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Erich Eckner May 16, 2019, 9:04 a.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

thanks for the fast patch - I applied it on top of 5.1.2 and it has the 
desired result. (It took some time to trigger the read errors, though 
;-b):

[ 8834.156713] device-mapper: crypt: dm-17: INTEGRITY AEAD ERROR, sector 
1595877368
[ 9713.463619] device-mapper: crypt: dm-17: INTEGRITY AEAD ERROR, sector 
1595877040


regards,
Erich Eckner
Friedrich-Schiller-Universität Jena
Institut für Optik und Quantenelektronik
Helmholtzweg 4
07743 Jena

Tel. +49 3641 9-47238


On Wed, 15 May 2019, Milan Broz wrote:

> This message should better identify the device with the integrity failure.
>
> Signed-off-by: Milan Broz <gmazyland@gmail.com>
> ---
> drivers/md/dm-crypt.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 7f6462f74ac8..36dfa36505ed 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1143,9 +1143,11 @@ static int crypt_convert_block_aead(struct crypt_config *cc,
> 		r = crypto_aead_decrypt(req);
> 	}
>
> -	if (r == -EBADMSG)
> -		DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
> +	if (r == -EBADMSG) {
> +		char b[BDEVNAME_SIZE];
> +		DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
> 			    (unsigned long long)le64_to_cpu(*sector));
> +	}
>
> 	if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
> 		r = cc->iv_gen_ops->post(cc, org_iv, dmreq);
> @@ -1788,7 +1790,8 @@ static void kcryptd_async_done(struct crypto_async_request *async_req,
> 		error = cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq);
>
> 	if (error == -EBADMSG) {
> -		DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
> +		char b[BDEVNAME_SIZE];
> +		DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
> 			    (unsigned long long)le64_to_cpu(*org_sector_of_dmreq(cc, dmreq)));
> 		io->error = BLK_STS_PROTECTION;
> 	} else if (error < 0)
> -- 
> 2.20.1
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE3p92iMrPBP64GmxZCu7JB1Xae1oFAlzdJ6cACgkQCu7JB1Xa
e1raZQ/+PbM9H3gLyVYsUMw5uNA5galb88AD7vkHbSGRrERjZiDIDFvA35wLnBQt
/K+GKvFnPiM3qlceYCRYTEfPVO/8SRPDkGg8h55ArdmGpgWUfagvFCJYiJKe7gRu
SMjOXMYkA0187jB5YarEbCSYEDsrJr8wtBfwlHYgQ7pMbU6ua/l6KHGPG3abznZ9
PC6US1y6QX3lrMqZwKmdfijZGIlJ8Tf1KdagTMZbDs74MTpzLwOoNdQbNLv/yA3o
PLpXSrbPXZnVkL6VWpjBfCwgjFSqPlScwqwgDZJRbtiSmsOcTFtDke974KMoGMTe
MfnXe0YTMu4TvP1wAuDk3SztTw59RsAnTjS1JUkR11fjV1uZgTqkPtmm21XpI9Op
mMVCPjcCVq96uYT4CkY17B4Ukj4VT0rFb/47WKpcl66jvC4q3rIdnq9124IClnEw
eWZAz6KDLb6q3Z7/k3lSpSXmc9yQMBsOrzCMHv36N62RfoDFV8139gw5PjZNgnRm
KUX9SUSw+nPpUvcqajJwb7LJDf+jueCG6rhzQVGknvt693YQ49gWwgsheoT+d8fS
YBQgSq4ZNV5tGHBgfm6qOEi2/JTnyBl8b41IOarh/aYjLILyg6cTSU0FevT2eii+
JeRQtJCsoDl4FmhCXKd9+DHB+vTZ9h3ZRizIx6+Sm9uNcqDOVs0=
=lei7
-----END PGP SIGNATURE-----
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 7f6462f74ac8..36dfa36505ed 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1143,9 +1143,11 @@  static int crypt_convert_block_aead(struct crypt_config *cc,
 		r = crypto_aead_decrypt(req);
 	}
 
-	if (r == -EBADMSG)
-		DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
+	if (r == -EBADMSG) {
+		char b[BDEVNAME_SIZE];
+		DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
 			    (unsigned long long)le64_to_cpu(*sector));
+	}
 
 	if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
 		r = cc->iv_gen_ops->post(cc, org_iv, dmreq);
@@ -1788,7 +1790,8 @@  static void kcryptd_async_done(struct crypto_async_request *async_req,
 		error = cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq);
 
 	if (error == -EBADMSG) {
-		DMERR_LIMIT("INTEGRITY AEAD ERROR, sector %llu",
+		char b[BDEVNAME_SIZE];
+		DMERR_LIMIT("%s: INTEGRITY AEAD ERROR, sector %llu", bio_devname(ctx->bio_in, b),
 			    (unsigned long long)le64_to_cpu(*org_sector_of_dmreq(cc, dmreq)));
 		io->error = BLK_STS_PROTECTION;
 	} else if (error < 0)