public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Michael Thalmeier <michael.thalmeier@hale.at>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	<john.ogness@linutronix.de>, <pmladek@suse.com>
Subject: Re: [PATCH v2] tty: ttynull: implement console write
Date: Wed, 15 Feb 2023 12:37:36 +0100	[thread overview]
Message-ID: <Y+zEAA1hp+3guGxT@axis.com> (raw)
In-Reply-To: <20230214115921.399608-1-michael.thalmeier@hale.at>

+ Cc: John, Petr

On Tue, Feb 14, 2023 at 12:59:21PM +0100, Michael Thalmeier wrote:
> Since commit a699449bb13b ("printk: refactor and rework printing logic"),
> con->write is called without checking if it is implemented in the console
> driver. This does make some sense, because for all "normal" consoles it
> is vital to have a write function.
> As the ttynull console driver does not need any console output the write
> function was not implemented. This caused a "unable to handle kernel NULL
> pointer dereference" when the write function is called now.
> 
> To fix this issue, implement an empty write function.
> 
> Fixes: a699449bb13b ("printk: refactor and rework printing logic")
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>

Looking at the referenced commit, the only place I see it calling
con->write() is from call_console_driver(), which is in turn only called
from console_emit_next_record().  And console_flush_all(), the only
caller of console_emit_next_record(), checks that con->write is not NULL
using console_is_usable() before calling console_emit_next_record().

What am I missing?  Which code path in the referenced commit calls
con->write without checking for NULL?

  reply	other threads:[~2023-02-15 11:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 11:59 [PATCH v2] tty: ttynull: implement console write Michael Thalmeier
2023-02-15 11:37 ` Vincent Whitchurch [this message]
2023-02-15 14:33   ` Petr Mladek
2023-02-15 15:18     ` John Ogness
2023-02-15 16:13       ` Petr Mladek
2023-02-15 22:06         ` John Ogness
2023-02-15 16:38     ` Michael Thalmeier
2023-02-15 22:11       ` John Ogness
2023-02-16  6:48         ` Greg Kroah-Hartman

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=Y+zEAA1hp+3guGxT@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.thalmeier@hale.at \
    --cc=pmladek@suse.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