Skip to contentSkip to conversation

net: check fragment length during fragmentation

PATCH Applied P J P 3 participants 3 messages Aug 4, 2016 – Aug 5, 2016

lore
Share & tools
lore

P J P

author
#0 lore raw

PATCH v2 1/1 net: check fragment length during fragmentation

From: Prasad J Pandit <[email protected]>

Network transport abstraction layer supports packet fragmentation. While fragmenting a packet, it checks for more fragments from packet length and current fragment length. It is susceptible to an infinite loop, if the current fragment length is zero. Add check to avoid it.

---
 hw/net/net_tx_pkt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Updated as per
-> https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg00751.html

hw/net/net_tx_pkt.c +1 -1
index efd43b4..53dfaa2 100644
@@ -590,7 +590,7 @@ static bool net_tx_pkt_do_sw_fragmentation(struct NetTxPkt *pkt,
 
         fragment_offset += fragment_len;
 
-    } while (more_frags);
+    } while (fragment_len && more_frags);
 
     return true;
 }
Signature · 1 line
2.5.5
Reviewed-by on v2 1/1
#1 lore raw
Quoted 35 lines · P J P

From: Prasad J Pandit <[email protected]>

Network transport abstraction layer supports packet fragmentation. While fragmenting a packet, it checks for more fragments from packet length and current fragment length. It is susceptible to an infinite loop, if the current fragment length is zero. Add check to avoid it.

---
 hw/net/net_tx_pkt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Updated as per
-> https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg00751.html

hw/net/net_tx_pkt.c +1 -1
index efd43b4..53dfaa2 100644
@@ -590,7 +590,7 @@ static bool net_tx_pkt_do_sw_fragmentation(struct
 NetTxPkt *pkt,
 
         fragment_offset += fragment_len;
 
-    } while (more_frags);
+    } while (fragment_len && more_frags);
 
     return true;

}
--
2.5.5

Applied
#2 lore raw
Quoted 33 lines · Dmitry Fleytman
Reviewed-by Dmitry Fleytman <[email protected] <mailto:[email protected]>>

On Thu, Aug 4, 2016 at 12:30 AM, P J P <[email protected] <mailto:[email protected]>> wrote:

    From: Prasad J Pandit <[email protected]
    <mailto:[email protected]>>

    Network transport abstraction layer supports packet fragmentation.
    While fragmenting a packet, it checks for more fragments from
    packet length and current fragment length. It is susceptible
    to an infinite loop, if the current fragment length is zero.
    Add check to avoid it.

    Reported-by: Li Qiang <[email protected] <mailto:[email protected]>>
    Signed-off-by: Prasad J Pandit <[email protected]
    <mailto:[email protected]>>
    ---
     hw/net/net_tx_pkt.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)

    Updated as per
      ->
    https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg00751.html

    diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
    index efd43b4..53dfaa2 100644
    --- a/hw/net/net_tx_pkt.c
    +++ b/hw/net/net_tx_pkt.c
    @@ -590,7 +590,7 @@ static bool
    net_tx_pkt_do_sw_fragmentation(struct NetTxPkt *pkt,

             fragment_offset += fragment_len;
Quoted 9 lines
    -    } while (more_frags);
    +    } while (fragment_len && more_frags);

         return true;
     }
    --
    2.5.5

Applied. Thanks