qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] can-host-socketcan: Fix crash when 'if' option is not se


From: Vikram Garhwal
Subject: Re: [PATCH 2/3] can-host-socketcan: Fix crash when 'if' option is not set
Date: Mon, 12 Oct 2020 09:23:13 -0700
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Oct 08, 2020 at 04:27:12PM -0400, Eduardo Habkost wrote:
> Fix the following crash:
>
>   $ qemu-system-x86_64 -object can-host-socketcan,id=obj0
>   Segmentation fault (core dumped)
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> ---
> Cc: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> Cc: Vikram Garhwal <fnu.vikram@xilinx.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  net/can/can_socketcan.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
> index 92b1f79385..4b68f60c6b 100644
> --- a/net/can/can_socketcan.c
> +++ b/net/can/can_socketcan.c
> @@ -194,6 +194,11 @@ static void can_host_socketcan_connect(CanHostState *ch, 
> Error **errp)
>      struct sockaddr_can addr;
>      struct ifreq ifr;
>
> +    if (!c->ifname) {
> +        error_setg(errp, "'if' property not set");
> +        return;
> +    }
> +
>      /* open socket */
>      s = qemu_socket(PF_CAN, SOCK_RAW, CAN_RAW);
>      if (s < 0) {
> --
> 2.26.2
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]