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

Commit 4aa301f0 authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

msm: mhi: fix error handling



Validate the channel prior to proceeding further.
Unlock spin lock before jumping to error handler.

CRs-Fixed: 1016969
Change-Id: Ie3328f878b582a333ae15f3b950c258ec42fd768
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 96ed9095
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -623,6 +623,9 @@ static int rmnet_mhi_xmit(struct sk_buff *skb, struct net_device *dev)
				tx_ring_full_count[rmnet_mhi_ptr->dev_index]++;
				netif_stop_queue(dev);
				rmnet_log(MSG_VERBOSE, "Stopping Queue\n");
				write_unlock_irqrestore(
					    &rmnet_mhi_ptr->out_chan_full_lock,
					    flags);
				goto rmnet_mhi_xmit_error_cleanup;
			} else {
				retry = 1;
@@ -650,7 +653,6 @@ static int rmnet_mhi_xmit(struct sk_buff *skb, struct net_device *dev)

rmnet_mhi_xmit_error_cleanup:
	rmnet_log(MSG_VERBOSE, "Ring full\n");
	write_unlock_irqrestore(&rmnet_mhi_ptr->out_chan_full_lock, flags);
	return NETDEV_TX_BUSY;
}

+3 −1
Original line number Diff line number Diff line
@@ -1397,8 +1397,10 @@ static int start_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
	u32 chan;

	MHI_TRB_GET_INFO(CMD_TRB_CHID, cmd_pkt, chan);
	if (!VALID_CHAN_NR(chan))
	if (!VALID_CHAN_NR(chan)) {
		mhi_log(MHI_MSG_ERROR, "Bad chan: 0x%x\n", chan);
		return -EINVAL;
	}
	mhi_dev_ctxt->mhi_chan_pend_cmd_ack[chan] =
					MHI_CMD_NOT_PENDING;
	mhi_log(MHI_MSG_INFO, "Processed START CMD chan %d\n", chan);