Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtiofsd: Check if PID is valid
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jcvenegas committed Mar 19, 2020
1 parent 3251bea commit 6a4e667
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtcontainers/virtiofsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a4e667

Please sign in to comment.