Re: [PATCH] e1000: fix OOB in e1000_tbi_should_accept()

From: Tony Nguyen
Date: Tue Nov 25 2025 - 17:43:27 EST




On 11/23/2025 7:45 PM, Guangshuo Li wrote:
Hi Tony, all,

Thanks for the review. As suggested by Tony, I’ll keep the declarations at the top and place the bounds checks before assigning last_byte. I’ll send a v2 with the following change:

static bool e1000_tbi_should_accept(struct e1000_adapter *adapter,
                                    u8 status, u8 errors,
                                    u32 length, const u8 *data)
{
    struct e1000_hw *hw = &adapter->hw;
    u8 last_byte;

    /* Guard against OOB on data[length - 1] */
    if (unlikely(!length))
        return false;

    /* Upper bound: length must not exceed rx_buffer_len */
    if (unlikely(length > adapter->rx_buffer_len))
        return false;

    last_byte = data[length - 1];

    /* existing logic follows ... */
}
Please let me know if further adjustments are preferred.

This looks along the lines of what I was expecting.

Thanks,
Tony

Best regards,
Guangshuo Li