Re: [PATCH v2 net] net: Fix an unsafe loop on the list

From: Anastasia Kovaleva
Date: Wed Oct 02 2024 - 13:53:43 EST


On Wed, 2 Oct 2024 06:02:40 -0700 Jakub Kicinski wrote:
> Could you add a selftest? Should be fairly easy using YNL, ncdevmem is
> the only user so far.

Thank you for your review.

Originally I've stumbled upon this bug while developing a functionality in the
iscsit driver to inform the userspace about a failed iscsi session
authentication. I am not familiar with the netdev test tools; with YNL and
ncdevmem particularly. The change seems trivial enough. It fixes an obvious bug
with the deletion of an element of a list that you are currently iterating
over. I assume that it wasn’t reproduced often because there are few users of
the genetlink and usually there is no listeners of a family while removing a
driver that uses it.

If it is really necessary, it would take me a couple of days to make a test. If
not, I can send a v3 patch that just removes a trailing \.