Skip to content

Commit 36a554c

Browse files
aotchereKalle Valo
authored andcommitted
nl80211: Don't verify owner_nlportid on NAN commands
If NAN interface is created with NL80211_ATTR_SOCKET_OWNER, the socket that is used to create the interface is used for all NAN operations and reporting NAN events. However, it turns out that sending commands and receiving events on the same socket is not possible in a completely race-free way: If the socket buffer is overflowed by the events, the command response will not be sent. In that case the caller will block forever on recv. Using non-blocking socket for commands is more complicated and still the command response or ack may not be received. So, keep unicasting NAN events to the interface creator, but allow using a different socket for commands. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 123fef3 commit 36a554c

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

‎include/uapi/linux/nl80211.h‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,11 +1909,10 @@ enum nl80211_commands {
19091909
* that configured the indoor setting, and the indoor operation would be
19101910
* cleared when the socket is closed.
19111911
* If set during NAN interface creation, the interface will be destroyed
1912-
* if the socket is closed just like any other interface. Moreover, only
1913-
* the netlink socket that created the interface will be allowed to add
1914-
* and remove functions. NAN notifications will be sent in unicast to that
1915-
* socket. Without this attribute, any socket can add functions and the
1916-
* notifications will be sent to the %NL80211_MCGRP_NAN multicast group.
1912+
* if the socket is closed just like any other interface. Moreover, NAN
1913+
* notifications will be sent in unicast to that socket. Without this
1914+
* attribute, the notifications will be sent to the %NL80211_MCGRP_NAN
1915+
* multicast group.
19171916
* If set during %NL80211_CMD_ASSOCIATE or %NL80211_CMD_CONNECT the
19181917
* station will deauthenticate when the socket is closed.
19191918
*

‎net/wireless/nl80211.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11206,10 +11206,6 @@ static int nl80211_nan_add_func(struct sk_buff *skb,
1120611206
if (!info->attrs[NL80211_ATTR_NAN_FUNC])
1120711207
return -EINVAL;
1120811208

11209-
if (wdev->owner_nlportid &&
11210-
wdev->owner_nlportid != info->snd_portid)
11211-
return -ENOTCONN;
11212-
1121311209
err = nla_parse_nested(tb, NL80211_NAN_FUNC_ATTR_MAX,
1121411210
info->attrs[NL80211_ATTR_NAN_FUNC],
1121511211
nl80211_nan_func_policy, info->extack);
@@ -11441,10 +11437,6 @@ static int nl80211_nan_del_func(struct sk_buff *skb,
1144111437
if (!info->attrs[NL80211_ATTR_COOKIE])
1144211438
return -EINVAL;
1144311439

11444-
if (wdev->owner_nlportid &&
11445-
wdev->owner_nlportid != info->snd_portid)
11446-
return -ENOTCONN;
11447-
1144811440
cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
1144911441

1145011442
rdev_del_nan_func(rdev, wdev, cookie);

0 commit comments

Comments
 (0)