Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/gemini Fix potential null dereference by simply...
details: https://anonhg.NetBSD.org/src/rev/cffe84b6d625
branches: trunk
changeset: 376017:cffe84b6d625
user: andvar <andvar%NetBSD.org@localhost>
date: Fri May 26 21:40:46 2023 +0000
description:
Fix potential null dereference by simply adding last_gd != NULL check
around the code block with last_gd usage after the inner loop.
It may mainly happen on bus_dmamap_load error.
Reported by Mootja _14, 2017.
diffstat:
sys/arch/arm/gemini/if_gpn.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diffs (39 lines):
diff -r da31fab2f650 -r cffe84b6d625 sys/arch/arm/gemini/if_gpn.c
--- a/sys/arch/arm/gemini/if_gpn.c Fri May 26 20:50:21 2023 +0000
+++ b/sys/arch/arm/gemini/if_gpn.c Fri May 26 21:40:46 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gpn.c,v 1.16 2022/09/17 19:49:09 thorpej Exp $ */
+/* $NetBSD: if_gpn.c,v 1.17 2023/05/26 21:40:46 andvar Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,7 +32,7 @@
#include "opt_gemini.h"
-__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.16 2022/09/17 19:49:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.17 2023/05/26 21:40:46 andvar Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -472,14 +472,13 @@ gpn_ifstart(struct ifnet *ifp)
if_statinc_ref(nsr, if_opackets);
IF_STAT_PUTREF(ifp);
- /*
- * XXX XXX 'last_gd' could be NULL
- */
- last_gd->gd_subtype |= GPN_EOF;
+ if (last_gd != NULL) {
+ last_gd->gd_subtype |= GPN_EOF;
- sc->sc_txactive++;
- sc->sc_free--;
- gemini_ipm_produce(last_gd, 1);
+ sc->sc_txactive++;
+ sc->sc_free--;
+ gemini_ipm_produce(last_gd, 1);
+ }
}
}
Home |
Main Index |
Thread Index |
Old Index