> -----Original Message----- > From: David Marchand <[email protected]> > Sent: 14 октября 2021 г. 14:37 > To: [email protected] > Cc: Dmitry Kozlyuk <[email protected]>; [email protected]; Matan Azrad > <[email protected]>; Slava Ovsiienko <[email protected]>; > Xueming(Steven) Li <[email protected]>; Jack Min <[email protected]> > Subject: [PATCH] net/mlx5: do not close stdin on error > > External email: Use caution opening links or attachments > > > If for any reason, a socket could not be opened, mlx5_pmd_socket_init() > could close the 0 fd (which is valid, and has a fair chance to be stdin), > since server_socket == 0 from the variable being in .bss. > > Fixes: e6cdc54cc0ef ("net/mlx5: add socket server for external tools") > Cc: [email protected] > > Signed-off-by: David Marchand <[email protected]>
Thanks for taking care of this. Reviewed-by: Dmitry Kozlyuk <[email protected]> > --- Depends-on: patch-101572 ("net/mlx5: close tools socket with the last device") [...] > if (mlx5_pmd_interrupt_handler_install()) { > DRV_LOG(WARNING, "cannot register interrupt handler for > mlx5 socket: %s", > strerror(errno)); Another bug, `errno` doesn't hold the error code here. I'll fix it in the follow-up. > - goto close; > + goto remove; > } > return 0; > -close: > +remove: > remove(sun.sun_path); > -error: > +close: > claim_zero(close(server_socket)); > - server_socket = 0; > + server_socket = -1; > +error: > DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno)); > return -errno; > }

