From: Rong Zhang <i@rong.moe>
To: sashiko-reviews@lists.linux.dev
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v4 1/9] HID: haptic: Get rid of input_ff_destroy() in error paths
Date: Wed, 25 Nov 2026 01:07:26 +0800 [thread overview]
Message-ID: <e7b9f2600bb42e1ed514d02f59ec905757de7ae8.camel@rong.moe> (raw)
In-Reply-To: <sashiko-outbox-231650@kernel.org>
Hi All,
On Tue, 2026-11-24 at 17:04 +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] HID: haptic: inaccurate Fixes trailer in hid_haptic_init() fix
> --
>
> commit e6d3c5552e5a0755862fb250069c54d74d75f7cb
> Author: Rong Zhang <i@rong.moe>
>
> > HID: haptic: Get rid of input_ff_destroy() in error paths
> >
> > It's painful to have error paths after calling input_ff_create(),
> > because input_ff_destroy() frees too much things but does not restore
> > some other things. For example, every error path calling
> > input_ff_destroy() frees ff->private, while the others don't. This
> > divergence has caused quite a lot of trouble.
> >
> > Additionally, the driver's get_device() bail-out path calls module_put()
> > right before hid_haptic_destroy() calling it again, causing refcount
> > underflow.
> >
> > Since commit 2ae35f090d02 ("Input: destroy force-feedback device on
> > input unregistration"), the HID device is now guaranteed to have a
> > longer lifetime than the FF device, making get_device()/put_device()
> > unnecessary.
> >
> > Due to the driver being unable to build as a module since commit
> > 083a4f3f3cc7 ("HID: Kconfig: Fix build error from CONFIG_HID_HAPTIC"),
> > try_module_get()/module_put() is needless, too.
> >
> > Remove the said calls, so that there is no error path after
> > input_ff_create(), eliminating the call to input_ff_destroy(). In this
> > manner, we don't need to restore dev->flush and dev->event either.
> >
> > Fixes: 083a4f3f3cc7 ("HID: Kconfig: Fix build error from CONFIG_HID_HAPTIC")
> > Cc: stable@vger.kernel.org
> > Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Link: https://msgid.link/f44447354f28c295e79a025bbcab7a4e@gmail.com
> > Signed-off-by: Rong Zhang <i@rong.moe>
>
> [Severity: Low]
> 083a4f3f3cc7 ("HID: Kconfig: Fix build error from CONFIG_HID_HAPTIC") only
> changed CONFIG_HID_HAPTIC from tristate to bool in drivers/hid/Kconfig.
> The broken input_free error path and double module_put() in
> hid_haptic_init() were introduced in 344ff3584957 ("HID: haptic:
> initialize haptic device").
>
> Should the Fixes: tag point to 344ff3584957 ("HID: haptic: initialize
> haptic device") instead?
No. This commit removes try_module_get()/module_put(), and thus depends
on the current Fixes: commit.
Thanks,
Rong
next prev parent reply other threads:[~2026-11-24 17:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 16:44 [PATCH v4 0/9] HID: Add hid-plugin framework & convert haptic into a plugin Rong Zhang
2026-11-24 16:44 ` [PATCH v4 1/9] HID: haptic: Get rid of input_ff_destroy() in error paths Rong Zhang
2026-11-24 17:04 ` sashiko-bot
2026-11-24 17:07 ` Rong Zhang [this message]
2026-11-24 16:44 ` [PATCH v4 2/9] HID: haptic: Fix use-after-free when draining workqueue Rong Zhang
2026-11-24 16:44 ` [PATCH v4 3/9] HID: haptic, multitouch: Check haptic prerequisite properly Rong Zhang
2026-11-24 16:44 ` [PATCH v4 4/9] HID: haptic, multitouch: Fix haptic device double-free and unnecessary allocation Rong Zhang
2026-11-24 16:44 ` [PATCH v4 5/9] HID: haptic: Postpone GET_REPORT to init Rong Zhang
2026-11-24 16:44 ` [PATCH v4 6/9] HID: haptic: Convert simple methods into static inline ones Rong Zhang
2026-11-24 16:44 ` [PATCH v4 7/9] HID: Add hid-plugin framework for loadable plugin modules Rong Zhang
2026-11-24 16:44 ` [PATCH v4 8/9] HID: haptic: Convert into a loadable plugin module Rong Zhang
2026-11-24 17:04 ` sashiko-bot
2026-11-24 16:44 ` [PATCH v4 9/9] HID: haptic: Remove stubs in favor of inlined dead code elimination Rong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7b9f2600bb42e1ed514d02f59ec905757de7ae8.camel@rong.moe \
--to=i@rong.moe \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox