Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci on error, free the mbuf in vmxnet3_txq_offl...



details:   https://anonhg.NetBSD.org/src/rev/43efd7697cfb
branches:  trunk
changeset: 820535:43efd7697cfb
user:      maya <maya%NetBSD.org@localhost>
date:      Wed Jan 11 00:51:22 2017 +0000

description:
on error, free the mbuf in vmxnet3_txq_offload_ctx, not in callers.

ok riastradh

diffstat:

 sys/arch/x86/pci/if_vmx.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r dd7a83e05d8e -r 43efd7697cfb sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Wed Jan 11 00:41:38 2017 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Wed Jan 11 00:51:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.16 2017/01/11 00:41:38 maya Exp $ */
+/*     $NetBSD: if_vmx.c,v 1.17 2017/01/11 00:51:22 maya Exp $ */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.16 2017/01/11 00:41:38 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.17 2017/01/11 00:51:22 maya Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -2531,6 +2531,7 @@
                offset = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
                break;
        default:
+               m_free(m);
                return (EINVAL);
        }
 
@@ -2660,9 +2661,9 @@
        } else if (m->m_pkthdr.csum_flags & VMXNET3_CSUM_ALL_OFFLOAD) {
                error = vmxnet3_txq_offload_ctx(txq, m, &start, &csum_start);
                if (error) {
+                       /* m is already freed */
                        txq->vxtxq_stats.vmtxs_offload_failed++;
                        vmxnet3_txq_unload_mbuf(txq, dmap);
-                       m_freem(m);
                        *m0 = NULL;
                        return (error);
                }



Home | Main Index | Thread Index | Old Index