OSDN Git Service

diag: dci: Prevent task deallocation and possible resource leak
authorManoj Prabhu B <bmanoj@codeaurora.org>
Fri, 22 Feb 2019 11:15:42 +0000 (16:45 +0530)
committerManoj Prabhu B <bmanoj@codeaurora.org>
Fri, 22 Feb 2019 11:15:42 +0000 (16:45 +0530)
Prevent DCI clients' task structs from being deallocated to provide
diag driver a chance to clean up its dci client list. Also update
dci client list pid reference count properly to prevent any resource
leakage.

Bug: 68726653
Change-Id: I31c61442a48ac263fd9ff341f6c29db8ace90952
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
drivers/char/diag/diag_dci.c
drivers/char/diag/diagchar_core.c

index 0858b85..4051521 100644 (file)
@@ -3085,6 +3085,9 @@ int diag_dci_deinit_client(struct diag_dci_client_tbl *entry)
        if (!list_empty(&entry->track))
                list_del(&entry->track);
        driver->num_dci_client--;
+
+       put_task_struct(entry->client);
+       entry->client = NULL;
        /*
         * Clear the client's log and event masks, update the cumulative
         * masks and send the masks to peripherals
index ae1d669..5deeac9 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/sched.h>
 #include <linux/ratelimit.h>
 #include <linux/timer.h>
+#include <linux/sched.h>
 #include <linux/platform_device.h>
 #include <linux/msm_mhi.h>
 #ifdef CONFIG_DIAG_OVER_USB