Crypto: chelsio - Fixes a hang issue during driver registration
authorAyush Sawal <ayush.sawal@chelsio.com>
Mon, 30 Mar 2020 15:18:52 +0000 (20:48 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 06:49:00 +0000 (08:49 +0200)
commitec9cf8afcd641263bac73a608440a2b22e026a0c
tree373a241f43be0e478e86c70fd35bb86b9d5c2c53
parentb0946b45b85a540aa1b030c277301ce87003d5b6
Crypto: chelsio - Fixes a hang issue during driver registration

commit ad59ddd02de26271b89564962e74d689f1a30b49 upstream.

This issue occurs only when multiadapters are present. Hang
happens because assign_chcr_device returns u_ctx pointer of
adapter which is not yet initialized as for this adapter cxgb_up
is not been called yet.

The last_dev pointer is used to determine u_ctx pointer and it
is initialized two times in chcr_uld_add in chcr_dev_add respectively.

The fix here is don't initialize the last_dev pointer during
chcr_uld_add. Only assign to value to it when the adapter's
initialization is completed i.e in chcr_dev_add.

Fixes: fef4912b66d62 ("crypto: chelsio - Handle PCI shutdown event").

Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/chelsio/chcr_core.c