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
This commit is contained in:
zding 2016-10-12 15:49:34 +08:00 • committed by qcabuildsw
commit 6af26a3a3f

View file

@ -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));
}