All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mazin Al Haddad" <mazinalhaddad05@gmail.com>
To: "Starke, Daniel" <daniel.starke@siemens.com>
Cc: "jirislaby@kernel.org" <jirislaby@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kernel-mentees@lists.linuxfoundation.org" 
	<linux-kernel-mentees@lists.linuxfoundation.org>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"paskripkin@gmail.com" <paskripkin@gmail.com>,
	"syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.com" 
	<syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.com>,
	"Greg KH" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] tty: n_gsm: fix missing assignment of gsm->receive() in gsmld_attach_gsm()
Date: Fri, 12 Aug 2022 22:41:35 +0300	[thread overview]
Message-ID: <CM4B165JCMGL.1LA0ST6YL7QAS@Arch-Desktop> (raw)
In-Reply-To: <DB9PR10MB58813E33D3516BAB526156B1E0659@DB9PR10MB5881.EURPRD10.PROD.OUTLOOK.COM>

On Wed Aug 10, 2022 at 12:08 PM +03, Starke, Daniel wrote:
> > Fix this by setting the gsm->receive() function when the line 
> > discipline is being attached to the terminal device, inside 
> > gsmld_attach_gsm(). This will guarantee that the function is assigned 
> > and a call to TIOCSTI, which calls gsmld_receive_buf(), will not
> > reference a null pointer.
>
> In my opinion there are only two possible ways to fix this:
> a) Move the gsm->receive initialization from gsm_activate_mux() to
> gsmld_attach_gsm().
> b) Avoid calling gsm->receive in gsmld_receive_buf() if not initialized.
>
> The current code might assume that gsm->receive is only called after MUX
> activation. Therefore, variant a) may break the code in other places.
> I see no need to initialize gsm->receive in gsm_activate_mux() and
> gsmld_attach_gsm().

Thanks for the feedback! I will send a v2 patch that implements a check
shortly. 

WARNING: multiple messages have this Message-ID (diff)
From: "Mazin Al Haddad" <mazinalhaddad05@gmail.com>
To: "Starke, Daniel" <daniel.starke@siemens.com>
Cc: "jirislaby@kernel.org" <jirislaby@kernel.org>,
	"paskripkin@gmail.com" <paskripkin@gmail.com>,
	"syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.com"
	<syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kernel-mentees@lists.linuxfoundation.org"
	<linux-kernel-mentees@lists.linuxfoundation.org>
Subject: Re: [PATCH] tty: n_gsm: fix missing assignment of gsm->receive() in gsmld_attach_gsm()
Date: Fri, 12 Aug 2022 22:41:35 +0300	[thread overview]
Message-ID: <CM4B165JCMGL.1LA0ST6YL7QAS@Arch-Desktop> (raw)
In-Reply-To: <DB9PR10MB58813E33D3516BAB526156B1E0659@DB9PR10MB5881.EURPRD10.PROD.OUTLOOK.COM>

On Wed Aug 10, 2022 at 12:08 PM +03, Starke, Daniel wrote:
> > Fix this by setting the gsm->receive() function when the line 
> > discipline is being attached to the terminal device, inside 
> > gsmld_attach_gsm(). This will guarantee that the function is assigned 
> > and a call to TIOCSTI, which calls gsmld_receive_buf(), will not
> > reference a null pointer.
>
> In my opinion there are only two possible ways to fix this:
> a) Move the gsm->receive initialization from gsm_activate_mux() to
> gsmld_attach_gsm().
> b) Avoid calling gsm->receive in gsmld_receive_buf() if not initialized.
>
> The current code might assume that gsm->receive is only called after MUX
> activation. Therefore, variant a) may break the code in other places.
> I see no need to initialize gsm->receive in gsm_activate_mux() and
> gsmld_attach_gsm().

Thanks for the feedback! I will send a v2 patch that implements a check
shortly. 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2022-08-12 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  9:08 [PATCH] tty: n_gsm: fix missing assignment of gsm->receive() in gsmld_attach_gsm() Starke, Daniel
2022-08-10  9:08 ` Starke, Daniel
2022-08-12 19:41 ` Mazin Al Haddad [this message]
2022-08-12 19:41   ` Mazin Al Haddad
  -- strict thread matches above, loose matches on Subject: below --
2022-08-10  3:12 Mazin Al Haddad
2022-08-10  3:12 ` Mazin Al Haddad
2022-08-10  5:18 ` Greg KH
2022-08-10  5:18   ` Greg KH

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=CM4B165JCMGL.1LA0ST6YL7QAS@Arch-Desktop \
    --to=mazinalhaddad05@gmail.com \
    --cc=daniel.starke@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paskripkin@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+e3563f0c94e188366dbb@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.