Skip to contentSkip to conversation

block/keyslot-manager: use kvfree_sensitive()

PATCH Applied Eric Biggers 2 participants 3 messages Jun 16, 2020 – Jun 29, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/keyslot-manager: use kvfree_sensitive()

From: Eric Biggers <[email protected]>

Make blk_ksm_destroy() use the kvfree_sensitive() function (which was introduced in v5.8-rc1) instead of open-coding it.

---
 block/keyslot-manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/keyslot-manager.c +1 -2
index c2ef41b3147b..35abcb1ec051 100644
@@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
 	if (!ksm)
 		return;
 	kvfree(ksm->slot_hashtable);
-	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
-	kvfree(ksm->slots);
+	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
 	memzero_explicit(ksm, sizeof(*ksm));
 }
 EXPORT_SYMBOL_GPL(blk_ksm_destroy);
Signature · 1 line
2.27.0.290.gba653c62da-goog
#1 lore raw
Quoted 16 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Make blk_ksm_destroy() use the kvfree_sensitive() function (which was introduced in v5.8-rc1) instead of open-coding it.

---
 block/keyslot-manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/keyslot-manager.c +0 -0
index c2ef41b3147b..35abcb1ec051 100644

block/keyslot-manager.c void blk_ksm_destroy(struct blk_keyslot_manager *ksm) · line 380

Quoted 9 lines
block/keyslot-manager.c +1 -2
@@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
 	if (!ksm)
 		return;
 	kvfree(ksm->slot_hashtable);
-	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
-	kvfree(ksm->slots);
+	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
 	memzero_explicit(ksm, sizeof(*ksm));
 }
 EXPORT_SYMBOL_GPL(blk_ksm_destroy);

Ping?

maintainer Applied
#2 lore raw
Quoted 20 lines · Eric Biggers
Quoted 19 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Make blk_ksm_destroy() use the kvfree_sensitive() function (which was introduced in v5.8-rc1) instead of open-coding it.

---
 block/keyslot-manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/keyslot-manager.c +0 -1
index c2ef41b3147b..35abcb1ec051 100644
@@ -374,8 +374,7 @@ void blk_ksm_destroy(struct blk_keyslot_manager *ksm)
 	if (!ksm)
 		return;
 	kvfree(ksm->slot_hashtable);
-	memzero_explicit(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
Quoted 8 lines

block/keyslot-manager.c void blk_ksm_destroy(struct blk_keyslot_manager *ksm) · line 380

Quoted 6 lines
block/keyslot-manager.c +1 -1
-	kvfree(ksm->slots);
+	kvfree_sensitive(ksm->slots, sizeof(ksm->slots[0]) * ksm->num_slots);
 	memzero_explicit(ksm, sizeof(*ksm));
 }
 EXPORT_SYMBOL_GPL(blk_ksm_destroy);

Ping?

Applied, thanks.

Signature · 1 line
Jens Axboe