Patch "Input: stmfts - do not leave device disabled in stmfts_input_open" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Input: stmfts - do not leave device disabled in stmfts_input_open

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     input-stmfts-do-not-leave-device-disabled-in-stmfts_.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 61060fcb6b14d50f767ce917d3853ddf02473bef
Author: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Date:   Wed May 25 09:51:08 2022 -0700

    Input: stmfts - do not leave device disabled in stmfts_input_open
    
    [ Upstream commit 5f76955ab1e43e5795a9631b22ca4f918a0ae986 ]
    
    The commit 26623eea0da3 attempted to deal with potential leak of runtime
    PM counter when opening the touchscreen device, however it ended up
    erroneously dropping the counter in the case of successfully enabling the
    device.
    
    Let's address this by using pm_runtime_resume_and_get() and then executing
    pm_runtime_put_sync() only when we fail to send "sense on" command to the
    device.
    
    Fixes: 26623eea0da3 ("Input: stmfts - fix reference leak in stmfts_input_open")
    Reported-by: Pavel Machek <pavel@xxxxxxx>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index 72e0b767e1ba..c175d44c52f3 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -337,13 +337,15 @@ static int stmfts_input_open(struct input_dev *dev)
 	struct stmfts_data *sdata = input_get_drvdata(dev);
 	int err;
 
-	err = pm_runtime_get_sync(&sdata->client->dev);
-	if (err < 0)
-		goto out;
+	err = pm_runtime_resume_and_get(&sdata->client->dev);
+	if (err)
+		return err;
 
 	err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON);
-	if (err)
-		goto out;
+	if (err) {
+		pm_runtime_put_sync(&sdata->client->dev);
+		return err;
+	}
 
 	mutex_lock(&sdata->mutex);
 	sdata->running = true;
@@ -366,9 +368,7 @@ static int stmfts_input_open(struct input_dev *dev)
 				 "failed to enable touchkey\n");
 	}
 
-out:
-	pm_runtime_put_noidle(&sdata->client->dev);
-	return err;
+	return 0;
 }
 
 static void stmfts_input_close(struct input_dev *dev)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux