Patch "selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftest-tpm2-add-client.__del__-to-close-dev-tpm-ha.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fb9cc305a00a3aca92bd52434ab0b78accf0937f
Author: Stefan Berger <stefanb@xxxxxxxxxxxxx>
Date:   Tue Sep 20 09:15:18 2022 -0400

    selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle
    
    [ Upstream commit 2d869f0b458547386fbcd8cf3004b271b7347b7f ]
    
    The following output can bee seen when the test is executed:
    
      test_flush_context (tpm2_tests.SpaceTest) ... \
        /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
        unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>
    
    An instance of Client does not implicitly close /dev/tpm* handle, once it
    gets destroyed. Close the file handle in the class destructor
    Client.__del__().
    
    Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests")
    Cc: Shuah Khan <shuah@xxxxxxxxxx>
    Cc: linux-kselftest@xxxxxxxxxxxxxxx
    Cc: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
    Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
    Reviewed-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
    Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py
index 057a4f49c79d..c7363c6764fc 100644
--- a/tools/testing/selftests/tpm2/tpm2.py
+++ b/tools/testing/selftests/tpm2/tpm2.py
@@ -371,6 +371,10 @@ class Client:
             fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags)
             self.tpm_poll = select.poll()
 
+    def __del__(self):
+        if self.tpm:
+            self.tpm.close()
+
     def close(self):
         self.tpm.close()
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux