Re: [PATCH v2] tools/hv: Add memory allocation check in hv_fcopy_start
From: Saurabh Singh Sengar
Date: Fri Sep 06 2024 - 23:57:58 EST
On Sat, Sep 07, 2024 at 12:49:59AM +0000, Dexuan Cui wrote:
> > From: Saurabh Singh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx>
> > Sent: Wednesday, September 4, 2024 10:21 PM
> > [...]
> > hv_fcopy_send_data is the parent function which calls hv_fcopy_start.
> > Possibly a good solution is to check the return value from
> > hv_fcopy_send_data
>
> The return value of hv_fcopy_send_data() is saved into icmsghdr->status, which
> is sent to the host, so the PowerShell command on the host will report an error
> immediately.
>
> > in fcopy_pkt_process function. Otherwise I prefer exit over returning error.
> >
> > And as you rightly pointed out if we use exit, there is no sense of using free.
> >
> > - Saurabh
>
> exit() here is not ideal in that the host doesn't know what's going on inside
> the VM, and I guess the host PowerShell command will time out after quite
> a while. Without exit(), the daemon can continue to run to accept the next
> requests from the host; with exit(), we rely on systemd's Restart=on-failure.
> I prefer not to call exit() here.
>
> Thanks,
> Dexuan
>
make sense, thanks.
- Saurabh