[PATCH 1/1] Fix Kernel Panic due to dereference of the invalid handle. First validate the handle and then derefer it in BUG_ON.

From: Shailendra Verma
Date: Sat Jan 17 2015 - 01:13:26 EST



Signed-off-by: Shailendra Verma <shailendra.capricorn@xxxxxxxxx>
---
drivers/staging/android/ion/ion.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 296d347..9e56d32 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -536,8 +536,6 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
{
bool valid_handle;

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

@@ -547,6 +545,7 @@ void ion_free(struct ion_client *client, struct ion_handle *handle)
return;
}
mutex_unlock(&client->lock);
+ BUG_ON(client != handle->client);
ion_handle_put(handle);
}
EXPORT_SYMBOL(ion_free);
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/