nl80211: Check for the required netlink attribute presence

[ Upstream commit 3ea15452ee ]

nl80211_nan_add_func() does not check if the required attribute
NL80211_NAN_FUNC_FOLLOW_UP_DEST is present when processing
NL80211_CMD_ADD_NAN_FUNCTION request. This request can be issued
by users with CAP_NET_ADMIN privilege and may result in NULL dereference
and a system crash. Add a check for the required attribute presence.

Signed-off-by: Hao Chen <flank3rsky@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hao Chen 2018-01-03 11:00:31 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель d66a35c2a1
Коммит c38bd3a9fe
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -11301,7 +11301,8 @@ static int nl80211_nan_add_func(struct sk_buff *skb,
break;
case NL80211_NAN_FUNC_FOLLOW_UP:
if (!tb[NL80211_NAN_FUNC_FOLLOW_UP_ID] ||
!tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID]) {
!tb[NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID] ||
!tb[NL80211_NAN_FUNC_FOLLOW_UP_DEST]) {
err = -EINVAL;
goto out;
}