qcacld-3.0: Refine CSR scan related action sequences

1) In csr_start, CSR module's scan callback function is currently
registered after scan is enabled. This can result in a potential
memory leak of the per-session CSR scan profile's child buffers
when the following events take place in sequence:

    (1) CSR scan is enabled
    (2) Upper layer invokes CSR module for scan requests
        (per-session CSR scan profile's child buffers are
        allocated here)
    (3) Scan finished, but no CSR callback is registered to
        handle it so the previously allocated child buffers
        are leaked
    (4) CSR scan callback function is registered later, but
        it's already too late

Move the CSR scan enabling code to a place after CSR scan
callback is registered to fix the potential memory leakage.

2) CSR scan should be stopped before sessions are closed, and
session init code should not re-enable CSR scan again during
session clean up stage. Or there will be another chance for
the same issue as in 1) to happen again.

3) CSR scan callback function should be deregistered before
a session is closed and cleaned up.

4) Per-session CSR scan profile pointer should be checked
during session clean up and its buffer and child buffers
should be freed to avoid any potential memory leak.

Change-Id: I99101170a58f63b239db620dea01d210e83d9367
CRs-Fixed: 2228321
1 file changed
tree: 13de01331c799d108b18fdf934435e89db7c2a52
  1. components/
  2. core/
  3. uapi/
  4. Android.mk
  5. Kbuild
  6. Kconfig
  7. Makefile
  8. README.txt