Re: [PATCH] scsi: libsas: Fix potential array out of bounds in sas_check_*_expander_topo().

From: James Bottomley
Date: Mon Dec 08 2025 - 02:47:29 EST


On Mon, 2025-12-08 at 15:31 +0800, Chaohai Chen wrote:
> No check was made to ensure that parent_phy->appended_phy_id is
> within the valid range. If the expander reports an invalid phy_id, it
> may cause the array to be out of bounds.

We tend to assume hardware operates correctly unless there's a known
faulty device that we need to code around. Have you got a device that
exhibits this problem? Assuming you do, I think the fix is a little
harsh: wouldn't it be better to ignore the misnumbered phy than to
ignore the entire expander?

Regards,

James