From 0495e437293fe165355aa229e2745d21683fc96b Mon Sep 17 00:00:00 2001 From: pjd Date: Sat, 22 Jul 2006 10:04:47 +0000 Subject: Set ses_ictx and ses_octx to NULL after freeing them, so we won't free them twice. This is possible for example in situation when session is used in authentication context, then freed and then used in encryption context and freed - in encryption context ses_ictx and ses_octx are not touched at newsession time, but padlock_freesession could still try to free them when they are not NULL. --- sys/crypto/via/padlock.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/crypto') diff --git a/sys/crypto/via/padlock.c b/sys/crypto/via/padlock.c index 95351af..34d04c4 100644 --- a/sys/crypto/via/padlock.c +++ b/sys/crypto/via/padlock.c @@ -489,10 +489,12 @@ padlock_freesession(void *arg __unused, uint64_t tid) if (ses->ses_ictx != NULL) { bzero(ses->ses_ictx, sizeof(ses->ses_ictx)); free(ses->ses_ictx, M_CRYPTO_DATA); + ses->ses_ictx = NULL; } if (ses->ses_octx != NULL) { bzero(ses->ses_octx, sizeof(ses->ses_octx)); free(ses->ses_octx, M_CRYPTO_DATA); + ses->ses_octx = NULL; } bzero(ses, sizeof(ses)); ses->ses_used = 0; -- cgit v1.1