svn commit: r349952 - head/usr.sbin/bhyve

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:50:46 2019
New Revision: 349952
URL: https://svnweb.freebsd.org/changeset/base/349952

Log:
  usr.sbin/bhyve: close backend file descriptor during tap init error
  
  Coverity CID: 1402953
  Reviewed by:  scottl, markj, aleksandr.fedorov -at- itglobal.com
  Approved by:  vmaffione, jhb
  Differential Revision:https://reviews.freebsd.org/D20913

Modified:
  head/usr.sbin/bhyve/net_backends.c

Modified: head/usr.sbin/bhyve/net_backends.c
==
--- head/usr.sbin/bhyve/net_backends.c  Fri Jul 12 18:43:24 2019
(r349951)
+++ head/usr.sbin/bhyve/net_backends.c  Fri Jul 12 18:50:46 2019
(r349952)
@@ -175,7 +175,6 @@ tap_init(struct net_backend *be, const char *devname,
 {
struct tap_priv *priv = (struct tap_priv *)be->opaque;
char tbuf[80];
-   int fd;
int opt = 1;
 #ifndef WITHOUT_CAPSICUM
cap_rights_t rights;
@@ -189,8 +188,8 @@ tap_init(struct net_backend *be, const char *devname,
strcpy(tbuf, "/dev/");
strlcat(tbuf, devname, sizeof(tbuf));
 
-   fd = open(tbuf, O_RDWR);
-   if (fd == -1) {
+   be->fd = open(tbuf, O_RDWR);
+   if (be->fd == -1) {
WPRINTF(("open of tap device %s failed\n", tbuf));
goto error;
}
@@ -199,24 +198,22 @@ tap_init(struct net_backend *be, const char *devname,
 * Set non-blocking and register for read
 * notifications with the event loop
 */
-   if (ioctl(fd, FIONBIO, &opt) < 0) {
+   if (ioctl(be->fd, FIONBIO, &opt) < 0) {
WPRINTF(("tap device O_NONBLOCK failed\n"));
goto error;
}
 
 #ifndef WITHOUT_CAPSICUM
cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE);
-   if (caph_rights_limit(fd, &rights) == -1)
+   if (caph_rights_limit(be->fd, &rights) == -1)
errx(EX_OSERR, "Unable to apply rights for sandbox");
 #endif
 
-   priv->mevp = mevent_add(fd, EVF_READ, cb, param);
+   priv->mevp = mevent_add(be->fd, EVF_READ, cb, param);
if (priv->mevp == NULL) {
WPRINTF(("Could not register event\n"));
goto error;
}
-
-   be->fd = fd;
 
return (0);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349949 - head/usr.sbin/bhyveload

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:38:18 2019
New Revision: 349949
URL: https://svnweb.freebsd.org/changeset/base/349949

Log:
  usr.sbin/bhyveload: don't leak an fd if a device can't be opened
  
  Coverity CID: 1194167
  Approved by:  markj, jhb
  Differential Revision:https://reviews.freebsd.org/D20935

Modified:
  head/usr.sbin/bhyveload/bhyveload.c

Modified: head/usr.sbin/bhyveload/bhyveload.c
==
--- head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:37:56 2019
(r349948)
+++ head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:38:18 2019
(r349949)
@@ -664,21 +664,19 @@ altcons_open(char *path)
 static int
 disk_open(char *path)
 {
-   int err, fd;
+   int fd;
 
if (ndisks >= NDISKS)
return (ERANGE);
 
-   err = 0;
fd = open(path, O_RDONLY);
+   if (fd < 0)
+   return (errno);
 
-   if (fd > 0) {
-   disk_fd[ndisks] = fd;
-   ndisks++;
-   } else 
-   err = errno;
+   disk_fd[ndisks] = fd;
+   ndisks++;
 
-   return (err);
+   return (0);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349947 - head/usr.sbin/bhyve

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:33:58 2019
New Revision: 349947
URL: https://svnweb.freebsd.org/changeset/base/349947

Log:
  usr.sbin/bhyve: only unassign a pt device after obtaining bus/slot/func
  
  Coverity CID: 1194302, 1194303, 1194304
  Approved by:  jhb, markj
  Differential Revision:https://reviews.freebsd.org/D20933

Modified:
  head/usr.sbin/bhyve/pci_passthru.c

Modified: head/usr.sbin/bhyve/pci_passthru.c
==
--- head/usr.sbin/bhyve/pci_passthru.c  Fri Jul 12 18:20:56 2019
(r349946)
+++ head/usr.sbin/bhyve/pci_passthru.c  Fri Jul 12 18:33:58 2019
(r349947)
@@ -668,14 +668,14 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p
memflags = vm_get_memflags(ctx);
if (!(memflags & VM_MEM_F_WIRED)) {
warnx("passthru requires guest memory to be wired");
-   goto done;
+   return (error);
}
 
if (pcifd < 0) {
pcifd = open(_PATH_DEVPCI, O_RDWR, 0);
if (pcifd < 0) {
warn("failed to open %s", _PATH_DEVPCI);
-   goto done;
+   return (error);
}
}
 
@@ -690,7 +690,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p
iofd = open(_PATH_DEVIO, O_RDWR, 0);
if (iofd < 0) {
warn("failed to open %s", _PATH_DEVIO);
-   goto done;
+   return (error);
}
}
 
@@ -705,7 +705,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p
memfd = open(_PATH_MEM, O_RDWR, 0);
if (memfd < 0) {
warn("failed to open %s", _PATH_MEM);
-   goto done;
+   return (error);
}
}
 
@@ -719,7 +719,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p
if (opts == NULL ||
sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) {
warnx("invalid passthru options");
-   goto done;
+   return (error);
}
 
if (vm_assign_pptdev(ctx, bus, slot, func) != 0) {
@@ -734,10 +734,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p
sc->psc_pi = pi;
 
/* initialize config space */
-   if ((error = cfginit(ctx, pi, bus, slot, func)) != 0)
-   goto done;
-   
-   error = 0;  /* success */
+   error = cfginit(ctx, pi, bus, slot, func);
 done:
if (error) {
free(sc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349946 - head/usr.sbin/bhyve

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:20:56 2019
New Revision: 349946
URL: https://svnweb.freebsd.org/changeset/base/349946

Log:
  usr.sbin/bhyve: free resources when erroring out of pci_vtcon_sock_add()
  
  Coverity CID: 1362880
  Approved by:  markj, jhb
  Differential Revision:https://reviews.freebsd.org/D20916

Modified:
  head/usr.sbin/bhyve/pci_virtio_console.c

Modified: head/usr.sbin/bhyve/pci_virtio_console.c
==
--- head/usr.sbin/bhyve/pci_virtio_console.cFri Jul 12 18:17:35 2019
(r349945)
+++ head/usr.sbin/bhyve/pci_virtio_console.cFri Jul 12 18:20:56 2019
(r349946)
@@ -356,8 +356,11 @@ out:
if (fd != -1)
close(fd);
 
-   if (error != 0 && s != -1)
-   close(s);
+   if (error != 0) {
+   if (s != -1)
+   close(s);
+   free(sock);
+   }
 
return (error);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349945 - head/usr.sbin/bhyve

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:17:35 2019
New Revision: 349945
URL: https://svnweb.freebsd.org/changeset/base/349945

Log:
  usr.sbin/bhyve: prevent use-after-free in virtio scsi request handling
  
  Coverity CID: 1393377
  Approved by:  araujo, jhb
  Differential Revision:https://reviews.freebsd.org/D20915

Modified:
  head/usr.sbin/bhyve/pci_virtio_scsi.c

Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jul 12 18:13:58 2019
(r349944)
+++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jul 12 18:17:35 2019
(r349945)
@@ -465,7 +465,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, 
int data_niov_in, data_niov_out;
void *ext_data_ptr = NULL;
uint32_t ext_data_len = 0, ext_sg_entries = 0;
-   int err;
+   int err, nxferred;
 
seek_iov(iov_in, niov_in, data_iov_in, &data_niov_in,
VTSCSI_IN_HEADER_LEN(sc));
@@ -544,10 +544,11 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, 
}
 
buf_to_iov(cmd_wr, VTSCSI_OUT_HEADER_LEN(sc), iov_out, niov_out, 0);
+   nxferred = VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled;
free(cmd_rd);
free(cmd_wr);
ctl_scsi_free_io(io);
-   return (VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled);
+   return (nxferred);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349944 - head/usr.sbin/bhyve

2019-07-12 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 18:13:58 2019
New Revision: 349944
URL: https://svnweb.freebsd.org/changeset/base/349944

Log:
  usr.sbin/bhyve: don't leak a FD if the device is not a tty
  
  Coverity CID: 1194193
  Approved by:  markj, jhb
  Differential Revision:https://reviews.freebsd.org/D20934

Modified:
  head/usr.sbin/bhyve/uart_emul.c

Modified: head/usr.sbin/bhyve/uart_emul.c
==
--- head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 15:24:25 2019
(r349943)
+++ head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 18:13:58 2019
(r349944)
@@ -678,8 +678,13 @@ uart_tty_backend(struct uart_softc *sc, const char *op
int fd;
 
fd = open(opts, O_RDWR | O_NONBLOCK);
-   if (fd < 0 || !isatty(fd))
+   if (fd < 0)
return (-1);
+
+   if (!isatty(fd)) {
+   close(fd);
+   return (-1);
+   }
 
sc->tty.rfd = sc->tty.wfd = fd;
sc->tty.opened = true;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349937 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 05:53:13 2019
New Revision: 349937
URL: https://svnweb.freebsd.org/changeset/base/349937

Log:
  usr.sbin/bhyve: unconditionally initialize the NVMe completion status
  
  Follow-up work to improve the handling of unsupported/invalid opcodes
  is being developed by chuck@.
  
  Coverity CID: 1398928
  Reviewed by:  chuck
  Approved by:  araujo, imp
  Differential Revision:https://reviews.freebsd.org/D20914

Modified:
  head/usr.sbin/bhyve/pci_nvme.c

Modified: head/usr.sbin/bhyve/pci_nvme.c
==
--- head/usr.sbin/bhyve/pci_nvme.c  Fri Jul 12 05:35:45 2019
(r349936)
+++ head/usr.sbin/bhyve/pci_nvme.c  Fri Jul 12 05:53:13 2019
(r349937)
@@ -978,6 +978,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u

while (sqhead != atomic_load_acq_short(&sq->tail)) {
cmd = &(sq->qbase)[sqhead];
+   compl.cdw0 = 0;
compl.status = 0;
 
switch (cmd->opc) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349935 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Fri Jul 12 05:19:37 2019
New Revision: 349935
URL: https://svnweb.freebsd.org/changeset/base/349935

Log:
  usr.sbin/bhyve: free resources when erroring out of pci_vtnet_init()
  
  Coverity CID: 1402978
  Approved by:  vmaffione
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D20912

Modified:
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cFri Jul 12 05:19:06 2019
(r349934)
+++ head/usr.sbin/bhyve/pci_virtio_net.cFri Jul 12 05:19:37 2019
(r349935)
@@ -411,6 +411,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
err = net_parsemac(vtopts, sc->vsc_config.mac);
if (err != 0) {
free(devname);
+   free(sc);
return (err);
}
mac_provided = 1;
@@ -419,8 +420,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
err = netbe_init(&sc->vsc_be, devname, pci_vtnet_rx_callback,
  sc);
free(devname);
-   if (err)
+   if (err) {
+   free(sc);
return (err);
+   }
sc->vsc_consts.vc_hv_caps |= netbe_get_cap(sc->vsc_be);
}
 
@@ -442,8 +445,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *
sc->vsc_vs.vs_mtx = &sc->vsc_mtx;
 
/* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
-   if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
+   if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) {
+   free(sc);
return (1);
+   }
 
/* use BAR 0 to map config regs in IO space */
vi_set_io_bar(&sc->vsc_vs, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349925 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul 11 23:54:50 2019
New Revision: 349925
URL: https://svnweb.freebsd.org/changeset/base/349925

Log:
  usr.sbin/bhyve: send an initialized value to wake up blocking kqueue
  
  This is a no-op initialization because nothing reads this value.  "This
  wasn't wrong previously, but this is more correct now." -imp
  
  Coverity CID: 1194307
  Approved by:  markj, imp, scottl
  Differential Revision:https://reviews.freebsd.org/D20921

Modified:
  head/usr.sbin/bhyve/mevent.c

Modified: head/usr.sbin/bhyve/mevent.c
==
--- head/usr.sbin/bhyve/mevent.cThu Jul 11 22:06:59 2019
(r349924)
+++ head/usr.sbin/bhyve/mevent.cThu Jul 11 23:54:50 2019
(r349925)
@@ -119,7 +119,7 @@ mevent_pipe_read(int fd, enum ev_type type, void *para
 static void
 mevent_notify(void)
 {
-   char c;
+   char c = '\0';

/*
 * If calling from outside the i/o thread, write a byte on the
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349919 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul 11 19:51:33 2019
New Revision: 349919
URL: https://svnweb.freebsd.org/changeset/base/349919

Log:
  usr.sbin/bhyve: commit miss from r349918
  
  Submitted by: markj
  Approved by:  markj
  Differential Revision:https://reviews.freebsd.org/D20918

Modified:
  head/usr.sbin/bhyve/pci_fbuf.c

Modified: head/usr.sbin/bhyve/pci_fbuf.c
==
--- head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 19:41:14 2019
(r349918)
+++ head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 19:51:33 2019
(r349919)
@@ -225,12 +225,12 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_
 static int
 pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *opts)
 {
-   char*uopts, *xopts, *config;
+   char*uopts, *uoptsbak, *xopts, *config;
char*tmpstr;
int ret;
 
ret = 0;
-   uopts = strdup(opts);
+   uoptsbak = uopts = strdup(opts);
while ((xopts = strsep(&uopts, ",")) != NULL) {
if (strcmp(xopts, "wait") == 0) {
sc->rfb_wait = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349918 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul 11 19:41:14 2019
New Revision: 349918
URL: https://svnweb.freebsd.org/changeset/base/349918

Log:
  usr.sbin/bhyve: free leaked memory during option parsing
  
  Also update to use strsep(3) instead of strtok(3).
  
  Most of this commit inadvertently ended up in r349914.
  
  Coverity CID: 1357337
  Approved by:  markj
  PR:   233038
  Differential Revision:https://reviews.freebsd.org/D20918

Modified:
  head/usr.sbin/bhyve/pci_fbuf.c

Modified: head/usr.sbin/bhyve/pci_fbuf.c
==
--- head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 19:36:18 2019
(r349917)
+++ head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 19:41:14 2019
(r349918)
@@ -317,7 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
}
 
 done:
-   free(uopts);
+   free(uoptsbak);
return (ret);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349915 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul 11 19:26:35 2019
New Revision: 349915
URL: https://svnweb.freebsd.org/changeset/base/349915

Log:
  usr.sbin/bhyve: initialize return value in xhci device interrupt handler
  
  Coverity CID: 1357340
  Approved by:  scottl, markj
  Differential Revision:https://reviews.freebsd.org/D20917

Modified:
  head/usr.sbin/bhyve/pci_xhci.c

Modified: head/usr.sbin/bhyve/pci_xhci.c
==
--- head/usr.sbin/bhyve/pci_xhci.c  Thu Jul 11 19:07:45 2019
(r349914)
+++ head/usr.sbin/bhyve/pci_xhci.c  Thu Jul 11 19:26:35 2019
(r349915)
@@ -2544,7 +2544,7 @@ pci_xhci_dev_intr(struct usb_hci *hci, int epctx)
struct pci_xhci_softc   *sc;
struct pci_xhci_portregs *p;
struct xhci_endp_ctx*ep_ctx;
-   int error;
+   int error = 0;
int dir_in;
int epid;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r349914 - head/usr.sbin/bhyve

2019-07-11 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul 11 19:07:45 2019
New Revision: 349914
URL: https://svnweb.freebsd.org/changeset/base/349914

Log:
  usr.sbin/bhyve: free resources if there is an initialization error in rfb
  
  Coverity CID: 1357335
  Approved by:  markj, jhb
  Differential Revision:https://reviews.freebsd.org/D20919

Modified:
  head/usr.sbin/bhyve/pci_fbuf.c
  head/usr.sbin/bhyve/rfb.c

Modified: head/usr.sbin/bhyve/pci_fbuf.c
==
--- head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 16:22:49 2019
(r349913)
+++ head/usr.sbin/bhyve/pci_fbuf.c  Thu Jul 11 19:07:45 2019
(r349914)
@@ -231,9 +231,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
 
ret = 0;
uopts = strdup(opts);
-   for (xopts = strtok(uopts, ",");
-xopts != NULL;
-xopts = strtok(NULL, ",")) {
+   while ((xopts = strsep(&uopts, ",")) != NULL) {
if (strcmp(xopts, "wait") == 0) {
sc->rfb_wait = 1;
continue;
@@ -260,7 +258,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
if (config) {
if (tmpstr[0] == '[')
tmpstr++;
-   sc->rfb_host = tmpstr;
+   sc->rfb_host = strdup(tmpstr);
if (config[0] == ':')
config++;
else {
@@ -276,7 +274,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
sc->rfb_port = atoi(tmpstr);
else {
sc->rfb_port = atoi(config);
-   sc->rfb_host = tmpstr;
+   sc->rfb_host = strdup(tmpstr);
}
}
} else if (!strcmp(xopts, "vga")) {
@@ -310,7 +308,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
} else if (sc->memregs.height == 0)
sc->memregs.height = 1080;
} else if (!strcmp(xopts, "password")) {
-   sc->rfb_password = config;
+   sc->rfb_password = strdup(config);
} else {
pci_fbuf_usage(xopts);
ret = -1;
@@ -319,6 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o
}
 
 done:
+   free(uopts);
return (ret);
 }
 

Modified: head/usr.sbin/bhyve/rfb.c
==
--- head/usr.sbin/bhyve/rfb.c   Thu Jul 11 16:22:49 2019(r349913)
+++ head/usr.sbin/bhyve/rfb.c   Thu Jul 11 19:07:45 2019(r349914)
@@ -969,7 +969,7 @@ rfb_init(char *hostname, int port, int wait, char *pas
int e;
char servname[6];
struct rfb_softc *rc;
-   struct addrinfo *ai;
+   struct addrinfo *ai = NULL;
struct addrinfo hints;
int on = 1;
 #ifndef WITHOUT_CAPSICUM
@@ -984,6 +984,7 @@ rfb_init(char *hostname, int port, int wait, char *pas
 sizeof(uint32_t));
rc->crc_width = RFB_MAX_WIDTH;
rc->crc_height = RFB_MAX_HEIGHT;
+   rc->sfd = -1;
 
rc->password = password;
 
@@ -1003,28 +1004,25 @@ rfb_init(char *hostname, int port, int wait, char *pas
 
if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e));
-   return(-1);
+   goto error;
}
 
rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0);
if (rc->sfd < 0) {
perror("socket");
-   freeaddrinfo(ai);
-   return (-1);
+   goto error;
}
 
setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
 
if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) {
perror("bind");
-   freeaddrinfo(ai);
-   return (-1);
+   goto error;
}
 
if (listen(rc->sfd, 1) < 0) {
perror("listen");
-   freeaddrinfo(ai);
-   return (-1);
+   goto error;
}
 
 #ifndef WITHOUT_CAPSICUM
@@ -1053,4 +1051,14 @@ rfb_init(char *hostname, int port, int wait, char *pas
 
freeaddrinfo(ai);
return (0);
+
+ error:
+   if (ai != NULL)
+   freeaddrinfo(ai);
+   if (rc->sfd != -1)
+   close(rc->sfd);
+   free(rc->crc);
+   free(rc->crc_tmp);
+   free(rc);
+   return (-1);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsu

svn commit: r349656 - head/usr.sbin/bhyve

2019-07-03 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Wed Jul  3 17:24:24 2019
New Revision: 349656
URL: https://svnweb.freebsd.org/changeset/base/349656

Log:
  bhyve/audio: don't leak resources on failed initialization.
  
  Coverity CID: 1402793
  Approved by:  markj, jhb, bhyve
  Differential Revision:https://reviews.freebsd.org/D20841

Modified:
  head/usr.sbin/bhyve/audio.c

Modified: head/usr.sbin/bhyve/audio.c
==
--- head/usr.sbin/bhyve/audio.c Wed Jul  3 17:09:41 2019(r349655)
+++ head/usr.sbin/bhyve/audio.c Wed Jul  3 17:24:24 2019(r349656)
@@ -103,6 +103,7 @@ audio_init(const char *dev_name, uint8_t dir)
if (aud->fd == -1) {
DPRINTF("Failed to open dev: %s, errno: %d\n",
aud->dev_name, errno);
+   free(aud);
return (NULL);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r336757 - in head: share/man/man4 share/man/man7 share/misc sys/dev/firewire sys/dev/hwpmc sys/dev/sk sys/dev/sound/pci sys/dev/sound/pcm sys/fs/nfsclient

2018-07-28 Thread Sean Chittenden
> > This may intersect badly with our current policy of not shipping any CAs in
> > base.
>
> I objected to the conversion of http -> https in base when it started.  I saw
> no good reason for it, and for the very reason you site, https is totally
> useless in base until you have installed CA's.

The inclusion of public CAs is a source of active debate by core@.  In advance
of a final decision on that subject, we want to get ahead of some of this
discussion.

The FreeBSD Project's place on the interwebs is secured via HTTPS (with limited
exception).  Referring to material hosted by the Project using HTTPS is sound
best practice that help us collectively improve our security posture.

The links where the scheme was changed from http to https are all in
documentation or comments, and are NOT used at runtime by developers, operators,
or any meaningful automation (i.e. this isn't something pkg(1) or fetch(1)
uses).  While this process of updating http links to https does cause a bit of
necessary churn, updating http links in documentation and comments is a
reasonable activity that help us keep the project current with modern standards.

Maintenance activities that enhance our trust with the community is not
glamorous and comes in the form of many similar incremental improvements.  Like
many things in technology, the definition of what's relevant, competitive, and
modern changes over time (including hardware, protocols, performance primitives,
developer productivity, and security best practices).  Moving to HTTPS for
non-runtime links is a sensible example of an incremental improvement that
should not be considered avant-garde in this day and age.

Regardless of the outcome of core@'s decision to include and maintain public CAs
in base (or change a default in the installer to install a port), modernizing
docs or other maintenance activities that improve our security posture is a +1
activity from core@'s perspective.

-sc (on behalf of core@)

-- 
Sean Chittenden


signature.asc
Description: PGP signature


svn commit: r335987 - head/share/misc

2018-07-05 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul  5 15:40:14 2018
New Revision: 335987
URL: https://svnweb.freebsd.org/changeset/base/335987

Log:
  Update with the members of the 10th core team, core.x.

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotThu Jul  5 15:36:49 2018
(r335986)
+++ head/share/misc/organization.dotThu Jul  5 15:40:14 2018
(r335987)
@@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"]
 
 # Development teams go here alphabetically sorted
 
-core [label="Core Team\nc...@freebsd.org\nallanjude, bapt, bcr,\nbenno, 
emaste, gnn,\nhrs, jhb, kmoore"]
+core [label="Core Team\nc...@freebsd.org\nallanjude, bcr, brooks,\nimp, hrs, 
jeff,\njhb, kmoore, seanc"]
 coresecretary [label="Core Team 
Secretary\ncore-secret...@freebsd.org\nmatthew"]
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs,\nwblock"]
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335959 - head/share/misc

2018-07-04 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Wed Jul  4 16:50:51 2018
New Revision: 335959
URL: https://svnweb.freebsd.org/changeset/base/335959

Log:
  Complete my vertex even though edges were in place.
  
  Reported by:  swills
  Approved by:  swills (mentor, implicit)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotWed Jul  4 16:34:07 2018
(r335958)
+++ head/share/misc/committers-ports.dotWed Jul  4 16:50:51 2018
(r335959)
@@ -225,6 +225,7 @@ sat [label="Andrew Pantyukhin\n...@freebsd.org\n2006/0
 sbruno [label="Sean Bruno\nsbr...@freebsd.org\n2014/09/14"]
 sbz [label="Sofian Brabez\n...@freebsd.org\n2011/03/14"]
 scheidell [label="Michael Scheidell\nscheid...@freebsd.org\n2011/11/06"]
+seanc [label="Sean Chittenden\nse...@freebsd.org\n2002/08/15"]
 sem [label="Sergey Matveychuk\n...@freebsd.org\n2004/07/07"]
 sergei [label="Sergei Kolobov\nser...@freebsd.org\n2003/10/21"]
 shaun [label="Shaun Amott\nsh...@freebsd.org\n2006/06/19"]
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333020 - head/share/misc

2018-04-26 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Apr 26 17:13:58 2018
New Revision: 333020
URL: https://svnweb.freebsd.org/changeset/base/333020

Log:
  Add myself back to the ranks of being mentored
  
  Approved by:  swills (mentor)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Apr 26 16:59:06 2018
(r333019)
+++ head/share/misc/committers-ports.dotThu Apr 26 17:13:58 2018
(r333020)
@@ -517,6 +517,7 @@ mat -> dteske
 mat -> dvl
 mat -> gordon
 mat -> mmokhi
+mat -> seanc
 mat -> tcberner
 mat -> thierry
 mat -> tobik
@@ -650,6 +651,7 @@ swills -> pclin
 swills -> rezny
 swills -> robak
 swills -> rpaulo
+swills -> seanc
 swills -> tz
 swills -> xmj
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"