[openib-general] [PATCH 0/6] Add pci_find_ht_capability() and fixup HT_CAPTYPE #defines

Michael Ellerman michael at ellerman.id.au
Tue Nov 21 23:26:15 PST 2006


Take #2.

As pointed out by Brice, the previous version was vulnerable to a broken
capability chain causing an infinite loop. Although no one's seen such a
capability chain yet in the wild, it's not that hard to protect against,
and we'd make jokes if certain other OSes exhibitied such a bug.

This patch encapsulates the logic to find a HT capability, and adds logic
to cope with the fact that the HT_CAPTYPE fields actually sit in 3 or 5
bits of the top byte in the capability.

We jigger with __pci_find_next_cap() to create a version which can be passed
a ttl, allowing the caller to maintain the ttl state between calls to
__pci_find_next_cap() - this protects against the infinite loop possibility.

People didn't seem to like the idea of passing the ttl into
pci_find_next_ht_capability(), so I've left that out. Callers which want to
use pci_find_next_ht_capability() should maintain their own TTL to be safe.

Built for Powerpc and Intel, booted on Powerpc.

cheers




More information about the general mailing list