mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
qcacmn: Pass peer pointer instead of MAC address to set_peer_wep_keys
This change would prevent peer to take reference during creation Change-Id: I69225a7e403c3b9753be45ac9b4dd4d615eef7de CRs-Fixed: 2161085
This commit is contained in:
parent
0d702b7524
commit
ea71ebf12b
4 changed files with 20 additions and 36 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
|
|
@ -382,7 +382,7 @@ struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params(
|
|||
|
||||
/**
|
||||
* wlan_crypto_set_peer_wep_keys - set wep keys into peer entries
|
||||
*
|
||||
* @vdev:vdev
|
||||
* @peer:peer
|
||||
*
|
||||
* This function gets called by mlme, when auth frame is received.
|
||||
|
|
@ -391,7 +391,7 @@ struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params(
|
|||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
||||
uint8_t *mac_addr);
|
||||
struct wlan_objmgr_peer *peer);
|
||||
|
||||
/**
|
||||
* wlan_crypto_register_crypto_rx_ops - set crypto_rx_ops
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
|
|
@ -302,7 +302,7 @@ struct wlan_lmac_if_crypto_rx_ops {
|
|||
qdf_nbuf_t wbuf, uint8_t *macaddr,
|
||||
uint8_t tid);
|
||||
QDF_STATUS(*set_peer_wep_keys)(struct wlan_objmgr_vdev *vdev,
|
||||
uint8_t *mac_addr);
|
||||
struct wlan_objmgr_peer *peer);
|
||||
};
|
||||
|
||||
#define WLAN_CRYPTO_RX_OPS_ENCAP(crypto_rx_ops) \
|
||||
|
|
|
|||
|
|
@ -2519,8 +2519,8 @@ struct wlan_crypto_params *wlan_crypto_peer_get_crypto_params(
|
|||
|
||||
|
||||
QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
||||
uint8_t *mac_addr){
|
||||
uint8_t keymac[WLAN_ALEN];
|
||||
struct wlan_objmgr_peer *peer)
|
||||
{
|
||||
struct wlan_crypto_comp_priv *crypto_priv;
|
||||
struct wlan_crypto_comp_priv *sta_crypto_priv;
|
||||
struct wlan_crypto_params *crypto_params;
|
||||
|
|
@ -2528,12 +2528,18 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
|||
struct wlan_crypto_key *sta_key;
|
||||
struct wlan_crypto_cipher *cipher_table;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct wlan_objmgr_peer *peer;
|
||||
uint8_t *mac_addr;
|
||||
int i;
|
||||
enum QDF_OPMODE opmode;
|
||||
|
||||
if (!vdev)
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
|
||||
if (!peer) {
|
||||
qdf_print("%s[%d] peer NULL\n", __func__, __LINE__);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
opmode = wlan_vdev_mlme_get_opmode(vdev);
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
|
||||
|
|
@ -2542,6 +2548,10 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
|||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
wlan_peer_obj_lock(peer);
|
||||
mac_addr = wlan_peer_get_macaddr(peer);
|
||||
wlan_peer_obj_unlock(peer);
|
||||
|
||||
crypto_params = wlan_crypto_vdev_get_comp_params(vdev,
|
||||
&crypto_priv);
|
||||
if (crypto_priv == NULL) {
|
||||
|
|
@ -2553,28 +2563,8 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
|||
if (AUTH_IS_8021X(crypto_params))
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)mac_addr))
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
if (opmode == QDF_STA_MODE) {
|
||||
peer = wlan_vdev_get_bsspeer(vdev);
|
||||
if (!(peer && (QDF_STATUS_SUCCESS
|
||||
== wlan_objmgr_peer_try_get_ref(peer,
|
||||
WLAN_CRYPTO_ID)))) {
|
||||
qdf_print("%s[%d] peer %pK ref failed\n",
|
||||
__func__, __LINE__, peer);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
} else {
|
||||
uint8_t bssid_mac[WLAN_ALEN];
|
||||
|
||||
wlan_vdev_obj_lock(vdev);
|
||||
qdf_mem_copy(bssid_mac,
|
||||
wlan_vdev_mlme_get_macaddr(vdev), WLAN_ALEN);
|
||||
wlan_vdev_obj_unlock(vdev);
|
||||
|
||||
peer = wlan_objmgr_get_peer_by_mac_n_vdev(
|
||||
psoc, mac_addr, bssid_mac, WLAN_CRYPTO_ID);
|
||||
if (!peer) {
|
||||
qdf_print("%s[%d] peer NULL\n", __func__, __LINE__);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
|
@ -2582,7 +2572,6 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
|||
}
|
||||
|
||||
wlan_crypto_peer_get_comp_params(peer, &sta_crypto_priv);
|
||||
wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID);
|
||||
if (sta_crypto_priv == NULL) {
|
||||
qdf_print("%s[%d] sta priv is null\n", __func__, __LINE__);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
|
@ -2608,8 +2597,6 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev,
|
|||
sta_crypto_priv->key[i] = sta_key;
|
||||
qdf_mem_copy(sta_key, key,
|
||||
sizeof(struct wlan_crypto_key));
|
||||
qdf_copy_macaddr((struct qdf_mac_addr *)keymac,
|
||||
(struct qdf_mac_addr *)mac_addr);
|
||||
|
||||
sta_key->flags &= ~WLAN_CRYPTO_KEY_DEFAULT;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
|
|
@ -150,7 +150,6 @@ static QDF_STATUS wlan_crypto_peer_obj_create_handler(
|
|||
void *arg)
|
||||
{
|
||||
struct wlan_crypto_comp_priv *crypto_priv;
|
||||
uint8_t keymac[WLAN_ALEN];
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!peer)
|
||||
|
|
@ -166,10 +165,8 @@ static QDF_STATUS wlan_crypto_peer_obj_create_handler(
|
|||
|
||||
if (status == QDF_STATUS_SUCCESS) {
|
||||
if (wlan_vdev_get_selfpeer(peer->peer_objmgr.vdev) != peer) {
|
||||
qdf_copy_macaddr((struct qdf_mac_addr *)keymac,
|
||||
(struct qdf_mac_addr *)wlan_peer_get_macaddr(peer));
|
||||
wlan_crypto_set_peer_wep_keys(
|
||||
wlan_peer_get_vdev(peer), keymac);
|
||||
wlan_peer_get_vdev(peer), peer);
|
||||
}
|
||||
} else {
|
||||
qdf_print("%s[%d] peer obj failed status %d\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue