All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rong Zhang" <i@rong.moe>
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: Tue, 24 Nov 2026 17:04:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-231650@kernel.org> (raw)
In-Reply-To: <20261125-hid-haptic-kmod-v4-1-03713a89f656@rong.moe>

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?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-hid-haptic-kmod-v4-0-03713a89f656@rong.moe?part=1

  reply	other threads:[~2026-11-24 17:04 UTC|newest]

Thread overview: 14+ 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 [this message]
2026-11-24 17:07     ` Rong Zhang
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 17:41     ` Rong Zhang
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=sashiko-outbox-231650@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=i@rong.moe \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.