[PATCHv2 3/3] android/gatt: Fix possible invalid read

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

 



Fix dereferencing attrib before checking if not null.
---
 android/gatt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index dcb347b..4ff135b 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -554,11 +554,12 @@ static void connection_cleanup(struct gatt_device *device)
 		device->att_io = NULL;
 	}
 
-	if (device->server_id > 0)
-		g_attrib_unregister(device->attrib, device->server_id);
-
 	if (device->attrib) {
 		GAttrib *attrib = device->attrib;
+
+		if (device->server_id > 0)
+			g_attrib_unregister(device->attrib, device->server_id);
+
 		device->attrib = NULL;
 		g_attrib_cancel_all(attrib);
 		g_attrib_unref(attrib);
-- 
1.9.3

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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux