From ba25f353c77e74a211e2005b99712ac3d362f42e Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 20 Apr 2011 06:51:36 +0000 Subject: Potential NULL deref in an error case spotted by chl on one copy; correct fix applied to 3 similar drivers ok chl --- sys/arch/amd64/amd64/aesni.c | 8 +++----- sys/arch/amd64/amd64/via.c | 8 +++----- sys/arch/i386/i386/via.c | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/sys/arch/amd64/amd64/aesni.c b/sys/arch/amd64/amd64/aesni.c index cfcca531ee2..566332df921 100644 --- a/sys/arch/amd64/amd64/aesni.c +++ b/sys/arch/amd64/amd64/aesni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aesni.c,v 1.19 2011/01/12 17:15:23 deraadt Exp $ */ +/* $OpenBSD: aesni.c,v 1.20 2011/04/20 06:51:34 deraadt Exp $ */ /*- * Copyright (c) 2003 Jason Wright * Copyright (c) 2003, 2004 Theo de Raadt @@ -410,10 +410,8 @@ aesni_process(struct cryptop *crp) struct cryptodesc *crd; int err = 0; - if (crp == NULL || crp->crp_callback == NULL) { - err = EINVAL; - goto out; - } + if (crp == NULL || crp->crp_callback == NULL) + return (EINVAL); LIST_FOREACH(ses, &aesni_sc->sc_sessions, ses_entries) { if (ses->ses_sid == crp->crp_sid) diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c index c34b9f34d3c..2dbc9305235 100644 --- a/sys/arch/amd64/amd64/via.c +++ b/sys/arch/amd64/amd64/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.10 2011/01/12 17:15:23 deraadt Exp $ */ +/* $OpenBSD: via.c,v 1.11 2011/04/20 06:51:34 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -443,10 +443,8 @@ viac3_crypto_process(struct cryptop *crp) struct cryptodesc *crd; int sesn, err = 0; - if (crp == NULL || crp->crp_callback == NULL) { - err = EINVAL; - goto out; - } + if (crp == NULL || crp->crp_callback == NULL) + return (EINVAL); sesn = VIAC3_SESSION(crp->crp_sid); if (sesn >= sc->sc_nsessions) { diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c index e8a9da8a99e..f3c8823f559 100644 --- a/sys/arch/i386/i386/via.c +++ b/sys/arch/i386/i386/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.27 2011/01/12 17:15:20 deraadt Exp $ */ +/* $OpenBSD: via.c,v 1.28 2011/04/20 06:51:35 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -444,10 +444,8 @@ viac3_crypto_process(struct cryptop *crp) struct cryptodesc *crd; int sesn, err = 0; - if (crp == NULL || crp->crp_callback == NULL) { - err = EINVAL; - goto out; - } + if (crp == NULL || crp->crp_callback == NULL) + return (EINVAL); sesn = VIAC3_SESSION(crp->crp_sid); if (sesn >= sc->sc_nsessions) { -- cgit v1.2.3