msm: bam_dmux: revert the skb state when memory allocation fails

bam_dmux_write() function modifies the state of a skb via skb_push(), but
if a later allocation fails, the state of the skb is not reverted to the
pre skb_push() state.

The error returned to the caller as a result of the allocation failure gets
propagated to the TCP/IP framework, which re-schedules a retry of the skb
at a later time.  if enough retries occur due to allocation failures,
causes the assertion in skb_push() to fail.

If a later allocation fails, revert the skb buffer state to pre skb_push()
by calling skb_pull().

(cherry picked from commit 381cd549fd0176c649d1579f56b7504aa94df9be)

CRs-Fixed: 441277
Change-Id: If33e13f00ced164d174ce2c7d9d29762abafa720
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
diff --git a/arch/arm/mach-msm/bam_dmux.c b/arch/arm/mach-msm/bam_dmux.c
index a3a70eb..4934a71 100644
--- a/arch/arm/mach-msm/bam_dmux.c
+++ b/arch/arm/mach-msm/bam_dmux.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -889,6 +889,7 @@
 write_fail3:
 	kfree(pkt);
 write_fail2:
+	skb_pull(skb, sizeof(struct bam_mux_hdr));
 	if (new_skb)
 		dev_kfree_skb_any(new_skb);
 write_fail: