Module Name:    src
Committed By:   mlelstv
Date:           Tue Nov  3 15:06:50 UTC 2020

Modified Files:
        src/sys/net80211: ieee80211_crypto_ccmp.c ieee80211_crypto_tkip.c
            ieee80211_crypto_wep.c

Log Message:
Use kmem_* instead of malloc/free and use interrupt versions as the
code can be called from interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/net80211/ieee80211_crypto_ccmp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net80211/ieee80211_crypto_tkip.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net80211/ieee80211_crypto_wep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net80211/ieee80211_crypto_ccmp.c
diff -u src/sys/net80211/ieee80211_crypto_ccmp.c:1.18 src/sys/net80211/ieee80211_crypto_ccmp.c:1.19
--- src/sys/net80211/ieee80211_crypto_ccmp.c:1.18	Tue Jul 28 15:41:26 2020
+++ src/sys/net80211/ieee80211_crypto_ccmp.c	Tue Nov  3 15:06:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $	*/
+/*	$NetBSD: ieee80211_crypto_ccmp.c,v 1.19 2020/11/03 15:06:50 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7 2005/07/11 03:06:23 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.18 2020/07/28 15:41:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.19 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -106,7 +106,7 @@ ccmp_attach(struct ieee80211com *ic, str
 {
 	struct ccmp_ctx *ctx;
 
-	ctx = kmem_zalloc(sizeof(*ctx), KM_NOSLEEP);
+	ctx = kmem_intr_zalloc(sizeof(*ctx), KM_NOSLEEP);
 	if (ctx == NULL) {
 		ic->ic_stats.is_crypto_nomem++;
 		return NULL;
@@ -120,7 +120,7 @@ ccmp_detach(struct ieee80211_key *k)
 {
 	struct ccmp_ctx *ctx = k->wk_private;
 
-	kmem_free(ctx, sizeof(*ctx));
+	kmem_intr_free(ctx, sizeof(*ctx));
 }
 
 static int

Index: src/sys/net80211/ieee80211_crypto_tkip.c
diff -u src/sys/net80211/ieee80211_crypto_tkip.c:1.16 src/sys/net80211/ieee80211_crypto_tkip.c:1.17
--- src/sys/net80211/ieee80211_crypto_tkip.c:1.16	Thu Dec 19 16:29:50 2019
+++ src/sys/net80211/ieee80211_crypto_tkip.c	Tue Nov  3 15:06:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto_tkip.c,v 1.16 2019/12/19 16:29:50 kamil Exp $	*/
+/*	$NetBSD: ieee80211_crypto_tkip.c,v 1.17 2020/11/03 15:06:50 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.10 2005/08/08 18:46:35 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.16 2019/12/19 16:29:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.17 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_cr
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>
 #include <sys/endian.h>
 
@@ -118,7 +118,7 @@ tkip_attach(struct ieee80211com *ic, str
 {
 	struct tkip_ctx *ctx;
 
-	ctx = malloc(sizeof(struct tkip_ctx), M_DEVBUF, M_NOWAIT | M_ZERO);
+	ctx = kmem_intr_zalloc(sizeof(struct tkip_ctx), KM_NOSLEEP);
 	if (ctx == NULL) {
 		ic->ic_stats.is_crypto_nomem++;
 		return NULL;
@@ -133,7 +133,7 @@ tkip_detach(struct ieee80211_key *k)
 {
 	struct tkip_ctx *ctx = k->wk_private;
 
-	free(ctx, M_DEVBUF);
+	kmem_intr_free(ctx, sizeof(struct tkip_ctx));
 }
 
 static int

Index: src/sys/net80211/ieee80211_crypto_wep.c
diff -u src/sys/net80211/ieee80211_crypto_wep.c:1.12 src/sys/net80211/ieee80211_crypto_wep.c:1.13
--- src/sys/net80211/ieee80211_crypto_wep.c:1.12	Thu May  3 17:14:37 2018
+++ src/sys/net80211/ieee80211_crypto_wep.c	Tue Nov  3 15:06:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto_wep.c,v 1.12 2018/05/03 17:14:37 maxv Exp $	*/
+/*	$NetBSD: ieee80211_crypto_wep.c,v 1.13 2020/11/03 15:06:50 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_wep.c,v 1.7 2005/06/10 16:11:24 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.12 2018/05/03 17:14:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_wep.c,v 1.13 2020/11/03 15:06:50 mlelstv Exp $");
 #endif
 
 /*
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_cr
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>
 #include <sys/endian.h>
 
@@ -95,7 +95,7 @@ wep_attach(struct ieee80211com *ic, stru
 {
 	struct wep_ctx *ctx;
 
-	ctx = malloc(sizeof(struct wep_ctx), M_DEVBUF, M_NOWAIT | M_ZERO);
+	ctx = kmem_intr_zalloc(sizeof(struct wep_ctx), KM_NOSLEEP);
 	if (ctx == NULL) {
 		ic->ic_stats.is_crypto_nomem++;
 		return NULL;
@@ -111,7 +111,7 @@ wep_detach(struct ieee80211_key *k)
 {
 	struct wep_ctx *ctx = k->wk_private;
 
-	free(ctx, M_DEVBUF);
+	kmem_intr_free(ctx, sizeof(struct wep_ctx));
 }
 
 static int

Reply via email to