qcacmn: Check peer for null before dereference

Check for peer null check before dereference in
dp_peer_state_update to update its state.

Change-Id: Id3b743d6cbe3d156a48ad111e467579b7478e4bb
CRs-Fixed: 1107176
This commit is contained in:
Ankit Gupta 2017-01-03 12:23:45 -08:00 • committed by qcabuildsw
commit 6fb389b4e4

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2017 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
@ -1021,6 +1021,11 @@ QDF_STATUS dp_peer_state_update(void *pdev_handle, uint8_t *peer_mac,
struct dp_pdev *pdev = pdev_handle;
peer = dp_peer_find_hash_find(pdev->soc, peer_mac, 0);
if (NULL == peer) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"Failed to find peer for: [%pM]", peer_mac);
return QDF_STATUS_E_FAILURE;
}
peer->state = state;
DP_TRACE(INFO, "peer %p state %d",
peer, peer->state);