RE: [PATCH] infiniband:core:Fix error handling in the function cm_lap_handler

From: Hefty, Sean
Date: Fri Sep 18 2015 - 12:16:30 EST


> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> index ea4db9c..8fab3a7 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -2812,7 +2812,12 @@ static int cm_lap_handler(struct cm_work *work)
> cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
> work->mad_recv_wc->recv_buf.grh,
> &cm_id_priv->av);
> - cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av);
> + ret = cm_init_av_by_path(param->alternate_path, &cm_id_priv-
> >alt_av);
> + if (ret) {
> + spin_unlock_irq(&cm_id_priv->lock);
> + cm_deref_id(cm_id_priv);
> + }

How can this be right? On a failure, we release the spinlock and the reference on the cm_id, then continue on with the processing?

> +
> ret = atomic_inc_and_test(&cm_id_priv->work_count);
> if (!ret)
> list_add_tail(&work->list, &cm_id_priv->work_list);
> --
> 2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/