Fix a bug introduced in 1.11 (and also MFCd to stable AND the security branch)

that causes a machine to panic when the kernel PPP / DEFLATE code is used.
1.11 moved a ZFREE to a point after the structural members were clobbered
by stores into a union'd structure.

This commit fixes the bug and adds a big whopping comment to make sure
the code isn't 'cleaned up' again :-)

Ian Dowse came up with the same patch independantly 68 seconds before I
did, talk about Karma!

I would also like to thank Eugene Grosbein for marathon work in tracking the
problem down by udpating his -stable based on date over and over again
to close in on the commit that caused his crashes.

PR:		kern/35969
Reviewed by:	Ian Dowse <iedowse@maths.tcd.ie>
X-MFC after:	 immediately
This commit is contained in:
Matthew Dillon 2002-03-20 04:05:26 +00:00
parent 670d17b5c0
commit e38eb7fbe4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92749

View File

@ -3951,11 +3951,15 @@ int r;
r = Z_MEM_ERROR;
LEAVE
}
/*
* this ZFREE must occur *BEFORE* we mess with sub.decode, because
* sub.trees is union'd with sub.decode.
*/
ZFREE(z, s->sub.trees.blens);
s->sub.decode.codes = c;
s->sub.decode.tl = tl;
s->sub.decode.td = td;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE