The following patch aims to fix a possible NULL-ptr-dereference that occurs if a call to get_ep_from_tid() fails to assign nonzero value. Upstream commit 283861a4c52c1ea4df3dd1b6fc75a50796ce3524 has been backported up to version 5.15. For some reason, older stable branches have been ignored. This backport can be cleanly applied to 4.19, 5.4 and 5.10 versions.