Page MenuHomeFreeBSD

ib mad: fix an incorrect use of list_for_each_entry
ClosedPublic

Authored by markj on Jul 30 2015, 12:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 7:01 PM
Unknown Object (File)
Thu, May 2, 6:26 PM
Unknown Object (File)
Thu, May 2, 5:30 PM
Unknown Object (File)
Thu, May 2, 3:43 PM
Unknown Object (File)
Fri, Apr 26, 6:38 AM
Unknown Object (File)
Fri, Apr 26, 6:23 AM
Unknown Object (File)
Dec 20 2023, 12:41 AM
Unknown Object (File)
Aug 13 2023, 3:11 AM
Subscribers

Details

Summary

In tf_dequeue(), if we reach the end of the fifo list without finding a
non-cancelled element, tmp will be a pointer to the list head, so the
tmp->canceled check is bogus. Use a flag instead to avoid this.

Submitted by: Tao Liu <Tao.Liu@isilon.com>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj retitled this revision from to ib mad: fix an incorrect use of list_for_each_entry.
markj edited the test plan for this revision. (Show Details)
markj added a reviewer: hselasky.
markj updated this object.
sys/ofed/drivers/infiniband/core/mad.c
307 ↗(On Diff #7491)

I think the correct fix is:

if (tmp == NULL)
....

No need for an extra variable?

You can assume that at the end of list_for_each_entry() "tmp" is NULL.

--HPS

sys/ofed/drivers/infiniband/core/mad.c
307 ↗(On Diff #7491)

That's true with queue(9) but not with Linux's list macros. Otherwise we'd always crash here.

sys/ofed/drivers/infiniband/core/mad.c
307 ↗(On Diff #7491)

I was mixing list_for_each() with list_for_each_safe() ... Would it be an idea to switch to list_for_each_safe() ? And add a list entry pointer instead of a bool. It will consume a register anyway ...

sys/ofed/drivers/infiniband/core/mad.c
307 ↗(On Diff #7491)

Nevermind. You're right Linux lists are not queue(9) compatible.

This revision is now accepted and ready to land.Jul 30 2015, 7:51 AM
sys/ofed/drivers/infiniband/core/mad.c
307 ↗(On Diff #7491)

Don't forget to MFC when you commit it.

This revision was automatically updated to reflect the committed changes.