Re: [PATCH] serial: 8250_mid: Fix NULL function pointer dereference on DNV/ICX-D/SNR platforms

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Wed, Jul 15, 2026 at 11:03:36AM +0800, Jiangshan Yi wrote:
> Commit b1b4efea05a5 ("serial: 8250_mid: Disable DMA for selected
> platforms") replaced the dnv_board setup and exit callbacks with
> PTR_IF(false, ...), which evaluates to NULL. However, the three call
> sites in mid8250_probe() and mid8250_remove() unconditionally dereference
> these function pointers without NULL checks, causing a NULL pointer
> dereference (kernel oops) on any Denverton (DNV), Ice Lake Xeon D
> (ICX-D/CDF), or Snowridge (SNR) platform.
> 
> Fix this by adding the missing NULL checks before calling the setup
> and exit callbacks.

Oh, thanks!
Reviewed-by: Andy Shevchenko <[email protected]>
but I have a nit-pick below.

> Fixes: b1b4efea05a5 ("serial: 8250_mid: Disable DMA for selected platforms")
> Cc: [email protected]

> Cc: Andy Shevchenko <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>

These two Cc may be moved either to --to option of `git format-patch` or after
the cutter '---' line to avoid unneeded noise in the commit message.

...

> -	ret = mid->board->setup(mid, &uart.port);
> +	ret = mid->board->setup ? mid->board->setup(mid, &uart.port) : 0;
>  	if (ret)
>  		return ret;

Likewise the rest, this can be also wrapped to the if-condition:

	if (mid->board->setup) {
		ret = mid->board->setup(mid, &uart.port);
		if (ret)
			return ret;
	}

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.