Re: [PATCH 1/2] staging: android: ion: Do not BUG on handle client mismatch

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

 



On 08/22/2016 03:26 AM, Johanna Abrahamsson wrote:
The ion_free() and ion_free_nolock() functions should not BUG on a
handle client mismatch. It is not necessary to explicitly check for that
mismatch when ion_handle_validate is used.


The validate and BUG_ON are checking two slightly different things.
The BUG_ON is trying to catch blatantly wrong kernel users while the
validate is designed to catch races.

I'd like to keep the BUG_ON in ion_free but it's fine to get rid of
it in ion_free_nolock.

Thanks,
Laura

Signed-off-by: Johanna Abrahamsson <johanna@xxxxxxxx>
---
 drivers/staging/android/ion/ion.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 291d5b8..d209bda 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -550,8 +550,6 @@ static void ion_free_nolock(struct ion_client *client,
 {
 	bool valid_handle;

-	BUG_ON(client != handle->client);
-
 	valid_handle = ion_handle_validate(client, handle);

 	if (!valid_handle) {
@@ -563,8 +561,6 @@ static void ion_free_nolock(struct ion_client *client,

 void ion_free(struct ion_client *client, struct ion_handle *handle)
 {
-	BUG_ON(client != handle->client);
-
 	mutex_lock(&client->lock);
 	ion_free_nolock(client, handle);
 	mutex_unlock(&client->lock);


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux