Messages in this thread Patch in this message | | | Date | Wed, 16 Apr 2003 11:55:51 +0200 (CEST) | From | John v/d Kamp <> | 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; }
| |