linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference
@ 2019-01-30 10:30 YueHaibing
  2019-01-30 15:58 ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: YueHaibing @ 2019-01-30 10:30 UTC (permalink / raw)
  To: dsterba, gregkh, jslaby; +Cc: linux-kernel, jikos, YueHaibing

There is a potential NULL pointer dereference in case
alloc_ctrl_packet() fails and returns NULL.

Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: fix return value
---
 drivers/tty/ipwireless/hardware.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index b0baa4c..1e21ae3 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1516,6 +1516,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
 			sizeof(struct ipw_setup_get_version_query_packet),
 			ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
 			TL_SETUP_SIGNO_GET_VERSION_QRY);
+	if (!ver_packet)
+		return;
 	ver_packet->header.length = sizeof(struct tl_setup_get_version_qry);
 
 	/*
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference
  2019-01-30 10:30 [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference YueHaibing
@ 2019-01-30 15:58 ` Jiri Slaby
  2019-01-31 12:32   ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2019-01-30 15:58 UTC (permalink / raw)
  To: YueHaibing, gregkh, David Sterba; +Cc: jikos, linux-kernel

On 30. 01. 19, 11:30, YueHaibing wrote:
> There is a potential NULL pointer dereference in case
> alloc_ctrl_packet() fails and returns NULL.
> 
> Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: fix return value
> ---
>  drivers/tty/ipwireless/hardware.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
> index b0baa4c..1e21ae3 100644
> --- a/drivers/tty/ipwireless/hardware.c
> +++ b/drivers/tty/ipwireless/hardware.c
> @@ -1516,6 +1516,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
>  			sizeof(struct ipw_setup_get_version_query_packet),
>  			ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
>  			TL_SETUP_SIGNO_GET_VERSION_QRY);
> +	if (!ver_packet)
> +		return;

LGTM, the timer will retry 30 times, ticking every second.

Acked-by: Jiri Slaby <jslaby@suse.cz>

-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference
  2019-01-30 15:58 ` Jiri Slaby
@ 2019-01-31 12:32   ` David Sterba
  2019-01-31 12:34     ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2019-01-31 12:32 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: YueHaibing, gregkh, jikos, linux-kernel

On Wed, Jan 30, 2019 at 04:58:30PM +0100, Jiri Slaby wrote:
> On 30. 01. 19, 11:30, YueHaibing wrote:
> > There is a potential NULL pointer dereference in case
> > alloc_ctrl_packet() fails and returns NULL.
> > 
> > Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> > v2: fix return value
> > ---
> >  drivers/tty/ipwireless/hardware.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
> > index b0baa4c..1e21ae3 100644
> > --- a/drivers/tty/ipwireless/hardware.c
> > +++ b/drivers/tty/ipwireless/hardware.c
> > @@ -1516,6 +1516,8 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
> >  			sizeof(struct ipw_setup_get_version_query_packet),
> >  			ADDR_SETUP_PROT, TL_PROTOCOLID_SETUP,
> >  			TL_SETUP_SIGNO_GET_VERSION_QRY);
> > +	if (!ver_packet)
> > +		return;
> 
> LGTM, the timer will retry 30 times, ticking every second.

This should be mentioned in the changelog though, it's not obvious at
all why just returning after a failure is ok and that the packet will be
resent.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference
  2019-01-31 12:32   ` David Sterba
@ 2019-01-31 12:34     ` Jiri Slaby
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2019-01-31 12:34 UTC (permalink / raw)
  To: dsterba, YueHaibing, gregkh, jikos, linux-kernel

On 31. 01. 19, 13:32, David Sterba wrote:
> This should be mentioned in the changelog though, it's not obvious at
> all why just returning after a failure is ok and that the packet will be
> resent.

Agreed.

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-31 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 10:30 [PATCH v2 -next] tty: ipwireless: Fix potential NULL pointer dereference YueHaibing
2019-01-30 15:58 ` Jiri Slaby
2019-01-31 12:32   ` David Sterba
2019-01-31 12:34     ` Jiri Slaby

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).