Re: [PATCH 1/2] module: pull out add_taint_module() to be public

From: Greg Kroah-Hartman

Date: Thu Aug 27 2026 - 10:32:55 EST


On Thu, Aug 27, 2026 at 03:36:41PM +0200, Johan Hovold wrote:
> On Wed, Aug 26, 2026 at 11:19:32AM +0200, Greg Kroah-Hartman wrote:
> > Other kernel code might want to call add_taint_module() so pull it out
> > and make it global. If modules are not enabled, this defaults to a call
> > to add_taint(), so all is fine.
> >
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> > -static inline void add_taint_module(struct module *mod, unsigned flag,
> > - enum lockdep_ok lockdep_ok)
> > +/**
> > + * add_taint_module: add a taint flag if not already set for a specific module
> > + * @mod: pointer to the module that caused the problem
> > + * @flag: one of the TAINT_* constants.
> > + * @lockdep_ok: whether lock debugging is still OK.
> > + *
> > + * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for
> > + * some noteworthy-but-not-corrupting cases, it can be set to true.
> > + */
> > +void add_taint_module(struct module *mod, unsigned flag,
> > + enum lockdep_ok lockdep_ok)
> > {
> > add_taint(flag, lockdep_ok);
>
> > set_bit(flag, &mod->taints);
>
> As has been pointed out, this crashes with built-in drivers. If you go
> with a simple mod NULL check before this call (and updated kernel-doc)
> you can add my:

Yeah, I've fixed this locally and will be resolved in v2.

> Reviewed-by: Johan Hovold <johan@xxxxxxxxxx>
> Tested-by: Johan Hovold <johan@xxxxxxxxxx>

Thanks!