linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: protect fools returning NULL in add_virtual_intf
@ 2014-11-14 17:43 Rafał Miłecki
  2014-11-19 17:50 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2014-11-14 17:43 UTC (permalink / raw)
  To: John W. Linville, linux-wireless; +Cc: Rafał Miłecki

Callback add_virtual_intf is supposed to return ERR_PTR and trying to
return NULL results in some "Unable to handle kernel paging request",
etc. As it may be complicated to debug & trace, let's catch it (WARN).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 net/wireless/nl80211.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1a31736..eeb96c1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2641,7 +2641,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
 	wdev = rdev_add_virtual_intf(rdev,
 				nla_data(info->attrs[NL80211_ATTR_IFNAME]),
 				type, err ? NULL : &flags, &params);
-	if (IS_ERR(wdev)) {
+	if (WARN_ON(!wdev)) {
+		nlmsg_free(msg);
+		return -EPROTO;
+	} else if (IS_ERR(wdev)) {
 		nlmsg_free(msg);
 		return PTR_ERR(wdev);
 	}
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cfg80211: protect fools returning NULL in add_virtual_intf
  2014-11-14 17:43 [PATCH] cfg80211: protect fools returning NULL in add_virtual_intf Rafał Miłecki
@ 2014-11-19 17:50 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2014-11-19 17:50 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: John W. Linville, linux-wireless

On Fri, 2014-11-14 at 18:43 +0100, Rafał Miłecki wrote:
> Callback add_virtual_intf is supposed to return ERR_PTR and trying to
> return NULL results in some "Unable to handle kernel paging request",
> etc. As it may be complicated to debug & trace, let's catch it (WARN).

I guess we can do that.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-19 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 17:43 [PATCH] cfg80211: protect fools returning NULL in add_virtual_intf Rafał Miłecki
2014-11-19 17:50 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).