Skip to content

Commit a87158b

Browse files
committed
syz-ci: fix null dereference when JobManager creation fails, skip when no dashboard
When starting syz-ci, if instantiating the JobManager fails (due to dashapi.New() returning an error), we log an error and then proceed to go right ahead and call the startLoop() method with a nil pointer anyway. Fix this by only calling startLoop() if newJobManager() succeeded. Additionally, one reason why setting up the JobManager might fail is when you don't specify a dashboard address, which is an optional field in the syz-ci config. There's no point having a JobManager without a dashboard, so just skip this completely when there's no dashboard. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
1 parent 6bdf333 commit a87158b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

syz-ci/syz-ci.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,17 @@ func main() {
321321
}()
322322
}
323323
}
324-
jm, err := newJobManager(cfg, managers, shutdownPending)
325-
if err != nil {
326-
log.Fatalf("failed to create dashapi connection %v", err)
327-
}
324+
328325
ctxJobs, stopJobs := context.WithCancel(ctx)
329326
wgJobs := sync.WaitGroup{}
330-
jm.startLoop(ctxJobs, &wgJobs)
327+
if cfg.DashboardAddr != "" {
328+
jm, err := newJobManager(cfg, managers, shutdownPending)
329+
if err != nil {
330+
log.Fatalf("failed to create dashapi connection %v", err)
331+
} else {
332+
jm.startLoop(ctxJobs, &wgJobs)
333+
}
334+
}
331335

332336
// For testing. Racy. Use with care.
333337
http.HandleFunc("/upload_cover", func(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)