> -----Original Message----- > From: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> > Sent: Friday, 28 July 2023 03:16 > To: Jason Gunthorpe <jgg@xxxxxxxx>; Bernard Metzler <BMT@xxxxxxxxxxxxxx> > Cc: leon@xxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx > Subject: [EXTERNAL] Re: [PATCH 0/5] Fix potential issues for siw > > > > On 7/28/23 01:29, Jason Gunthorpe wrote: > > On Thu, Jul 27, 2023 at 05:17:40PM +0000, Bernard Metzler wrote: > >> > >>> -----Original Message----- > >>> From: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> > >>> Sent: Thursday, 27 July 2023 16:04 > >>> To: Bernard Metzler <BMT@xxxxxxxxxxxxxx>; jgg@xxxxxxxx; leon@xxxxxxxxxx > >>> Cc: linux-rdma@xxxxxxxxxxxxxxx > >>> Subject: [EXTERNAL] [PATCH 0/5] Fix potential issues for siw > >>> > >>> Hi, > >>> > >>> Several issues appeared if we rmmod siw module after failed to insert > >>> the module (with manual change like below). > >>> > >>> --- a/drivers/infiniband/sw/siw/siw_main.c > >>> +++ b/drivers/infiniband/sw/siw/siw_main.c > >>> @@ -577,6 +577,7 @@ static __init int siw_init_module(void) > >>> if (rv) > >>> goto out_error; > >>> > >>> + goto out_error; > >>> rdma_link_register(&siw_link_ops); > >>> > >>> Basically, these issues are double free, use before initalization or > >>> null pointer dereference. For more details, pls review the individual > >>> patch. > >>> > >>> Thanks, > >>> Guoqing > >> Hi Guoqing, > >> > >> very good catch, thank you. I was under the wrong assumption a > >> module is not loaded if the init_module() returns a value. > > I think that is actually true, isn't it? I'm confused? > > Yes, you are right. Since rv is still 0, so the module appears in the > kernel. Not sure if some tool could inject err like this. Feel free to > ignore this. > Right I came to the same conclusion today 😉 - if you set a return value in you test the module is not loaded. > Thanks, > Guoqing