lkml.org 
[lkml]   [2003]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] DAC960_Release bug (2.4.x)
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, ConnecTUXdiff -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;
}
\
 
 \ /
  Last update: 2005-03-22 13:34    [W:0.069 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site