Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Avoid an unnecessary API difference between NetBSD and F...
details: https://anonhg.NetBSD.org/src/rev/8b9c1df28419
branches: trunk
changeset: 582815:8b9c1df28419
user: dyoung <dyoung%NetBSD.org@localhost>
date: Wed Jul 06 23:44:15 2005 +0000
description:
Avoid an unnecessary API difference between NetBSD and FreeBSD:
back out my change to ieee80211_crypto_encap that made it free its
mbuf argument on error. I had thought it was a bug. It was not.
It's the drivers that are broken. Make an(4), atw(4), ipw(4),
iwi(4), ral(4), rtw(4), ural(4), and wi(4) free the mbuf when
ieee80211_crypto_encap returns NULL. Also, return ath(4) to the
way it was---i.e., free the mbuf.
Thanks to Sam Leffler to pointing out my mistake.
diffstat:
sys/dev/ic/ral.c | 8 +++++---
sys/dev/ic/rtw.c | 5 +++--
sys/dev/ic/wi.c | 5 +++--
sys/dev/pci/if_ipw.c | 8 +++++---
sys/dev/usb/if_ural.c | 8 +++++---
sys/net80211/ieee80211_crypto.c | 5 ++---
6 files changed, 23 insertions(+), 16 deletions(-)
diffs (168 lines):
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/dev/ic/ral.c
--- a/sys/dev/ic/ral.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/dev/ic/ral.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ral.c,v 1.2 2005/07/04 17:50:10 drochner Exp $ */
+/* $NetBSD: ral.c,v 1.3 2005/07/06 23:44:15 dyoung Exp $ */
/* $OpenBSD: ral.c,v 1.55 2005/06/20 18:25:10 damien Exp $ */
/*-
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ral.c,v 1.2 2005/07/04 17:50:10 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ral.c,v 1.3 2005/07/06 23:44:15 dyoung Exp $");
#include "bpfilter.h"
@@ -1814,8 +1814,10 @@
if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
k = ieee80211_crypto_encap(ic, ni, m0);
- if (k == NULL)
+ if (k == NULL) {
+ m_freem(m0);
return ENOBUFS;
+ }
/* packet header may have moved, reset our local pointer */
wh = mtod(m0, struct ieee80211_frame *);
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/dev/ic/rtw.c
--- a/sys/dev/ic/rtw.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/dev/ic/rtw.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtw.c,v 1.50 2005/06/28 07:19:33 dyoung Exp $ */
+/* $NetBSD: rtw.c,v 1.51 2005/07/06 23:44:16 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.50 2005/06/28 07:19:33 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.51 2005/07/06 23:44:16 dyoung Exp $");
#include "bpfilter.h"
@@ -3104,6 +3104,7 @@
if ((wh->i_fc[1] & IEEE80211_FC1_WEP) != 0 &&
(k = ieee80211_crypto_encap(ic, ni, m0)) == NULL) {
+ m_freem(m0);
break;
} else
k = NULL;
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/dev/ic/wi.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wi.c,v 1.202 2005/07/06 06:49:25 dyoung Exp $ */
+/* $NetBSD: wi.c,v 1.203 2005/07/06 23:44:16 dyoung Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -106,7 +106,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.202 2005/07/06 06:49:25 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.203 2005/07/06 23:44:16 dyoung Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@@ -1133,6 +1133,7 @@
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
(wh->i_fc[1] & IEEE80211_FC1_WEP)) {
if (ieee80211_crypto_encap(ic, ni, m0) == NULL) {
+ m_freem(m0);
ifp->if_oerrors++;
goto next;
}
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/dev/pci/if_ipw.c
--- a/sys/dev/pci/if_ipw.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/dev/pci/if_ipw.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ipw.c,v 1.12 2005/06/22 06:16:02 dyoung Exp $ */
+/* $NetBSD: if_ipw.c,v 1.13 2005/07/06 23:44:15 dyoung Exp $ */
/*-
* Copyright (c) 2004
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.12 2005/06/22 06:16:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.13 2005/07/06 23:44:15 dyoung Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -723,8 +723,10 @@
iswep = (wh->i_fc[1] & IEEE80211_FC1_WEP) ? 1 : 0;
- if (iswep && (k = ieee80211_crypto_encap(ic, ni, m)) == NULL)
+ if (iswep && (k = ieee80211_crypto_encap(ic, ni, m)) == NULL) {
+ m_freem(m);
return EIO;
+ }
#if NBPFILTER > 0
if (sc->sc_drvbpf != NULL) {
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/dev/usb/if_ural.c
--- a/sys/dev/usb/if_ural.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/dev/usb/if_ural.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ural.c,v 1.2 2005/07/04 17:46:31 drochner Exp $ */
+/* $NetBSD: if_ural.c,v 1.3 2005/07/06 23:44:17 dyoung Exp $ */
/* $OpenBSD: if_ral.c,v 1.36 2005/06/20 18:54:59 damien Exp $ */
/*-
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.2 2005/07/04 17:46:31 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.3 2005/07/06 23:44:17 dyoung Exp $");
#include "bpfilter.h"
@@ -1241,8 +1241,10 @@
if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
k = ieee80211_crypto_encap(ic, ni, m0);
- if (k == NULL)
+ if (k == NULL) {
+ m_freem(m0);
return ENOBUFS;
+ }
/* packet header may have moved, reset our local pointer */
wh = mtod(m0, struct ieee80211_frame *);
diff -r f3ba0ae1ca01 -r 8b9c1df28419 sys/net80211/ieee80211_crypto.c
--- a/sys/net80211/ieee80211_crypto.c Wed Jul 06 23:08:57 2005 +0000
+++ b/sys/net80211/ieee80211_crypto.c Wed Jul 06 23:44:15 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee80211_crypto.c,v 1.7 2005/06/22 06:16:02 dyoung Exp $ */
+/* $NetBSD: ieee80211_crypto.c,v 1.8 2005/07/06 23:44:15 dyoung Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.7 2004/12/31 22:42:38 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.7 2005/06/22 06:16:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.8 2005/07/06 23:44:15 dyoung Exp $");
#endif
#include "opt_inet.h"
@@ -542,7 +542,6 @@
if (cip->ic_encap(k, m, keyid<<6))
return k;
bad:
- m_freem(m);
return NULL;
}
Home |
Main Index |
Thread Index |
Old Index