binder: free fd fixups on superseded transaction teardown
Subsystems (2)
PATCH 1/1 binder: free fd fixups on superseded transaction teardown
From: Tristan Madani <[email protected]>
When a TF_UPDATE_TXN oneway transaction supersedes an outdated pending transaction, the outdated transaction is freed with kfree() but its fd_fixups list is not cleaned up first. Each binder_txn_fd_fixup on the list holds a reference to a struct file (from fget in the sender path) that is never released.
All other transaction teardown paths (binder_free_transaction and the error paths in binder_transaction) correctly call binder_free_txn_fixups() before freeing. Apply the same cleanup to the t_outdated teardown path.
--- drivers/android/binder.c | 1 + 1 file changed, 1 insertion(+)
drivers/android/binder.c +1 -0
@@ -2920,6 +2920,7 @@ static int binder_proc_transaction(struct binder_transaction *t,trace_binder_transaction_update_buffer_release (buffer);binder_release_entire_buffer (proc,NULL , buffer, false);binder_alloc_free_buf (&proc->alloc, buffer); +binder_free_txn_fixups (t_outdated);kfree (t_outdated);binder_stats_deleted (BINDER_STAT_TRANSACTION ); }
Signature · 1 line
2.47.3
Quoted 8 lines · Tristan Madani
From: Tristan Madani <[email protected]>
When a
TF_UPDATE_TXNoneway transaction supersedes an outdated pending transaction, the outdated transaction is freed withkfree()but itsfd_fixupslist is not cleaned up first. Eachbinder_txn_fd_fixupon the list holds a reference to a struct file (from fget in the sender path) that is never released.
Quoted 8 lines
All other transaction teardown paths (
binder_free_transactionand the error paths inbinder_transaction) correctly callbinder_free_txn_fixups()before freeing. Apply the same cleanup to thet_outdatedteardown path.Fixes 9864bb480133 ("Binder: add TF_UPDATE_TXN to replace outdated txn")Signed-off-by Tristan Madani <[email protected]>
Seems reasonable to me.
Quoted 35 lines · Tristan Madani
From: Tristan Madani <[email protected]>
When a
TF_UPDATE_TXNoneway transaction supersedes an outdated pending transaction, the outdated transaction is freed withkfree()but itsfd_fixupslist is not cleaned up first. Eachbinder_txn_fd_fixupon the list holds a reference to a struct file (from fget in the sender path) that is never released.All other transaction teardown paths (
binder_free_transactionand the error paths inbinder_transaction) correctly callbinder_free_txn_fixups()before freeing. Apply the same cleanup to thet_outdatedteardown path.Fixes 9864bb480133 ("Binder: add TF_UPDATE_TXN to replace outdated txn")Signed-off-by Tristan Madani <[email protected]>--- drivers/android/binder.c | 1 + 1 file changed, 1 insertion(+)drivers/android/binder.c +1
-0@@ -2920,6 +2920,7 @@ static int binder_proc_transaction(struct binder_transaction *t,trace_binder_transaction_update_buffer_release (buffer);binder_release_entire_buffer (proc,NULL , buffer, false);binder_alloc_free_buf (&proc->alloc, buffer); +binder_free_txn_fixups (t_outdated);kfree (t_outdated);binder_stats_deleted (BINDER_STAT_TRANSACTION ); }Signature · 1 line
2.47.3
Thanks Tristan,