Author: bz
Date: Tue Apr 27 15:16:54 2010
New Revision: 207278
URL: http://svn.freebsd.org/changeset/base/207278

Log:
  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
  MFC after:    4 days

Modified:
  head/sys/net/bpf.c

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c  Tue Apr 27 15:07:08 2010        (r207277)
+++ head/sys/net/bpf.c  Tue Apr 27 15:16:54 2010        (r207278)
@@ -1454,6 +1454,7 @@ bpfioctl(struct cdev *dev, u_long cmd, c
                        /* FALLSTHROUGH */
 
                default:
+                       CURVNET_RESTORE();
                        return (EINVAL);
                }
 
@@ -1461,6 +1462,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;
@@ -1468,13 +1470,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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to