Skip to content

Commit

Permalink
soc: qcom: smd: Reject send of too big packets
Browse files Browse the repository at this point in the history
Attempting to find room for a packet that's bigger than the fifo will
never succeed and the calling process will be sleeping forever in the
loop, waiting for enough room. So fail early instead.

Reported-by: Courtney Cavin <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
Reviewed-by: Andy Gross <[email protected]>
Signed-off-by: Andy Gross <[email protected]>
  • Loading branch information
andersson authored and Andy Gross committed Oct 14, 2015
1 parent 24f60e3 commit a208ca9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/soc/qcom/smd.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len)
if (channel->info_word && len % 4)
return -EINVAL;

/* Reject packets that are too big */
if (tlen >= channel->fifo_size)
return -EINVAL;

ret = mutex_lock_interruptible(&channel->tx_lock);
if (ret)
return ret;
Expand Down

0 comments on commit a208ca9

Please sign in to comment.