hw/xfree86/common: remove broken checks from xf86ClaimFbSlot

The intent of both these checks, I assume,
is that drivers don't claim 2 slots at once (fb, pci, plarform).
If we actually want to implement checking like this,
we would have to put a {fb,pci,platform}SlotClaimed in each driver struct.
We could definitely do that, but it seems weird
to single out this error to protect against.
By design, drivers are able to execute arbitrary code.
Nothing is stopping them from doing `*(volatile char*)0=0;`
in preinit or in one of the probes.

If we do decide to keep these checks, we have to be careful of corner cases.
What happens if a driver is used with multiple cards, one pci one not?
We could also keep track of how many slots a driver claims,
and reject any further claims after the count reaches 1.
We would still have to make that counter per driver and per card.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2025-09-13 11:43:02 +03:00
committed by Enrico Weigelt
parent 22d963bc4d
commit d3fd8c385b

View File

@@ -52,19 +52,6 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
EntityPtr p;
int num;
#ifdef XSERVER_PLATFORM_BUS
if (platformSlotClaimed)
return -1;
#endif
#ifdef XSERVER_LIBPCIACCESS
if (pciSlotClaimed)
return -1;
#endif
#if defined(__sparc__) || defined (__sparc64__)
if (sbusSlotClaimed)
return -1;
#endif
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;