misc: hpilo: validate device queue entries before use

ilo_pkt_dequeue() trusts descriptor IDs and lengths read from the shared
FIFO entry. A bad entry can select a descriptor outside the allocated
queue memory or report a packet length larger than one descriptor.

Reject entries whose descriptor index or packet length exceeds the queue
layout before deriving the packet pointer returned to read and write
paths.

Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
Link: https://patch.msgid.link/20260624190919.3432-1-alhouseenyousef@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Yousef Alhouseen 2026-06-24 21:09:19 +02:00 committed by Greg Kroah-Hartman
parent 655faba1cc
commit 7bf6940d7c

View File

@ -160,11 +160,16 @@ static int ilo_pkt_dequeue(struct ilo_hwinfo *hw, struct ccb *ccb,
ret = fifo_dequeue(hw, fifobar, &entry);
if (ret) {
int pkt_len;
pkt_id = get_entry_id(entry);
pkt_len = get_entry_len(entry);
if (pkt_id >= NR_QENTRY || pkt_len > desc_mem_sz(1))
return 0;
if (id)
*id = pkt_id;
if (len)
*len = get_entry_len(entry);
*len = pkt_len;
if (pkt)
*pkt = (void *)(desc + desc_mem_sz(pkt_id));
}