Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1658145 > unrolled thread

[PATCH] tty: ipwireless: fix potential NULL pointer dereference

Started by"Gustavo A. R. Silva" <garsilva@embeddedor.com>
First post2017-06-05 23:00 +0200
Last post2017-06-06 12:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: ipwireless: fix potential NULL pointer dereference "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-05 23:00 +0200
    Re: [PATCH] tty: ipwireless: fix potential NULL pointer dereference David Sterba <dsterba@suse.cz> - 2017-06-06 12:50 +0200

#1658145 — [PATCH] tty: ipwireless: fix potential NULL pointer dereference

From"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date2017-06-05 23:00 +0200
Subject[PATCH] tty: ipwireless: fix potential NULL pointer dereference
Message-ID<tP7gt-7Lh-5@gated-at.bofh.it>
Add null check before dereferencing pointer ver_packet.
Print error message and exit in case pointer ver_packet
is NULL.

Addresses-Coverity-ID: 1362295
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/tty/ipwireless/hardware.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index df0204b..20db99d 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1515,6 +1515,13 @@ 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) {
+		pr_err(IPWIRELESS_PCCARD_NAME
+		       ": Not enough memory to send packet\n");
+		return;
+	}
+
 	ver_packet->header.length = sizeof(struct tl_setup_get_version_qry);
 
 	/*
-- 
2.5.0

[toc] | [next] | [standalone]


#1658603

FromDavid Sterba <dsterba@suse.cz>
Date2017-06-06 12:50 +0200
Message-ID<tPkdI-7xX-15@gated-at.bofh.it>
In reply to#1658145
On Mon, Jun 05, 2017 at 03:50:02PM -0500, Gustavo A. R. Silva wrote:
> Add null check before dereferencing pointer ver_packet.
> Print error message and exit in case pointer ver_packet
> is NULL.

And what next? The caller does not expect a failure and continues as if
the packet has been set up and sent and waiting for a response. This
will likely hang somewhere or just do nothing regarding
sending/receiving user packets. Failures of alloc_ctrl_packet are
handled elsewhere, even during the setup phase so this could be handled
more gracefully.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web