summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch
new file mode 100644
index 00000000..e7cb513b
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0024-mwifiex-fix-wrong-return-values-in-add_virtual_intf-.patch
@@ -0,0 +1,93 @@
1From 0b53b4fb097d5d599a3a3fcd0ac10ad140bdf9c4 Mon Sep 17 00:00:00 2001
2From: Bing Zhao <bzhao@marvell.com>
3Date: Tue, 3 Jul 2012 20:43:56 -0700
4Subject: [PATCH 24/49] mwifiex: fix wrong return values in add_virtual_intf()
5 error cases
6
7commit 858faa57dd9e2b91f3f870fbb1185982e42f5a2b upstream
8
9backported for linux-3.2.y, linux-3.3.y, linux-3.4.y
10
11add_virtual_intf() needs to return an ERR_PTR(), instead of NULL,
12on errors, otherwise cfg80211 will crash.
13
14Reported-by: Johannes Berg <johannes@sipsolutions.net>
15Signed-off-by: Bing Zhao <bzhao@marvell.com>
16Signed-off-by: John W. Linville <linville@tuxdriver.com>
17Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18---
19 drivers/net/wireless/mwifiex/cfg80211.c | 21 +++++++++------------
20 1 file changed, 9 insertions(+), 12 deletions(-)
21
22diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
23index 462c710..01dcb1a 100644
24--- a/drivers/net/wireless/mwifiex/cfg80211.c
25+++ b/drivers/net/wireless/mwifiex/cfg80211.c
26@@ -1177,11 +1177,11 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
27 void *mdev_priv;
28
29 if (!priv)
30- return NULL;
31+ return ERR_PTR(-EFAULT);
32
33 adapter = priv->adapter;
34 if (!adapter)
35- return NULL;
36+ return ERR_PTR(-EFAULT);
37
38 switch (type) {
39 case NL80211_IFTYPE_UNSPECIFIED:
40@@ -1190,7 +1190,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
41 if (priv->bss_mode) {
42 wiphy_err(wiphy, "cannot create multiple"
43 " station/adhoc interfaces\n");
44- return NULL;
45+ return ERR_PTR(-EINVAL);
46 }
47
48 if (type == NL80211_IFTYPE_UNSPECIFIED)
49@@ -1208,14 +1208,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
50 break;
51 default:
52 wiphy_err(wiphy, "type not supported\n");
53- return NULL;
54+ return ERR_PTR(-EINVAL);
55 }
56
57 dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name,
58 ether_setup, 1);
59 if (!dev) {
60 wiphy_err(wiphy, "no memory available for netdevice\n");
61- goto error;
62+ priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
63+ return ERR_PTR(-ENOMEM);
64 }
65
66 dev_net_set(dev, wiphy_net(wiphy));
67@@ -1240,7 +1241,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
68 /* Register network device */
69 if (register_netdevice(dev)) {
70 wiphy_err(wiphy, "cannot register virtual network device\n");
71- goto error;
72+ free_netdev(dev);
73+ priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
74+ return ERR_PTR(-EFAULT);
75 }
76
77 sema_init(&priv->async_sem, 1);
78@@ -1252,12 +1255,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
79 mwifiex_dev_debugfs_init(priv);
80 #endif
81 return dev;
82-error:
83- if (dev && (dev->reg_state == NETREG_UNREGISTERED))
84- free_netdev(dev);
85- priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
86-
87- return NULL;
88 }
89 EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf);
90
91--
921.7.10
93