linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Starke, Daniel" <daniel.starke@siemens.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"jirislaby@kernel.org" <jirislaby@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 16/20] tty: n_gsm: fix invalid command/response bit check for UI/UIH frames
Date: Tue, 19 Apr 2022 07:10:43 +0000	[thread overview]
Message-ID: <AM4PR1001MB1378879B82FF126255EFB099E0F29@AM4PR1001MB1378.EURPRD10.PROD.OUTLOOK.COM> (raw)

> 42:21AM -0700, D. Starke wrote:
> > From: Daniel Starke <daniel.starke@siemens.com>
> > 
> > n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010.
> > See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1516
> > The changes from 07.010 to 27.010 are non-functional. Therefore, I 
> > refer to the newer 27.010 here. Chapter 5.4.3.1 states the CR bit in 
> > UI and UIH frames shall always be set 1 by the initiator and 0 by the responder.
> 
> This has nothing to do with the change you made here.
> 
> 
> > Currently, gsm_queue() has a pre-processor gated (excluded) check 
> > which treats all frames that conform to the standard as malformed frames.
> > Remove this optional code to avoid confusion and possible breaking 
> > changes in case that someone includes it.
> 
> Again, nothing to do with the code change.

Including this code (i.e. with #if 1) will treat every correct UI/UIH frame
as invalid, because the cr flag is always set to 1 for those frames
(as mentioned in chapter 5.4.3.1 of the standard). This is obviously wrong.

> > 
> > Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
> 
> This "fixes" nothing :(

What is the correct way to handle the removal of such dead and obviously
wrong code?

> > Cc: stable@vger.kernel.org
> 
> How is commenting out unused code a stable backport requirement?

True, it does not change the behavior but it fixes a commit which is also
present in the current stable release. I was unsure how to handle this
case. I will remove the backport remark.

> > Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
> > ---
> >  drivers/tty/n_gsm.c | 4 ----
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 
> > e9a7d9483c1f..f4ec48c0d6d7 100644
> > --- a/drivers/tty/n_gsm.c
> > +++ b/drivers/tty/n_gsm.c
> > @@ -1896,10 +1896,6 @@ static void gsm_queue(struct gsm_mux *gsm)
> >  	case UI|PF:
> >  	case UIH:
> >  	case UIH|PF:
> > -#if 0
> > -		if (cr)
> > -			goto invalid;
> > -#endif
> 
> All you are doing is cleaning up dead code.  Not a big deal, and not
> worth all the text above to confuse people :(

As mentioned above, this is not only dead but also wrong code. I tried to
elaborate the reason for it being wrong code in the text above.

Best regards,
Daniel Starke

             reply	other threads:[~2022-04-19  7:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  7:10 Starke, Daniel [this message]
2022-04-19  7:26 ` [PATCH 16/20] tty: n_gsm: fix invalid command/response bit check for UI/UIH frames Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2022-04-14  9:42 [PATCH 01/20] tty: n_gsm: fix missing mux reset on config change at responder D. Starke
2022-04-14  9:42 ` [PATCH 16/20] tty: n_gsm: fix invalid command/response bit check for UI/UIH frames D. Starke
2022-04-15  6:31   ` 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=AM4PR1001MB1378879B82FF126255EFB099E0F29@AM4PR1001MB1378.EURPRD10.PROD.OUTLOOK.COM \
    --to=daniel.starke@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).