From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 942B67A for ; Mon, 11 Jul 2022 13:10:17 +0000 (UTC) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-3137316bb69so48003717b3.10 for ; Mon, 11 Jul 2022 06:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=0ZOXSRSmgwM/8CfCPUrZ7l+OIh1asVluDdyFXnWqD8E=; b=dJra3IJxOrzyO+7mkYfwJM+xkVjzbjwnshtKynJEY1d9HigyxWdhK/P3oXcEKtAwf2 n0DGV/ppHdqO8+FJPsHVKM2viLcDrzrD/8N47vVpcxI8crZMoTcyG7GabZh66TgDQt5K vR/OejvhThCm/ej8J+wkLbdDy4W/ha21NgDgri/u9j0L83H7+q9NKgUOANZtb3iQeb5m p5azi6yuxgVK5tVtUrkEqXMghbb7Ofd2Wahz6HtCDfF99Vp1EADGzIX2hVaA1X+UFnUO Wv0TU96HYsKm2m1KnTL59Uo73M2HzpiYTf5Uqn3AdcZn42/FTSzvlq1rPQklocqPCM7c omEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=0ZOXSRSmgwM/8CfCPUrZ7l+OIh1asVluDdyFXnWqD8E=; b=KeZL0bPxSK6jL9CuEefEofVcSMsYeZkRgLphNm8NRLf0uX52ynS/I9l4k8nokF78oX pEGWwoWodbHaV9JwyA+GSyq6SjyA/mQeomyqx9VTNcB2az94eU0HnurTU3yGGS+l/ncV PIzEi/XXI/w95EZrQjlP3QkV17/faijkY6JI1dGzYJhIQEu7+1hbdUZVUpIGR6jywMOt /SMixJujO9NX6wlvO3SzbmhEErhR1Xw4n3Gxj57fnI4Jxu+Kyq5qkm3LQDz733kjSnAr qG4u1hOstzHFHikSyY3l6NuMbITX3WRh2xNAF1x7b+mR1df4pCuGoMDKwsejCBrgsh5m un2Q== X-Gm-Message-State: AJIora8tDgOg9eKxyRdTlTYpqViIoQXRoq6HZy2XNZWl8MXgc4h22avS KURapupYUZLVa9oPptDcISC8yL5If8SjCaSX1xE= X-Google-Smtp-Source: AGRyM1u1pNjRlMbjWdZEYceQFq+a842D/zBdsYQozhXo4zH7jPGpQ6tqGeQop8qO1ntORr3Ei1MkK2BI3EBjQhr2i6c= X-Received: by 2002:a81:4bd7:0:b0:31c:91da:5a20 with SMTP id y206-20020a814bd7000000b0031c91da5a20mr20757632ywa.131.1657545016097; Mon, 11 Jul 2022 06:10:16 -0700 (PDT) Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220711123835.811358-1-nuno.sa@analog.com> <20220711123835.811358-2-nuno.sa@analog.com> In-Reply-To: <20220711123835.811358-2-nuno.sa@analog.com> From: Andy Shevchenko Date: Mon, 11 Jul 2022 15:09:39 +0200 Message-ID: Subject: Re: [PATCH v2 01/15] iio: inkern: only release the device node when done with it To: =?UTF-8?B?TnVubyBTw6E=?= Cc: linux-arm-msm , OpenBMC Maillist , Linux-Renesas , "moderated list:ARM/Mediatek SoC support" , dl-linux-imx , "open list:BROADCOM NVRAM DRIVER" , Lad Prabhakar , linux-iio , chrome-platform@lists.linux.dev, linux-arm Mailing List , linux-stm32@st-md-mailman.stormreply.com, Andy Gross , Nicolas Ferre , Benson Leung , Matthias Brugger , Tomer Maimon , Zhang Rui , "Rafael J. Wysocki" , Eugen Hristev , Sascha Hauer , Alexandre Belloni , Benjamin Fair , Nancy Yuen , Fabrice Gasnier , Jishnu Prakash , Christophe Branchereau , Avi Fishman , Tali Perry , Michael Hennerich , Miquel Raynal , Claudiu Beznea , Lars-Peter Clausen , Thara Gopinath , Cai Huoqing , Fabio Estevam , Olivier Moysan , Shawn Guo , Haibo Chen , Arnd Bergmann , Daniel Lezcano , Patrick Venture , Amit Kucheria , Maxime Coquelin , Lorenzo Bianconi , Paul Cercueil , Alexandre Torgue , Gwendal Grignou , Bjorn Andersson , Saravanan Sekar , Guenter Roeck , Jonathan Cameron , Pengutronix Kernel Team , Linus Walleij Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 11, 2022 at 2:38 PM Nuno S=C3=A1 wrote: > > 'of_node_put()' can potentially release the memory pointed to by > 'iiospec.np' which would leave us with an invalid pointer (and we would > still pass it in 'of_xlate()'). Note that it is not guaranteed for the > of_node lifespan to be attached to the device (to which is attached) > lifespan so that there is (even though very unlikely) the possibility > for the node to freed while the device is still around. Thus, as there be freed > are indeed some of_xlate users which do access the node, a possible race > is indeed possible. possible ... possible. (I would drop the first one) > As such, we can only release the node after we are done with it. --=20 With Best Regards, Andy Shevchenko