msm: ipa: fix split packet handling
Fix packet handling in case packet received from IPA hardware
is scattered across multiple buffers.
Change-Id: I4935ecb8eaa438d259c1c27a66f62c78f874c9ee
CRs-Fixed: 1097420
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c
index 179a31b..5b2ae14 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c
@@ -2325,6 +2325,7 @@
unsigned int used = *(unsigned int *)skb->cb;
unsigned int used_align = ALIGN(used, 32);
unsigned long unused = IPA_GENERIC_RX_BUFF_BASE_SZ - used;
+ u32 skb2_len;
IPA_DUMP_BUFF(skb->data, 0, skb->len);
@@ -2508,8 +2509,9 @@
sys->drop_packet = true;
}
- skb2 = ipa_skb_copy_for_client(skb,
- status->pkt_len + IPA_PKT_STATUS_SIZE);
+ skb2_len = status->pkt_len + IPA_PKT_STATUS_SIZE;
+ skb2_len = min(skb2_len, skb->len);
+ skb2 = ipa_skb_copy_for_client(skb, skb2_len);
if (likely(skb2)) {
if (skb->len < len + IPA_PKT_STATUS_SIZE) {
IPADBG("SPL skb len %d len %d\n",