[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <91ec4fb04e3e970073ec7c0c5aff4b1659d11880.camel@duagon.com>
Date: Wed, 23 Aug 2023 08:07:12 +0000
From: Sanjuán García, Jorge
<Jorge.SanjuanGarcia@...gon.com>
To: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
Rodríguez Barbarin, José Javier
<JoseJavier.Rodriguez@...gon.com>
CC: "jirislaby@...nel.org" <jirislaby@...nel.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"jth@...nel.org" <jth@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"morbidrsa@...il.com" <morbidrsa@...il.com>
Subject: Re: [PATCH v2 1/1] mcb: create dedicated bus_type for mcb_bus and
mcb_device
On Sat, 2023-08-19 at 11:56 +0200, gregkh@...uxfoundation.org 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
Powered by blists - more mailing lists