OSDN Git Service

Fix use-after-free in wifi_cleanup()
authorPaul Stewart <pstew@google.com>
Tue, 8 Dec 2015 15:42:24 +0000 (07:42 -0800)
committerandroid-build-merger <android-build-merger@google.com>
Tue, 8 Dec 2015 15:42:24 +0000 (07:42 -0800)
am: 2ce1c4952d

* commit '2ce1c4952d871f2baad0bc69dd8500f830f43db4':
  Fix use-after-free in wifi_cleanup()

1  2 
bcmdhd/wifi_hal/wifi_hal.cpp

@@@ -335,12 -310,12 +335,12 @@@ void wifi_cleanup(wifi_handle handle, w
              pthread_mutex_unlock(&info->cb_lock);
              cmd->cancel();
              pthread_mutex_lock(&info->cb_lock);
-             /* release reference added when command is saved */
-             cmd->releaseRef();
              if (num_cmd == info->num_cmd) {
 -                ALOGE("Cancelling command %p:%s did not work", cmd, cmd->getType());
 +                ALOGI("Cancelling command %p:%s did not work", cmd, (cmd ? cmd->getType(): ""));
                  bad_commands++;
              }
+             /* release reference added when command is saved */
+             cmd->releaseRef();
          }
      }