ta: avb: fix object leakage at lock state write
PATCH 1/1 ta: avb: fix object leakage at lock state write
From: Ivan Khoronzhuk <[email protected]>
Should close object created for reading, so better use seek and then close the object.
Fixes b29b41950 ("ta: add AVB TA")
Signed-off-by Ivan Khoronzhuk <[email protected]>
--- ta/avb/entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
ta/avb/entry.c +5 -1
@@ -239,7 +239,11 @@ static TEE_Result write_lock_state(uint32_t pt,if (count ==sizeof (lock_state) && lock_state == wlock_state) goto out; - res =create_rb_state (wlock_state, &h); + res =TEE_SeekObjectData (h,0 ,TEE_DATA_SEEK_SET ); +if (res) + goto out; + + res =TEE_WriteObjectData (h, &wlock_state,sizeof (wlock_state)); out:TEE_CloseObject (h);return res;
Signature · 1 line
2.34.1
Hi Ivan,
Quoted 30 lines · Ivan Khoronzhuk
From: Ivan Khoronzhuk <[email protected]>
Should close object created for reading, so better use seek and then close the object.
Fixes b29b41950 ("ta: add AVB TA")Signed-off-by Ivan Khoronzhuk <[email protected]>--- ta/avb/entry.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)ta/avb/entry.c +5
-2@@ -239,7 +239,11 @@ static TEE_Result write_lock_state(uint32_t pt,if (count ==sizeof (lock_state) && lock_state == wlock_state) goto out; - res =create_rb_state (wlock_state, &h); + res =TEE_SeekObjectData (h,0 ,TEE_DATA_SEEK_SET ); +if (res) + goto out; + + res =TEE_WriteObjectData (h, &wlock_state,sizeof (wlock_state)); out:TEE_CloseObject (h);return res; --
Quoted 2 lines
2.34.1
The patch looks good. Would you mind opening a pull request at
https://github.com/OP-TEE/optee_os?
Cheers,
Jens