dt-bindings: trivial-devices: add atmel,atecc608a
Thorsten Blum
maintainerPATCH 1/2 dt-bindings: trivial-devices: add atmel,atecc608a
Add an entry for ATECC608A.
--- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -69,6 +69,8 @@ properties: - asteralabs,pt5161l # ATECC508A - i2c h/w elliptic curve crypto module - atmel,atecc508a + # ATECC608A - i2c h/w elliptic curve crypto module + - atmel,atecc608a # ATECC608B - i2c h/w elliptic curve crypto module - atmel,atecc608b # ATSHA204 - i2c h/w symmetric crypto module
Thorsten Blum
maintainerPATCH 2/2 crypto: atmel-ecc - add support for atecc608a
The driver already supports the ATECC508A and ATECC608B and uses only commands shared by these devices.
Microchip documents the ATECC608B as a backwards-compatible, functional drop-in replacement for the ATECC608A, with the same device structure and command interface [1]. Therefore, add support for the ATECC608A.
ATECC608A hardware was not available for testing.
--- drivers/crypto/atmel-ecc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/atmel-ecc.c +2 -0
@@ -348,6 +348,7 @@ static void atmel_ecc_remove(struct i2c_client *client)static const struct of_device_id atmel_ecc_dt_ids[] = { { .compatible ="atmel,atecc508a" , }, + { .compatible ="atmel,atecc608a" , }, { .compatible ="atmel,atecc608b" , }, { } };
@@ -355,6 +356,7 @@ MODULE_DEVICE_TABLE(of, atmel_ecc_dt_ids);static const struct i2c_device_id atmel_ecc_id[] = { { .name ="atecc508a" }, + { .name ="atecc608a" }, { .name ="atecc608b" }, { } };
[email protected]
AI reviewRe: [PATCH 2/2] crypto: atmel-ecc - add support for atecc608a
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free due to early return in atmel_ecc_remove() missing list deletion. --
commit da00b1f7ab58791bf49d80087ba781e30c9433d0
Author: Thorsten Blum <[email protected]>
crypto: atmel-ecc - add support for atecc608a
The driver already supports the ATECC508A and ATECC608B and uses only commands shared by these devices.
Microchip documents the ATECC608B as a backwards-compatible, functional drop-in replacement for the ATECC608A, with the same device structure and command interface [1]. Therefore, add support for the ATECC608A.
ATECC608A hardware was not available for testing.
drivers/crypto/atmel-ecc.c static void atmel_ecc_remove(struct i2c_client *client)
Quoted 5 lines
drivers/crypto/atmel-ecc.c +0
-0@@ -348,6 +348,7 @@ static void atmel_ecc_remove(struct i2c_client *client)
[Severity: High]
This is a pre-existing issue, but can the early return in atmel_ecc_remove() cause a use-after-free?
If a user unbinds the ATECC device via sysfs while a crypto operation is in flight (tfm_count > 0):
drivers/crypto/atmel-ecc.c:atmel_ecc_remove() {
...
if (atomic_read(&i2c_priv->tfm_count)) {
dev_emerg(&client->dev, "Device is busy, expect memory corruption.\n");
return;
}
...
list_del(&i2c_priv->i2c_client_list_node);
...
}The early return bypasses list_del(&i2c_priv->i2c_client_list_node). The driver core then frees the devm_kmalloc-allocated i2c_priv, leaving a freed node on the global driver_data.i2c_client_list.
The next time any crypto operation is requested, atmel_ecc_i2c_client_alloc() will iterate over the list and access the freed i2c_priv node, causing a use-after-free.
Does it make sense to always remove the node from the list before returning?
Quoted 7 lines
drivers/crypto/atmel-ecc.c +1
-0static const struct of_device_id atmel_ecc_dt_ids[] = { { .compatible ="atmel,atecc508a" , }, + { .compatible ="atmel,atecc608a" , }, { .compatible ="atmel,atecc608b" , }, { } };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
pw-bot: not-applicable
Herbert Xu
maintainerQuoted 6 lines · Thorsten Blum
Add an entry for ATECC608A.
Signed-off-by Thorsten Blum <[email protected]>--- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt