mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-21 21:18:54 +00:00
virtiofsd: Check if PID is valid
If try to kill with an not valid PID the thread goes to panic, check to allow return a valid error from the runtime. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
parent
3251beaa23
commit
6a4e667f9c
@ -217,6 +217,10 @@ func (v *virtiofsd) kill() (err error) {
|
||||
span, _ := v.trace("kill")
|
||||
defer span.Finish()
|
||||
|
||||
if v.PID == 0 {
|
||||
return errors.New("invalid virtiofsd PID(0)")
|
||||
}
|
||||
|
||||
err = syscall.Kill(v.PID, syscall.SIGKILL)
|
||||
if err != nil {
|
||||
v.PID = 0
|
||||
|
Loading…
Reference in New Issue
Block a user