Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05af034c authored by Dhoat Harpal's avatar Dhoat Harpal Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: glink_pkt: Remove BUG_ON in glink_pkt_write



BUG_ON is called when error is returned from copy_from_user and
copy_to_user apis.

BUG_ON is removed and appropriate error value is returned after cleanup.

CRs-Fixed: 1102504
Change-Id: Ia995e60b8d8d335239be0a35876d1becfd9a0f3c
Signed-off-by: default avatarDhoat Harpal <hdhoat@codeaurora.org>
parent c1b67407
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -664,7 +664,16 @@ ssize_t glink_pkt_read(struct file *file,
	spin_unlock_irqrestore(&devp->pkt_list_lock, flags);

	ret = copy_to_user(buf, pkt->data, pkt->size);
	BUG_ON(ret != 0);
	 if (ret) {
		GLINK_PKT_ERR(
		"%s copy_to_user failed ret[%d] on dev id:%d size %zu\n",
		 __func__, ret, devp->i, pkt->size);
		spin_lock_irqsave(&devp->pkt_list_lock, flags);
		list_add_tail(&pkt->list, &devp->pkt_list);
		spin_unlock_irqrestore(&devp->pkt_list_lock, flags);
		return -EFAULT;
	}


	ret = pkt->size;
	glink_rx_done(devp->handle, pkt->data, false);
@@ -738,7 +747,13 @@ ssize_t glink_pkt_write(struct file *file,
	}

	ret = copy_from_user(data, buf, count);
	BUG_ON(ret != 0);
	if (ret) {
		GLINK_PKT_ERR(
		"%s copy_from_user failed ret[%d] on dev id:%d size %zu\n",
		 __func__, ret, devp->i, count);
		kfree(data);
		return -EFAULT;
	}

	ret = glink_tx(devp->handle, data, data, count, GLINK_TX_REQ_INTENT);
	if (ret) {