If the driver advertises WIPHY_NAN_FLAGS_USERSPACE_DE, the NAN Discovery Engine is not offloaded to the driver. Reject the request to add/delete a NAN function in cfg80211. Signed-off-by: Shivani Baranwal --- net/wireless/nl80211.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5189366809db..5df058b835db 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -17419,6 +17419,12 @@ static int nl80211_nan_add_func(struct sk_buff *skb, if (!wdev_running(wdev)) return -ENOTCONN; + if (wdev->wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_USERSPACE_DE) { + NL_SET_ERR_MSG(info->extack, + "NAN Discovery Engine is in userspace"); + return -EOPNOTSUPP; + } + if (!info->attrs[NL80211_ATTR_NAN_FUNC]) return -EINVAL; @@ -17652,6 +17658,12 @@ static int nl80211_nan_del_func(struct sk_buff *skb, if (!wdev_running(wdev)) return -ENOTCONN; + if (wdev->wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_USERSPACE_DE) { + NL_SET_ERR_MSG(info->extack, + "NAN Discovery Engine is in userspace"); + return -EOPNOTSUPP; + } + if (!info->attrs[NL80211_ATTR_COOKIE]) return -EINVAL; -- 2.34.1