HomeFreeBSD

uart: Fix an out-of-bounds read in ns8250_bus_probe()

Description

uart: Fix an out-of-bounds read in ns8250_bus_probe()

The problem is that ns8250_bus_probe() accesses a field from the
ns8250_softc, which embeds the generic UART softc, but the ns8250_softc
hasn't yet been allocated because we're still probing.

This is a regression from commit 0aefb0a63c50. This fixed a problem
where one of the upper four IER bits, which are usually reserved, needs
to be set in order to get RX interrupts before the RX FIFO is full. At
the same time, we avoid clearing those reserved bits (see commit
58957d87173, though other UART drivers I looked at do not bother with
this).

So, copy what ns8250_init() does to disable interrupts, since we don't
know what the "right" mask is at this point.

Reported by: syzbot+f256beefd0df9eb796e7@syzkaller.appspotmail.com
Reviewed by: imp
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4a9a41650c909706bc0b9a3f29817c11b262b0a0)

Details

Provenance
markjAuthored on Jul 13 2021, 9:49 PM
Parents
rG6e405dd9e48d: cxgbe(4): Remove some dead code.
Branches
Unknown
Tags
Unknown