Changeset
src/bhyve/bhyve_command.c | 6 ++++++
1 file changed, 6 insertions(+)
Git apply log
Switched to a new branch '20180311160222.55956-1-bogorodskiy@gmail.com'
Applying: bhyve: fix crash on missing interface model
Using index info to reconstruct a base tree...
M	src/bhyve/bhyve_command.c
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
To https://github.com/patchew-project/libvirt
 * [new tag]         patchew/20180311160222.55956-1-bogorodskiy@gmail.com -> patchew/20180311160222.55956-1-bogorodskiy@gmail.com
Test passed: syntax-check

loading

[libvirt] [PATCH] bhyve: fix crash on missing interface model
Posted by Roman Bogorodskiy, 14 weeks ago
The bhyve driver crashes in bhyveBuildNetArgStr() when
network interface model is not defined. As it has to be provided
explicitly, add a check to report an error if it's missing.
---
 src/bhyve/bhyve_command.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index ec5d24012..9413ae5c1 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -56,6 +56,12 @@ bhyveBuildNetArgStr(virConnectPtr conn,
     int ret = -1;
     virDomainNetType actualType = virDomainNetGetActualType(net);
 
+    if (net->model == NULL) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("NIC model must be specified"));
+        return -1;
+    }
+
     if (STREQ(net->model, "virtio")) {
         if (VIR_STRDUP(nic_model, "virtio-net") < 0)
             return -1;
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: fix crash on missing interface model
Posted by Michal Privoznik, 14 weeks ago
On 03/11/2018 05:02 PM, Roman Bogorodskiy wrote:
> The bhyve driver crashes in bhyveBuildNetArgStr() when
> network interface model is not defined. As it has to be provided
> explicitly, add a check to report an error if it's missing.
> ---
>  src/bhyve/bhyve_command.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
> index ec5d24012..9413ae5c1 100644
> --- a/src/bhyve/bhyve_command.c
> +++ b/src/bhyve/bhyve_command.c
> @@ -56,6 +56,12 @@ bhyveBuildNetArgStr(virConnectPtr conn,
>      int ret = -1;
>      virDomainNetType actualType = virDomainNetGetActualType(net);
>  
> +    if (net->model == NULL) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("NIC model must be specified"));
> +        return -1;
> +    }
> +
>      if (STREQ(net->model, "virtio")) {
>          if (VIR_STRDUP(nic_model, "virtio-net") < 0)
>              return -1;
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: fix crash on missing interface model
Posted by Roman Bogorodskiy, 14 weeks ago
  Michal Privoznik wrote:

> On 03/11/2018 05:02 PM, Roman Bogorodskiy wrote:
> > The bhyve driver crashes in bhyveBuildNetArgStr() when
> > network interface model is not defined. As it has to be provided
> > explicitly, add a check to report an error if it's missing.
> > ---
> >  src/bhyve/bhyve_command.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
> > index ec5d24012..9413ae5c1 100644
> > --- a/src/bhyve/bhyve_command.c
> > +++ b/src/bhyve/bhyve_command.c
> > @@ -56,6 +56,12 @@ bhyveBuildNetArgStr(virConnectPtr conn,
> >      int ret = -1;
> >      virDomainNetType actualType = virDomainNetGetActualType(net);
> >  
> > +    if (net->model == NULL) {
> > +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > +                       _("NIC model must be specified"));
> > +        return -1;
> > +    }
> > +
> >      if (STREQ(net->model, "virtio")) {
> >          if (VIR_STRDUP(nic_model, "virtio-net") < 0)
> >              return -1;
> > 
> 
> ACK

Pushed, thanks!

> Michal

Roman Bogorodskiy
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list