qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-stable] [PATCH for 2.6.0] net: vmxnet: check fragments count a


From: Dmitry Fleytman
Subject: Re: [Qemu-stable] [PATCH for 2.6.0] net: vmxnet: check fragments count at pkt initialisation
Date: Thu, 11 Aug 2016 11:16:13 +0300

> On 10 Aug 2016, at 23:05 PM, P J P <address@hidden> wrote:
> 
> From: Li Qiang <address@hidden>
> 
> When Vmxnet device initialises the pkt, the maximum fragmentation
> count is not checked. This could lead to an integer overflow
> causing a NULL pointer dereference. Add check to avoid it.
> 
> Reported-by: Li Qiang <address@hidden>
> Signed-off-by: Prasad J Pandit <address@hidden>
> ---
> hw/net/vmxnet_tx_pkt.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/hw/net/vmxnet_tx_pkt.c b/hw/net/vmxnet_tx_pkt.c
> index 32563d4..e58b0a3 100644
> --- a/hw/net/vmxnet_tx_pkt.c
> +++ b/hw/net/vmxnet_tx_pkt.c
> @@ -55,9 +55,13 @@ struct VmxnetTxPkt {
>     uint8_t l4proto;
> };
> 
> +#define VMXNET_PKT_MAX_FRAGS    16  /* ref: MAX_SKB_FRAGS in kernel driver */
> +
> void vmxnet_tx_pkt_init(struct VmxnetTxPkt **pkt, uint32_t max_frags,
>     bool has_virt_hdr)
> {
> +    assert(max_frags <= VMXNET_PKT_MAX_FRAGS);


As far as I see max_frags for VMXNET3 is a size of device’s TX ring so this 
will always assert.

I don’t think we need this limitation in the device code. Maximum number of 
fragments is an internal knowledge of network backend.

~Dmitry

> +
>     struct VmxnetTxPkt *p = g_malloc0(sizeof *p);
> 
>     p->vec = g_malloc((sizeof *p->vec) *
> -- 
> 2.5.5
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]