diff options
author | Bart Van Assche <bvanassche@acm.org> | 2014-05-20 10:33:41 +0200 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-05-29 21:27:30 -0700 |
commit | 8ec0a0e6b58218bdc1db91dd70ebfcd6ad8dd6cd (patch) | |
tree | 590ec889edc8743b0fa580945a4316ae5af6a31c /drivers/ide/pdc202xx_new.c | |
parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) |
IB/umad: Fix error handling
Avoid leaking a kref count in ib_umad_open() if port->ib_dev == NULL
or if nonseekable_open() fails.
Avoid leaking a kref count, that sm_sem is kept down and also that the
IB_PORT_SM capability mask is not cleared in ib_umad_sm_open() if
nonseekable_open() fails.
Since container_of() never returns NULL, remove the code that tests
whether container_of() returns NULL.
Moving the kref_get() call from the start of ib_umad_*open() to the
end is safe since it is the responsibility of the caller of these
functions to ensure that the cdev pointer remains valid until at least
when these functions return.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: <stable@vger.kernel.org>
[ydroneaud@opteya.com: rework a bit to reduce the amount of code changed]
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
[ nonseekable_open() can't actually fail, but.... - Roland ]
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/ide/pdc202xx_new.c')
0 files changed, 0 insertions, 0 deletions