diff options
| author | zding <zding@codeaurora.org> | 2016-10-12 15:49:34 +0800 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-11-09 18:52:19 -0800 |
| commit | 45bef5939e276cb032e8562fd7fddb0b6eb5c00f (patch) | |
| tree | 3c1a97bf794c8e610832727471bc45f0fca50f9d | |
| parent | 1dea3612baac687510882276dcac2c91962c169b (diff) | |
qcacld-3.0: Fix wrong return value of QCMBR command
qcacld-2.0 to qcacld-3.0 propagation
If wlan_hdd_qcmbr_command returns -EAGAIN and
pqcmbr_data->copy_to_user is set to 1, -EAGAIN will be
overwritten by the return value of copy_to_user.
Only call copy_to_user when wlan_hdd_qcmbr_command returns 0.
Change-Id: Ie75b3f7329d89766641caec1f377f38127937976
CRs-Fixed: 965103
| -rw-r--r-- | core/hdd/src/wlan_hdd_ftm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index da03cf0548ca..36a4d55390b2 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -210,17 +210,18 @@ static int wlan_hdd_qcmbr_command(hdd_adapter_t *adapter, case ATH_XIOCTL_UNIFIED_UTF_RSP: { pqcmbr_data->copy_to_user = 1; + + spin_lock_bh(&qcmbr_queue_lock); if (!list_empty(&qcmbr_queue_head)) { - spin_lock_bh(&qcmbr_queue_lock); qcmbr_buf = list_first_entry(&qcmbr_queue_head, qcmbr_queue_t, list); list_del(&qcmbr_buf->list); - spin_unlock_bh(&qcmbr_queue_lock); ret = 0; } else { ret = -1; } + spin_unlock_bh(&qcmbr_queue_lock); if (!ret) { memcpy(pqcmbr_data->buf, qcmbr_buf->utf_buf, @@ -260,7 +261,7 @@ static int wlan_hdd_qcmbr_compat_ioctl(hdd_adapter_t *adapter, } ret = wlan_hdd_qcmbr_command(adapter, qcmbr_data); - if (qcmbr_data->copy_to_user) { + if ((ret == 0) && qcmbr_data->copy_to_user) { ret = copy_to_user(ifr->ifr_data, qcmbr_data->buf, (MAX_UTF_LENGTH + 4)); } @@ -299,7 +300,7 @@ static int wlan_hdd_qcmbr_ioctl(hdd_adapter_t *adapter, struct ifreq *ifr) } ret = wlan_hdd_qcmbr_command(adapter, qcmbr_data); - if (qcmbr_data->copy_to_user) { + if ((ret == 0) && qcmbr_data->copy_to_user) { ret = copy_to_user(ifr->ifr_data, qcmbr_data->buf, (MAX_UTF_LENGTH + 4)); } |
