Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add missing error checks on rtcache_setdst
details: https://anonhg.NetBSD.org/src/rev/6aac270afe9e
branches: trunk
changeset: 337783:6aac270afe9e
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Apr 27 10:14:44 2015 +0000
description:
Add missing error checks on rtcache_setdst
It can fail with ENOMEM.
diffstat:
sys/netinet/ip_output.c | 12 ++++++++----
sys/netinet6/in6_pcb.c | 10 ++++++----
sys/netinet6/ip6_output.c | 8 +++++---
sys/netinet6/nd6_nbr.c | 7 ++++---
4 files changed, 23 insertions(+), 14 deletions(-)
diffs (135 lines):
diff -r 7feca22ab18c -r 6aac270afe9e sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Mon Apr 27 09:56:36 2015 +0000
+++ b/sys/netinet/ip_output.c Mon Apr 27 10:14:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.237 2015/04/24 00:48:47 ozaki-r Exp $ */
+/* $NetBSD: ip_output.c,v 1.238 2015/04/27 10:14:44 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.237 2015/04/24 00:48:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.238 2015/04/27 10:14:44 ozaki-r Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -246,7 +246,9 @@
if ((rt = rtcache_validate(ro)) == NULL &&
(rt = rtcache_update(ro, 1)) == NULL) {
dst = &u.dst4;
- rtcache_setdst(ro, &u.dst);
+ error = rtcache_setdst(ro, &u.dst);
+ if (error != 0)
+ goto bad;
}
/*
@@ -1416,7 +1418,9 @@
memset(&ro, 0, sizeof(ro));
sockaddr_in_init(&u.dst4, ia, 0);
- rtcache_setdst(&ro, &u.dst);
+ error = rtcache_setdst(&ro, &u.dst);
+ if (error != 0)
+ return error;
*ifp = (rt = rtcache_init(&ro)) != NULL ? rt->rt_ifp : NULL;
rtcache_free(&ro);
} else {
diff -r 7feca22ab18c -r 6aac270afe9e sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c Mon Apr 27 09:56:36 2015 +0000
+++ b/sys/netinet6/in6_pcb.c Mon Apr 27 10:14:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.138 2015/04/27 02:59:44 ozaki-r Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.139 2015/04/27 10:14:44 ozaki-r Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.138 2015/04/27 02:59:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.139 2015/04/27 10:14:44 ozaki-r Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1100,7 +1100,8 @@
addr.s_addr = in6p->in6p_faddr.s6_addr32[3];
sockaddr_in_init(&u.dst4, &addr, 0);
- rtcache_setdst(ro, &u.dst);
+ if (rtcache_setdst(ro, &u.dst) != 0)
+ return NULL;
rt = rtcache_init(ro);
} else
@@ -1112,7 +1113,8 @@
} u;
sockaddr_in6_init(&u.dst6, &in6p->in6p_faddr, 0, 0, 0);
- rtcache_setdst(ro, &u.dst);
+ if (rtcache_setdst(ro, &u.dst) != 0)
+ return NULL;
rt = rtcache_init(ro);
}
diff -r 7feca22ab18c -r 6aac270afe9e sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Mon Apr 27 09:56:36 2015 +0000
+++ b/sys/netinet6/ip6_output.c Mon Apr 27 10:14:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $ */
+/* $NetBSD: ip6_output.c,v 1.165 2015/04/27 10:14:44 ozaki-r Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.165 2015/04/27 10:14:44 ozaki-r Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -2333,7 +2333,9 @@
sockaddr_in_init(&u.dst4, ia4, 0);
else
sockaddr_in6_init(&u.dst6, ia, 0, 0, 0);
- rtcache_setdst(&ro, &u.dst);
+ error = rtcache_setdst(&ro, &u.dst);
+ if (error != 0)
+ return error;
*ifp = (rt = rtcache_init(&ro)) != NULL ? rt->rt_ifp : NULL;
rtcache_free(&ro);
} else {
diff -r 7feca22ab18c -r 6aac270afe9e sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c Mon Apr 27 09:56:36 2015 +0000
+++ b/sys/netinet6/nd6_nbr.c Mon Apr 27 10:14:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_nbr.c,v 1.107 2015/03/30 04:25:26 ozaki-r Exp $ */
+/* $NetBSD: nd6_nbr.c,v 1.108 2015/04/27 10:14:44 ozaki-r Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.107 2015/03/30 04:25:26 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.108 2015/04/27 10:14:44 ozaki-r Exp $");
#include "opt_inet.h"
@@ -927,7 +927,8 @@
ip6->ip6_dst = daddr6;
sockaddr_in6_init(&u.dst6, &daddr6, 0, 0, 0);
dst = &u.dst;
- rtcache_setdst(&ro, dst);
+ if (rtcache_setdst(&ro, dst) != 0)
+ goto bad;
/*
* Select a source whose scope is the same as that of the dest.
Home |
Main Index |
Thread Index |
Old Index