> -----Original Message----- > From: David Marchand <david.march...@redhat.com> > Sent: 14 октября 2021 г. 14:37 > To: dev@dpdk.org > Cc: Dmitry Kozlyuk <dkozl...@nvidia.com>; sta...@dpdk.org; Matan Azrad > <ma...@nvidia.com>; Slava Ovsiienko <viachesl...@nvidia.com>; > Xueming(Steven) Li <xuemi...@nvidia.com>; Jack Min <jack...@nvidia.com> > 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: sta...@dpdk.org > > Signed-off-by: David Marchand <david.march...@redhat.com>
Thanks for taking care of this. Reviewed-by: Dmitry Kozlyuk <dkozl...@nvidia.com> > --- 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; > }