]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: synaptics-rmi4 - propagate F54 worker errors to V4L2 queue
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 26 Jun 2026 05:17:55 +0000 (22:17 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 5 Aug 2026 17:09:53 +0000 (10:09 -0700)
Previously, rmi_f54_buffer_queue() waited for the worker thread to
finish but ignored whether it succeeded. If the worker failed (e.g.,
due to a timeout or register read failure), the queue thread would
silently return success, delivering stale or uninitialized memory to
userspace.

Add a 'report_error' field to struct f54_data to store the worker's exit
status. Check this field in rmi_f54_buffer_queue() after the worker
finishes, and mark the buffer as VB2_BUF_STATE_ERROR if an error
occurred.

Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics")
Reported-by: sashiko-bot@kernel.org
Cc: stable@vger.kernel.org
Assisted-by: Antigravity:gemini-3.5-flash
Link: https://patch.msgid.link/20260626051802.4033172-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/rmi4/rmi_f54.c

index 345646612032dbe96530064817847193f8c40dd0..6c6cdec7da9e33ce3d3b6e033fed90e5220ece8e 100644 (file)
@@ -106,6 +106,7 @@ struct f54_data {
        u8 *report_data;
        size_t max_report_size;
        int report_size;
+       int report_error;
 
        bool is_busy;
        struct mutex status_mutex;
@@ -340,6 +341,12 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb)
                mutex_lock(&f54->data_mutex);
        }
 
+       if (f54->report_error) {
+               dev_err(&f54->fn->dev, "Error acquiring report: %d\n", f54->report_error);
+               state = VB2_BUF_STATE_ERROR;
+               goto data_done;
+       }
+
        ptr = vb2_plane_vaddr(vb, 0);
        if (!ptr) {
                dev_err(&f54->fn->dev, "Error acquiring frame ptr\n");
@@ -610,6 +617,7 @@ out:
                report_size = 0;
 
        f54->report_size = report_size;
+       f54->report_error = error;
 
        if (report_size == 0 && !error) {
                queue_delayed_work(f54->workqueue, &f54->work,