RE: [PATCH v2 1/2] xen/xenbus: reference count registered modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 29 November 2019 16:01
> To: Durrant, Paul <pdurrant@xxxxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx; linux-block@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Boris
> Ostrovsky <boris.ostrovsky@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>
> Subject: Re: [PATCH v2 1/2] xen/xenbus: reference count registered modules
> 
> On 29.11.2019 14:43, Paul Durrant wrote:
> > To prevent a module being removed whilst attached to a frontend, and
> 
> Why only frontend?
> 

True. Originally this was only intended for backends, but I guess this should now be 'otherend' or some equivalent form of words.

> > hence xenbus calling into potentially invalid text, take a reference on
> > the module before calling the probe() method (dropping it if
> unsuccessful)
> > and drop the reference after returning from the remove() method.
> >
> > NOTE: This allows the ad-hoc reference counting in xen-netback to be
> >       removed. This will be done in a subsequent patch.
> >
> > Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
> > Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
> >
> > --- a/drivers/xen/xenbus/xenbus_probe.c
> > +++ b/drivers/xen/xenbus/xenbus_probe.c
> > @@ -232,9 +232,11 @@ int xenbus_dev_probe(struct device *_dev)
> >  		return err;
> >  	}
> >
> > +	__module_get(drv->driver.owner);
> 
> I guess you really want try_module_get() and deal with it returning
> false.
> 

Perhaps, yes.

  Paul

> Jan




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux