lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aDCjua9KiI96Q8Ht@smile.fi.intel.com>
Date: Fri, 23 May 2025 19:35:05 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Rahul Pathak <rpathak@...tanamicro.com>
Cc: Anup Patel <apatel@...tanamicro.com>,
	Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Jassi Brar <jassisinghbrar@...il.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	"Rafael J . Wysocki" <rafael@...nel.org>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Uwe Kleine-König <ukleinek@...nel.org>,
	Palmer Dabbelt <palmer@...belt.com>,
	Paul Walmsley <paul.walmsley@...ive.com>,
	Len Brown <lenb@...nel.org>, Sunil V L <sunilvl@...tanamicro.com>,
	Leyfoon Tan <leyfoon.tan@...rfivetech.com>,
	Atish Patra <atish.patra@...ux.dev>,
	Andrew Jones <ajones@...tanamicro.com>,
	Samuel Holland <samuel.holland@...ive.com>,
	Anup Patel <anup@...infault.org>, linux-clk@...r.kernel.org,
	devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 10/23] clk: Add clock driver for the RISC-V RPMI clock
 service group

On Thu, May 22, 2025 at 06:44:09PM +0530, Rahul Pathak wrote:
> On Mon, May 12, 2025 at 12:38 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Sun, May 11, 2025 at 07:09:26PM +0530, Anup Patel wrote:

First of all, remove all unneeded context with which you are agree.
I should not crawl through dozens of lines of the email to see what
you wanted to discuss. Take it as everyday practice, please.

...

> > > +     /* Validate RPMI specification version */
> > > +     rpmi_mbox_init_get_attribute(&msg, RPMI_MBOX_ATTR_SPEC_VERSION);
> > > +     ret = rpmi_mbox_send_message(context->chan, &msg);
> > > +     if (ret) {
> > > +             dev_err_probe(dev, ret, "Failed to get spec version\n");
> > > +             goto fail_free_channel;
> >
> > This is simply wrong. You should not do goto before any devm_*() calls.
> > The error path and ->remove(), if present) is broken. Fix it accordingly.
> >
> > Here should be
> >
> >                 return dev_err_probe(...);
> >
> > it's your homework to understand how to achieve that. Plenty of the examples in
> > the kernel.
> 
> So far I could only find drivers with "goto used before devm_*" pattern used.

Of course, because they are wrong and most of them need fixing.
(Yes, there are some exceptional cases, but I don't believe it's many)

> Can you please point me to the example which does not use goto before
> devm_* apis.

Tons of them, any which starts with devm_*() call in the probe, most of the
drivers/iio/, for instance. Just a random pick here: drivers/iio/accel/bma400*.

(and FWIW it was indeed the very first driver I was looking into while writing
 this email)

> Also, I couldn't understand the problem which may happen because of
> this. Can you please explain?

devm_*() defers the resource deallocation to the end of ->remove() and error
path in ->probe(). This breaks the symmetry of the allocating / deallocating
resources. At worst case it will be an Oops on ->remove() or when error happens
during the ->probe().

...

My gosh, the original text was quoted twice! Next time I won't even look into
the email reply which won't have a reduced context.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ