From 735c4ff65fab3f8fbd7b8bf1cd0d339857078d01 Mon Sep 17 00:00:00 2001 From: Ryan Thomas McBride Date: Fri, 29 Nov 2002 13:03:25 +0000 Subject: Get the address pool in DIOCCHANGEADDR for all operations, prevents PF_CHANGE_REMOVE from dereferencing a NULL pointer. Noticed by dhartmei@ ok dhartmei@ --- sys/net/pf_ioctl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/net/pf_ioctl.c') diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 94b467816b3..104ededd233 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.19 2002/11/26 03:44:53 kjc Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.20 2002/11/29 13:03:24 mcbride Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2251,12 +2251,12 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) break; } + pool = pf_get_pool(0, pca->r_id, pca->r_num, 1, 0); + if (pool == NULL) { + error = EBUSY; + break; + } if (pca->action != PF_CHANGE_REMOVE) { - pool = pf_get_pool(0, pca->r_id, pca->r_num, 1, 0); - if (pool == NULL) { - error = EBUSY; - break; - } newpa = pool_get(&pf_pooladdr_pl, PR_NOWAIT); if (newpa == NULL) { error = ENOMEM; -- cgit v1.2.3