Re: [PATCH 26/62] misc: nsm: Fix a locking bug in an error path

From: Alexander Graf

Date: Mon Feb 23 2026 - 17:17:34 EST



On 23.02.26 23:00, Bart Van Assche wrote:
From: Bart Van Assche <bvanassche@xxxxxxx>

If nsm->lock has not been locked, do not unlock it from any error path.
This bug has been detected by the Clang thread-safety analyzer.

Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
Cc: Alexander Graf <graf@xxxxxxxxxx>
Cc: The AWS Nitro Enclaves Team <aws-nitro-enclaves-devel@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Fixes: b9873755a6c8 ("misc: Add Nitro Secure Module driver")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>


Thanks for catching this!

Reviewed-by: Alexander Graf <graf@xxxxxxxxxx>


Alex





Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597