]> git.baikalelectronics.ru Git - kernel.git/commit
IB/hfi1: On error, fix use after free during user context setup
authorMichael J. Ruhl <michael.j.ruhl@intel.com>
Tue, 26 Sep 2017 13:06:28 +0000 (06:06 -0700)
committerDoug Ledford <dledford@redhat.com>
Wed, 27 Sep 2017 15:10:36 +0000 (11:10 -0400)
commit227a06cdae15fee4534f447bf7a9e5e5d209574d
treefa25955ee1e88f4f3fc0ace472743d977905e210
parent1cdb8b8f956937e54d7be6d5cc4c7e4ce480fe69
IB/hfi1: On error, fix use after free during user context setup

During base context setup, if setup_base_ctxt() fails, the context is
deallocated. This is incorrect because the context is referenced on
return, to notify any waiting subcontext.  If there are no subcontexts
the pointer will be invalid.

Reorganize the error path so that deallocate_ctxt() is called after all
the possible subcontexts have been notified.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/file_ops.c