staging: unisys: Guard against task leakage
authorNeil Horman <nhorman@redhat.com>
Tue, 21 Jul 2015 13:55:40 +0000 (09:55 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jul 2015 04:19:17 +0000 (21:19 -0700)
Its possible to overwrite the old task pointer in visornic_resume.  Add a
check to guard against that and a warning if we find that its already
running

Signed-off-by: Neil Horman <nhorman@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visornic/visornic_main.c

index 923c580b9a5df4a2e51a607401657037519f842c..6c60e18b3be415d1530df002975434bcaa58c32e 100644 (file)
@@ -2118,8 +2118,13 @@ static int visornic_resume(struct visor_device *dev,
                 * we can start using the device again.
                 * TODO: State transitions
                 */
-               visor_thread_start(&devdata->threadinfo, process_incoming_rsps,
-                                  devdata, "vnic_incoming");
+               if (!devdata->threadinfo.id)
+                       visor_thread_start(&devdata->threadinfo,
+                                          process_incoming_rsps,
+                                          devdata, "vnic_incoming");
+               else
+                       pr_warn("vnic_incoming already running!\n");
+
                init_rcv_bufs(netdev, devdata);
                spin_lock_irqsave(&devdata->priv_lock, flags);
                devdata->enabled = 1;