ion: Do not 'put' ION handle until after its final use

pass_to_user() eventually calls kref_put() on an ION handle which is
still live, potentially allowing for it to be legitimately freed by
the client.

Prevent this from happening before its final use in both ION_IOC_ALLOC
and ION_IOC_IMPORT.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c47385c73fced27375559d1a2eb10f165a0869b0)
Issue: FP3SEC-320
Change-Id: I658d8b13cce60b6d384fa0e630980f0d459ca52c
(cherry picked from commit a84b980fcde59e2c1629723bb2aa1eedb78b83ab)
1 file changed