This is a modified backport of upstream commit 5d9745cead1f. It corrects NULL pointer dereference in in_dev_for_each_ifa_rtnl() caused by potential device unavailability. This issue can be triggered on 5.4/5.10 stable branches. Changes had to be made to the modified source file in question. Patch drivers/infiniband/hw/i40iw/i40iw_cm.c instead of: drivers/infiniband/hw/irdma/cm.c due to switch from i40iw to irdma driver in commit fa0cf568fd76. i40iw driver was removed and irdma was introduced as an alias to i40iw. Other than the filename change, the patch remains the same and can be cleanly applied to stable branches listed above.