Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jiangshan Yi <yijiangshan@kylinos.cn>
Cc: andy@kernel.org, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, 13667453960@163.com,
	stable@kernel.org
Subject: Re: [PATCH] serial: 8250_mid: Fix NULL function pointer dereference on DNV/ICX-D/SNR platforms
Date: Wed, 15 Jul 2026 09:10:23 +0300	[thread overview]
Message-ID: <alckT06ko8sfvfMV@ashevche-desk.local> (raw)
In-Reply-To: <20260715030336.1512861-1-yijiangshan@kylinos.cn>

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 <andriy.shevchenko@linux.intel.com>
but I have a nit-pick below.

> Fixes: b1b4efea05a5 ("serial: 8250_mid: Disable DMA for selected platforms")
> Cc: stable@kernel.org

> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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



  reply	other threads:[~2026-07-15  6:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  3:03 [PATCH] serial: 8250_mid: Fix NULL function pointer dereference on DNV/ICX-D/SNR platforms Jiangshan Yi
2026-07-15  6:10 ` Andy Shevchenko [this message]
2026-07-15  7:13   ` Jiangshan Yi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alckT06ko8sfvfMV@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=13667453960@163.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=yijiangshan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox