public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: gor@linux.ibm.com, agordeev@linux.ibm.com,
	borntraeger@linux.ibm.com, svens@linux.ibm.com,
	schwidefsky@de.ibm.com, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] s390/sclp: Add check for get_zeroed_page()
Date: Mon, 17 Feb 2025 17:01:17 +0100	[thread overview]
Message-ID: <20250217160117.21424B3d-hca@linux.ibm.com> (raw)
In-Reply-To: <20250217153146.2372134-1-haoxiang_li2024@163.com>

On Mon, Feb 17, 2025 at 11:31:46PM +0800, Haoxiang Li wrote:
> Add check for the return value of get_zeroed_page() in
> sclp_console_init() to prevent null pointer dereference.
> 
> Fixes: 4c8f4794b61e ("[S390] sclp console: convert from bootmem to slab")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
>  drivers/s390/char/sclp_con.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/s390/char/sclp_con.c b/drivers/s390/char/sclp_con.c
> index e5d947c763ea..7447076b1ec1 100644
> --- a/drivers/s390/char/sclp_con.c
> +++ b/drivers/s390/char/sclp_con.c
> @@ -282,6 +282,8 @@ sclp_console_init(void)
>  	/* Allocate pages for output buffering */
>  	for (i = 0; i < sclp_console_pages; i++) {
>  		page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +		if (!page)
> +			return -ENOMEM;
>  		list_add_tail(page, &sclp_con_pages);

We can add this check, however if this early allocation would fail a
null pointer dereference would be the last problem we would have to
think about.

Anyway:
Acked-by: Heiko Carstens <hca@linux.ibm.com>

  reply	other threads:[~2025-02-17 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 15:31 [PATCH] s390/sclp: Add check for get_zeroed_page() Haoxiang Li
2025-02-17 16:01 ` Heiko Carstens [this message]
2025-02-17 16:16   ` Heiko Carstens

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=20250217160117.21424B3d-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=haoxiang_li2024@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /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