On Mon, 24 Feb 2014, Dan Williams wrote:
> On Mon, 2014-02-24 at 19:01 -0800, Dan Williams wrote:
> > As mentioned in the comments on patch 2, while ->peer is being modified
> > we don't want usb_port_runtime_{suspend|resume} to run. Introduce
> > pre_modify_peers() and post_modify_peers() to close that hole.
>
> ...thinking about it further, when we unlink the peers it might be the
> final put on the device, so {pre|post}_modify_peers() need to take and
> drop a device reference.
This is getting ridiculous.
Look, we guarantee that the peer relation is dropped when either of the
devices is unregistered. Therefore there's no need to take a reference
to the peer device.
This will cause a problem only if something else goes wrong. That's
why I suggested, in patch 2, that when a peering error is detected, you
print out the erroneous pointer rather than assuming it points to a
valid port structure.
This is also why I suggested that you close the race in
usb_hub_remove_port_device: to make sure that the guarantee really is
enforced.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html