lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1355136608-22029-1-git-send-email-siglesias@igalia.com>
Date:	Mon, 10 Dec 2012 11:49:57 +0100
From:	Samuel Iglesias Gonsalvez <siglesias@...lia.com>
To:	Jens Taprogge <jens.taprogge@...rogge.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	industrypack-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, devel@...uxdriverproject.org,
	Alberto Garcia <agarcia@...lia.com>,
	Samuel Iglesias Gonsalvez <siglesias@...lia.com>
Subject: [PATCH 01/12] ipack/devices/ipoctal: Fix race condition during Tx

From: Alberto Garcia <agarcia@...lia.com>

In order to transmit data, the driver enables Tx and sleeps until
*board_write is set to 1 by the interrupt handler.

It can happen, though, that the data is sent even before the process
is asleep. In this case *board_write must be set to 1 anyway,
otherwise we will be waiting for a condition that will never be true.

Signed-off-by: Alberto Garcia <agarcia@...lia.com>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@...lia.com>
---
 drivers/ipack/devices/ipoctal.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index c06ab39..b312863 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -195,13 +195,10 @@ static void ipoctal_irq_tx(struct ipoctal_channel *channel)
 	*pointer_write = *pointer_write % PAGE_SIZE;
 	channel->nb_bytes--;
 
-	if ((channel->nb_bytes == 0) &&
-	    (waitqueue_active(&channel->queue))) {
-
-		if (channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) {
-			*channel->board_write = 1;
-			wake_up_interruptible(&channel->queue);
-		}
+	if (channel->nb_bytes == 0 &&
+	    channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) {
+		*channel->board_write = 1;
+		wake_up_interruptible(&channel->queue);
 	}
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ