From: David S. Miller Date: Wed, 18 Oct 2023 08:23:02 +0000 (+0100) Subject: Merge branch 'devlink-deadlock' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a0a86022474304e012aad5d41943fdd31a036284;p=linux.git Merge branch 'devlink-deadlock' Jiri Pirko says: ==================== devlink: fix a deadlock when taking devlink instance lock while holding RTNL lock devlink_port_fill() may be called sometimes with RTNL lock held. When putting the nested port function devlink instance attrs, current code takes nested devlink instance lock. In that case lock ordering is wrong. Patch #1 is a dependency of patch #2. Patch #2 converts the peernet2id_alloc() call to rely in RCU so it could called without devlink instance lock. Patch #3 takes device reference for devlink instance making sure that device does not disappear before devlink_release() is called. Patch #4 benefits from the preparations done in patches #2 and #3 and removes the problematic nested devlink lock aquisition. Patched #5-#7 improve documentation to reflect this issue so it is avoided in the future. ==================== Signed-off-by: David S. Miller --- a0a86022474304e012aad5d41943fdd31a036284