lkml.org 
[lkml]   [2022]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] tty: n_gsm: fix missing assignment of gsm->receive() in gsmld_attach_gsm()
Date
> 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().

Best regards,
Daniel Starke

\
 
 \ /
  Last update: 2022-08-10 11:09    [W:0.046 / U:3.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site