Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752062AbdLDTpV (ORCPT ); Mon, 4 Dec 2017 14:45:21 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:44444 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbdLDTpM (ORCPT ); Mon, 4 Dec 2017 14:45:12 -0500 X-Google-Smtp-Source: AGs4zMaKcEa6LB0rsPGButbTI9idYRht+yDzbPAkKS6JliWmxmlAD97B5tCH5KmuD/I1WVwH767Ucwq61c20W2tKIG4= MIME-Version: 1.0 In-Reply-To: References: <1512402456-8176-1-git-send-email-geert+renesas@glider.be> <1512402456-8176-3-git-send-email-geert+renesas@glider.be> From: Geert Uytterhoeven Date: Mon, 4 Dec 2017 20:45:10 +0100 X-Google-Sender-Auth: fz2yRPW3pV8ePBD4IM0Af9wGBaM Message-ID: Subject: Re: [PATCH v2 2/2] of: overlay: Fix cleanup order in of_overlay_apply() To: Rob Herring Cc: Geert Uytterhoeven , Pantelis Antoniou , Frank Rowand , Colin King , Dan Carpenter , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1342 Lines: 39 Hi Rob, On Mon, Dec 4, 2017 at 8:35 PM, Rob Herring wrote: > On Mon, Dec 4, 2017 at 9:47 AM, Geert Uytterhoeven > wrote: >> The special overlay mutex is taken first, hence it should be released >> last in the error path. >> >> Move "mutex_lock(&of_mutex)" up, as suggested by Frank, as >> free_overlay_changeset() should be called with that mutex held if any >> non-trivial cleanup is to be done. > > Not holding the of_mutex for of_resolve_phandles is just wrong. > Without it, a node and new phandle could be added via of_attach_node > making the max phandle wrong. After my patch it's held, so what's the problem? > Now, with the 2 mutexes adjacent, what is the point of even having the > of_overlay_mutex? Seems like we should just drop it. Frank? > I also don't think we really need to hold the mutex during post-apply > notifiers. It also seems like some steps could be moved outside the > mutex(es) like init_overlay_changeset(). Perhaps. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds