Re: [PATCH v2 1/1] mcb: create dedicated bus_type for mcb_bus and mcb_device

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

 



On Sat, 2023-08-19 at 11:56 +0200, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> On Fri, Aug 18, 2023 at 11:03:03AM +0000, Rodríguez Barbarin, José
> Javier wrote:
> > When allocating a new mcb_bus the bus_type is added to the mcb_bus
> > itself, causing an issue when calling mcb_bus_add_devices().
> > This function is not only called for each mcb_device under the
> > mcb_bus but for the bus itself.
> > 
> > This causes a crash when freeing the ida resources as the bus
> > numbering
> > gets corrupted due to a wrong cast of structs mcb_bus and
> > mcb_device.
> 
> Why not just fix this up and determine the "type" of the device
> before
> you cast anything?

Hi Greg,

Thanks for the review.

We will try and fix the root cause of this. The only reason we
need this cast for mcb_device struct in __mcb_bus_add_devices()
is to update an is_added flag to track whether the device has
already been attached to a driver or not. However, this is
already reported in the return value of device_attach() so we
may avoid the casting issues by just not casting to any mcb_foo 
struct there and just use the device struct.

We will try this approach and send a V3 patchset for fixing this
crash when releasing mcb devices.

Regards,
Jorge

> 
> > Make the release of the mcb devices and their mcb bus explicit.
> 
> That's good, but now you have a new bus type which is a bit odd just
> for
> the bus controller.  It's not necessarily bad, but not generally what
> other busses do.  As an example, USB controllers are not their own
> bus
> type, but rather, a different type of device on the same bus.  Same
> goes
> for greybus devices/controllers.
> 
> So perhaps try doing that instead of creating a whole new bus here?
> 
> thanks,
> 
> greg k-h





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux