NCR53C8XX fix against default_tags > MAX_TAGS

Gerard Roudier (groudier@club-internet.fr)
Wed, 11 Nov 1998 10:21:11 +0100 (MET)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--8323328-2138106437-910776071=:755
Content-Type: TEXT/PLAIN; charset=US-ASCII

The attached patch should fix ncr53c8xx-3.1a driver misbehaviour when the
number of configured tags for a device is larger than the maximum
configured for the driver.

Using #ifXXX stuff was not enough to fix this problem, since the device
queue depths are configurable from the boot command line using something
like:
ncr53c8xx=tags:16/t3q5-t4q12/t0q14
The fix is just some checks against driver tags capacity performed at
run-time.

The patch is against kernel 2.1.127. If you need to use it against other
kernels, you may have to remove from the patch the diff section that
applies to Configure.help kernel file.

BTW, the 896 driver needs a similar fix for it to be also protected
against misconfigs, but the attached patch does not apply to this driver.
I will made the appropriate patch available at ftp.tux.org/pub/roudier/896
soon.

Since it has been proven that my personal tests are far from guaranteeing
things are good enough for the kernel main-stream, could you, please, give
this patch a try by forcing misconfigs statically and dynamically from the
boot command line and let me know if you have experienced problems. You
may want to use private emails or just send a copy to the linux-scsi list
if you think your report is to be shared.

Thanks in advance for your help.

Regards,
Gerard.

--8323328-2138106437-910776071=:755
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="ncr53c8xx-3.1a-to-3.1b-for-linux-2.1.127.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.981111102111.755B@localhost>
Content-Description: 3.1a-to-3.1b-for-2.1.127

LS0tIGxpbnV4L2RyaXZlcnMvc2NzaS9DaGFuZ2VMb2cubmNyNTNjOHh4Lk9S
SUcJU3VuIE5vdiAgOCAxNTo1NzowOSAxOTk4DQorKysgbGludXgvZHJpdmVy
cy9zY3NpL0NoYW5nZUxvZy5uY3I1M2M4eHgJV2VkIE5vdiAxMSAwOTo1NDoz
MCAxOTk4DQpAQCAtMSwzICsxLDkgQEANCitNb24gTm92IDExICAxMDowMCAx
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9yZSB0aGFuIA0KLSAg
MzIgdGFnZ2VkIGNvbW1hbmRzLg0KKyAgcG9zc2libGUuIFRoZSBkZWZhdWx0
IHZhbHVlIGlzIDMyLiBNaW5pbXVtIGlzIDIsIG1heGltdW0gaXMgNjQuDQor
ICBNb2Rlcm4gaGFyZCBkaXNrcyBhcmUgYWJsZSB0byBzdXBwb3J0IDY0IHRh
Z3MgYW5kIGV2ZW4gbW9yZSwgYnV0IA0KKyAgZG9ubm90IHNlZW0gdG8gYmUg
ZmFzdGVyIHdoZW4gbW9yZSB0aGFuIDMyIHRhZ3MgYXJlIGJlaW5nIHVzZWQu
DQorICBTbywgdGhlIG5vcm1hbCBhbnN3ZXIgaGVyZSBpcyB0byBnbyB3aXRo
IHRoZSBkZWZhdWx0IHZhbHVlIDMyIHVubGVzcyANCisgIHlvdSBhcmUgdXNp
bmcgdmVyeSBsYXJnZSBoYXJkIGRpc2tzIHdpdGggbGFyZ2UgY2FjaGUgKD49
IDFNQikgdGhhdCANCisgIG1heSBiZSBhYmxlIHRvIHRha2UgYWR2YW50YWdl
IG9mIG1vcmUgdGhhbiAzMiB0YWdnZWQgY29tbWFuZHMuDQogDQogICBUaGVy
ZSBpcyBubyBzYWZlIG9wdGlvbiBhbmQgdGhlIGRlZmF1bHQgYW5zd2VyIGlz
IHJlY29tbWVuZGVkLg0KIA0K
--8323328-2138106437-910776071=:755--

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