From bb2f69e83f72bd86fd401384ca085c8da592708a Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Wed, 6 Nov 2013 12:57:01 +0000 Subject: [PATCH] Check for "ieee80211_vap_setup()" failure in all USB WLAN drivers. MFC after: 1 week --- sys/dev/usb/wlan/if_rsu.c | 9 +++++++-- sys/dev/usb/wlan/if_rum.c | 9 +++++++-- sys/dev/usb/wlan/if_run.c | 8 +++++++- sys/dev/usb/wlan/if_uath.c | 9 +++++++-- sys/dev/usb/wlan/if_upgt.c | 9 +++++++-- sys/dev/usb/wlan/if_ural.c | 9 +++++++-- sys/dev/usb/wlan/if_urtw.c | 9 +++++++-- sys/dev/usb/wlan/if_urtwn.c | 9 +++++++-- sys/dev/usb/wlan/if_zyd.c | 9 +++++++-- 9 files changed, 63 insertions(+), 17 deletions(-) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 048780ed75aa..d24de804bf1c 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -481,8 +481,13 @@ rsu_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, if (uvp == NULL) return (NULL); vap = &uvp->vap; - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c index c863b943d4ce..608026a55623 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -605,8 +605,13 @@ rum_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return NULL; vap = &rvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(rvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ rvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index bfc008ff7bf9..aa0db4c87f23 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -804,7 +804,13 @@ run_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, if (rvp == NULL) return (NULL); vap = &rvp->vap; - ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, + opmode, flags, bssid, mac) != 0) { + /* out of memory */ + free(rvp, M_80211_VAP); + return (NULL); + } vap->iv_key_update_begin = run_key_update_begin; vap->iv_key_update_end = run_key_update_end; diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c index 836f0a41c865..3645d180997f 100644 --- a/sys/dev/usb/wlan/if_uath.c +++ b/sys/dev/usb/wlan/if_uath.c @@ -1073,8 +1073,13 @@ uath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return (NULL); vap = &uvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c index ec32b27599b7..6c77b3bf358f 100644 --- a/sys/dev/usb/wlan/if_upgt.c +++ b/sys/dev/usb/wlan/if_upgt.c @@ -1041,8 +1041,13 @@ upgt_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return NULL; vap = &uvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 46e364ef42c2..3f277e929e5f 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -590,8 +590,13 @@ ural_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return NULL; vap = &uvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c index fb11c2d487fa..61fb43ef6feb 100644 --- a/sys/dev/usb/wlan/if_urtw.c +++ b/sys/dev/usb/wlan/if_urtw.c @@ -1036,8 +1036,13 @@ urtw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return (NULL); vap = &uvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c index 4677338c4cdf..de4184c24b9b 100644 --- a/sys/dev/usb/wlan/if_urtwn.c +++ b/sys/dev/usb/wlan/if_urtwn.c @@ -549,8 +549,13 @@ urtwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, return (NULL); vap = &uvp->vap; /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(uvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ uvp->newstate = vap->iv_newstate; diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 6617c8d7d9bd..504c270b0d3d 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -489,9 +489,14 @@ zyd_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, if (zvp == NULL) return (NULL); vap = &zvp->vap; + /* enable s/w bmiss handling for sta mode */ - ieee80211_vap_setup(ic, vap, name, unit, opmode, - flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + if (ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac) != 0) { + /* out of memory */ + free(zvp, M_80211_VAP); + return (NULL); + } /* override state transition machine */ zvp->newstate = vap->iv_newstate;