public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DAC960_Release bug (2.4.x)
@ 2003-04-16  9:55 John v/d Kamp
  2003-04-16 22:40 ` Dave Olien
  0 siblings, 1 reply; 6+ messages in thread
From: John v/d Kamp @ 2003-04-16  9:55 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 571 bytes --]

Hi,

It seems the DAC960_Release function doesn't work correctly when
DAC960_Open is called with File->f_flags has O_NONBLOCK set. This causes
BLKRRPART to fail, as an unsigned int gets decreased below 0.
The File struct passed to DAC960_Release is NULL, so in Open the counters
aren't increased, but in Release they are decreased. I've added a simple
check that prevents the decrements if the counters are 0.

Allso, I've no idea why there are two counters. It seems that the
ControllerUsageCount is only used to increment and decrement.

--
John van der Kamp, ConnecTUX

[-- Attachment #2: Type: TEXT/PLAIN, Size: 681 bytes --]

diff -ur linux-2.4.19/drivers/block/DAC960.c patched-2.4.19/drivers/block/DAC960.c
--- linux-2.4.19/drivers/block/DAC960.c	2002-09-13 17:41:30.000000000 +0200
+++ patched-2.4.19/drivers/block/DAC960.c	2003-04-16 11:07:16.000000000 +0200
@@ -5398,8 +5398,10 @@
   /*
     Decrement the Logical Drive and Controller Usage Counts.
   */
-  Controller->LogicalDriveUsageCount[LogicalDriveNumber]--;
-  Controller->ControllerUsageCount--;
+  if (Controller->LogicalDriveUsageCount[LogicalDriveNumber] > 0)
+    Controller->LogicalDriveUsageCount[LogicalDriveNumber]--;
+  if (Controller->ControllerUsageCount > 0)
+    Controller->ControllerUsageCount--;
   return 0;
 }

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

end of thread, other threads:[~2003-04-18 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-16  9:55 [PATCH] DAC960_Release bug (2.4.x) John v/d Kamp
2003-04-16 22:40 ` Dave Olien
2003-04-17  8:48   ` John v/d Kamp
2003-04-17 20:27     ` Dave Olien
2003-04-18  9:20       ` John v/d Kamp
2003-04-18 16:12         ` Dave Olien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox