]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ib_core: More fixes to ib_sa_add_one error flow
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Thu, 14 Nov 2013 15:35:06 +0000 (17:35 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:14 +0000 (14:45 -0700)
commit5f0aa40aba27d96ea7900e08208d63775ebb5127
tree7b0bb77bfc2308ce9d70f21f91e59045b626bc76
parentfb8ea8a9cafab8c7f6cf46747400a4a3d016b4d7
ib_core: More fixes to ib_sa_add_one error flow

commit 0e7377eed fixed a resource leak of mad agents in
the ib_sa_add_one error flow.  However, the fix allowed
ib_mad_unregister_agent to be called in a case where the
ib_mad_register_agent request failed (resulting in an
illegal pointer in the agent field).  This caused a kernel
Oops in the error flow.

Fix this by calling ib_unregister_mad_agent only for cases where
ib_register_mad_agent succeeded.

In addition, separate the ib_register_event_handler() call error
flow from the loop error flow. If the call to
ib_register_event_handler fails, the client data must be reset
to NULL, (in case at some point ib_register_event_handler() is
modified so that it may return a non-zero (error) value).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/infiniband/core/sa_query.c