mac80211: remove BUG() when interface type is invalid [Linux 3.18.101]

This Linux kernel change "mac80211: remove BUG() when interface type is invalid" is included in the Linux 3.18.101 release. This change is authored by Luca Coelho <luciano.coelho [at] intel.com> on Sun Oct 29 11:51:10 2017 +0200. The commit for this change in Linux stable tree is b065d8c (patch) which is from upstream commit c7976f5. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream c7976f5.

mac80211: remove BUG() when interface type is invalid

[ Upstream commit c7976f5272486e4ff406014c4b43e2fa3b70b052 ]

In the ieee80211_setup_sdata() we check if the interface type is valid
and, if not, call BUG().  This should never happen, but if there is
something wrong with the code, it will not be caught until the bug
happens when an interface is being set up.  Calling BUG() is too
extreme for this and a WARN_ON() would be better used instead.  Change
that.

Signed-off-by: Luca Coelho <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/mac80211/iface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index eeae0ab..672e289 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1379,7 +1379,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
        break;
    case NL80211_IFTYPE_UNSPECIFIED:
    case NUM_NL80211_IFTYPES:
-       BUG();
+       WARN_ON(1);
        break;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *