[parisc-linux-cvs] linux grundler

Gérard Roudier groudier@free.fr
Thu, 25 Jul 2002 01:48:45 +0200 (CEST)


Hi Grand,

Great debugging!
Indeed, trying to coalesce the largest possible chunk with another one
does not make sense.

Note that when the driver is used as a MODULE, the faulty code is not
triggerred. When statically linked, the driver frees memory in rare
situations and as a result the faulty code was not this likely to be
trigerred. Anyway, the bug was there and your fix seems correct.

Ok for this fix to be applied.

Thanks a lot,
  Gérard.

On Wed, 24 Jul 2002, Grant Grundler wrote:

> Grant Grundler wrote:
> > CVSROOT:	/var/cvs
> > Module name:	linux
> > Changes by:	grundler	02/07/24 00:21:44
> >
> > Modified files:
> > 	.              : Makefile
> > 	drivers/scsi/sym53c8xx_2: sym_malloc.c
> >
> > Log message:
> > 2.4.18-pa57 fix sym53c8xx_2 "giving up" data page fault
> > c3k has a narrow Bus and the sym53c8xx_2 doesn't know that.
> > It trips over bad parity, prints "giving up..." msg and then
> > data page faults (code 15). Problem is coalescing of free'd
> > data buffers exceeds the max size the driver is expecting to handle
> > and walk off the end of an array (h[i]) of pointers.
>
> Alan,
> Please apply this "upstream" after gerard has had a chance to review.
>
> thanks,
> grant
>
>
> Index: Makefile
> =========================
===========================================
> RCS file: /var/cvs/linux/Makefile,v
> retrieving revision 1.327
> diff -u -p -r1.327 Makefile
> --- Makefile	19 Jul 2002 22:53:02 -0000	1.327
> +++ Makefile	24 Jul 2002 06:17:41 -0000
> @@ -1,7 +1,7 @@
>  VERSION = 2
>  PATCHLEVEL = 4
>  SUBLEVEL = 18
> -EXTRAVERSION = -pa56
> +EXTRAVERSION = -pa57
>
>  KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
>
> Index: drivers/scsi/sym53c8xx_2/sym_malloc.c
> =========================
===========================================
> RCS file: /var/cvs/linux/drivers/scsi/sym53c8xx_2/sym_malloc.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 sym_malloc.c
> --- drivers/scsi/sym53c8xx_2/sym_malloc.c	29 Nov 2001 15:49:45 -0000	=
1.2
> +++ drivers/scsi/sym53c8xx_2/sym_malloc.c	24 Jul 2002 06:17:41 -0000
> @@ -143,12 +143,15 @@ static void ___sym_mfree(m_pool_p mp, vo
>  	a = (m_addr_t) ptr;
>
>  	while (1) {
> -#ifdef SYM_MEM_FREE_UNUSED
>  		if (s == SYM_MEM_CLUSTER_SIZE) {
> +#ifdef SYM_MEM_FREE_UNUSED
>  			M_FREE_MEM_CLUSTER(a);
> +#else
> +			((m_link_p) a)->next = h[i].next;
> +			h[i].next = (m_link_p) a;
> +#endif
>  			break;
>  		}
> -#endif
>  		b = a ^ s;
>  		q = &h[i];
>  		while (q->next && q->next != (m_link_p) b) {
>
>