svn commit: r207517 - stable/8/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Sun May 2 16:39:15 UTC 2010


Author: bz
Date: Sun May  2 16:39:15 2010
New Revision: 207517
URL: http://svn.freebsd.org/changeset/base/207517

Log:
  MFC r207278:
    MFP4: @177254
  
    Add missing CURVNET_RESTORE() calls for multiple code paths, to stop
    leaking the currently cached vnet into callers and to the process.
  
  Sponsored by: The FreeBSD Foundation
  Sponsored by: CK Software GmbH

Modified:
  stable/8/sys/net/bpf.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/net/bpf.c
==============================================================================
--- stable/8/sys/net/bpf.c	Sun May  2 16:38:57 2010	(r207516)
+++ stable/8/sys/net/bpf.c	Sun May  2 16:39:15 2010	(r207517)
@@ -1328,6 +1328,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 			/* FALLSTHROUGH */
 
 		default:
+			CURVNET_RESTORE();
 			return (EINVAL);
 		}
 
@@ -1335,6 +1336,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 		if (d->bd_sbuf != NULL || d->bd_hbuf != NULL ||
 		    d->bd_fbuf != NULL || d->bd_bif != NULL) {
 			BPFD_UNLOCK(d);
+			CURVNET_RESTORE();
 			return (EBUSY);
 		}
 		d->bd_bufmode = *(u_int *)addr;
@@ -1342,13 +1344,16 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 		break;
 
 	case BIOCGETZMAX:
-		return (bpf_ioctl_getzmax(td, d, (size_t *)addr));
+		error = bpf_ioctl_getzmax(td, d, (size_t *)addr);
+		break;
 
 	case BIOCSETZBUF:
-		return (bpf_ioctl_setzbuf(td, d, (struct bpf_zbuf *)addr));
+		error = bpf_ioctl_setzbuf(td, d, (struct bpf_zbuf *)addr);
+		break;
 
 	case BIOCROTZBUF:
-		return (bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr));
+		error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr);
+		break;
 	}
 	CURVNET_RESTORE();
 	return (error);


More information about the svn-src-stable-8 mailing list