Module Name:    src
Committed By:   martin
Date:           Sat Feb 22 12:19:57 UTC 2025

Modified Files:
        src/sys/dev/pci [netbsd-10]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by joe in ticket #1055):

        sys/dev/pci/if_vioif.c: revision 1.114

PR kern/59086:
use right byte size of data resource to be freed instead of sizeof pointer
use of sizeof pointer frees only 8 bytes of the large vioif_tx_context struct
which leaks the rest of the memory


To generate a diff of this commit:
cvs rdiff -u -r1.82.4.5 -r1.82.4.6 src/sys/dev/pci/if_vioif.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.82.4.5 src/sys/dev/pci/if_vioif.c:1.82.4.6
--- src/sys/dev/pci/if_vioif.c:1.82.4.5	Wed Aug  7 09:58:20 2024
+++ src/sys/dev/pci/if_vioif.c	Sat Feb 22 12:19:57 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.82.4.6 2025/02/22 12:19:57 martin Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.5 2024/08/07 09:58:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.82.4.6 2025/02/22 12:19:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1291,7 +1291,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 
 		for (i = 0; i < vq_num; i++) {
 			maps[i].vnm_hdr = &hdrs[i];
-	
+
 			r = vioif_dmamap_create_load(sc, &maps[i].vnm_hdr_map,
 			    maps[i].vnm_hdr, sc->sc_hdr_size, 1,
 			    dmaparams[dir].dma_flag, dmaparams[dir].msg_hdr);
@@ -1531,7 +1531,7 @@ err:
 			softint_disestablish(txc->txc_deferred_transmit);
 		if (txc->txc_intrq != NULL)
 			pcq_destroy(txc->txc_intrq);
-		kmem_free(txc, sizeof(txc));
+		kmem_free(txc, sizeof(*txc));
 	}
 
 	vioif_work_set(&netq->netq_work, NULL, NULL);

Reply via email to