Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a51f4124 authored by David Sterba's avatar David Sterba Committed by Linus Torvalds
Browse files

ipwireless: fix potential tty == NULL dereference



The Coverity checker spotted the following inconsequent NULL checking in
drivers/char/pcmcia/ipwireless/network.c:ipwireless_network_packet_received()

if (tty && channel_idx == IPW_CHANNEL_RAS
		&& (network->ras_control_lines &
			IPW_CONTROL_LINE_DCD) != 0
		&& ipwireless_tty_is_modem(tty)) {
...
	else
		ipwireless_tty_received(tty, data, length);

Cc: Adrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: "John W. Linville" <linville@tuxdriver.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3149be50
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -377,13 +377,16 @@ void ipwireless_network_packet_received(struct ipw_network *network,
	for (i = 0; i < MAX_ASSOCIATED_TTYS; i++) {
	for (i = 0; i < MAX_ASSOCIATED_TTYS; i++) {
		struct ipw_tty *tty = network->associated_ttys[channel_idx][i];
		struct ipw_tty *tty = network->associated_ttys[channel_idx][i];


		if (!tty)
			continue;

		/*
		/*
		 * If it's associated with a tty (other than the RAS channel
		 * If it's associated with a tty (other than the RAS channel
		 * when we're online), then send the data to that tty.  The RAS
		 * when we're online), then send the data to that tty.  The RAS
		 * channel's data is handled above - it always goes through
		 * channel's data is handled above - it always goes through
		 * ppp_generic.
		 * ppp_generic.
		 */
		 */
		if (tty && channel_idx == IPW_CHANNEL_RAS
		if (channel_idx == IPW_CHANNEL_RAS
				&& (network->ras_control_lines &
				&& (network->ras_control_lines &
					IPW_CONTROL_LINE_DCD) != 0
					IPW_CONTROL_LINE_DCD) != 0
				&& ipwireless_tty_is_modem(tty)) {
				&& ipwireless_tty_is_modem(tty)) {