Skip to contentSkip to conversation

HID: logitech-hidpp: Prevent use-after-free on force feedback initialisation failure

PATCH Applied Lee Jones 3 participants 6 messages Feb 27 – Mar 17

Subsystems (3)
lore
Share & tools
lore

Lee Jones

author
#0 lore raw

PATCH 1/1 HID: logitech-hidpp: Prevent use-after-free on force feedback initialisation failure

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

We have 2 options; continue to return the error, but ensure that all of the infrastructure is torn down accordingly or continue to treat this condition as a warning by emitting the message but returning success. It is thought that the original author's intention was to emit the warning but keep the device functional, less the force feedback feature, so let's go with that.

---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index e871f1729d4b..eee9ab6a2fc4 100644
@@ -4487,10 +4487,12 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		if (!ret)
 			ret = hidpp_ff_init(hidpp, &data);
 
-		if (ret)
+		if (ret) {
 			hid_warn(hidpp->hid_dev,
 		     "Unable to initialize force feedback support, errno %d\n",
 				 ret);
+			ret = 0;
+		}
 	}
 
 	/*
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 40 lines · Lee Jones

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

We have 2 options; continue to return the error, but ensure that all of the infrastructure is torn down accordingly or continue to treat this condition as a warning by emitting the message but returning success. It is thought that the original author's intention was to emit the warning but keep the device functional, less the force feedback feature, so let's go with that.

---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index e871f1729d4b..eee9ab6a2fc4 100644
@@ -4487,10 +4487,12 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		if (!ret)
 			ret = hidpp_ff_init(hidpp, &data);
 
-		if (ret)
+		if (ret) {
 			hid_warn(hidpp->hid_dev,
 		     "Unable to initialize force feedback support, errno %d\n",
 				 ret);
+			ret = 0;
+		}
 	}
 
 	/*
Signature · 1 line
2.53.0.473.g4a7958ca14-goog

Thanks for the patch!
—Günther

author
#2 lore raw
Quoted 37 lines · Günther Noack
Quoted 36 lines · Lee Jones

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

We have 2 options; continue to return the error, but ensure that all of the infrastructure is torn down accordingly or continue to treat this condition as a warning by emitting the message but returning success. It is thought that the original author's intention was to emit the warning but keep the device functional, less the force feedback feature, so let's go with that.

---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index e871f1729d4b..eee9ab6a2fc4 100644
@@ -4487,10 +4487,12 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		if (!ret)
 			ret = hidpp_ff_init(hidpp, &data);
 
-		if (ret)
+		if (ret) {
 			hid_warn(hidpp->hid_dev,
 		     "Unable to initialize force feedback support, errno %d\n",
 				 ret);
+			ret = 0;
+		}
 	}
 
Quoted 6 lines
Quoted 4 lines
drivers/hid/hid-logitech-hidpp.c +0 -0
 	/*
Signature · 1 line
2.53.0.473.g4a7958ca14-goog

What are the subsystem preferences in terms of pokes or [RESENDS], please?

I'm happy to submit a [RESEND] if that's required to get this back into view.

Signature · 1 line
Lee Jones [李琼斯]
#3 lore raw
Quoted 39 lines · Lee Jones
Quoted 37 lines · Günther Noack
Quoted 36 lines · Lee Jones

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

We have 2 options; continue to return the error, but ensure that all of the infrastructure is torn down accordingly or continue to treat this condition as a warning by emitting the message but returning success. It is thought that the original author's intention was to emit the warning but keep the device functional, less the force feedback feature, so let's go with that.

---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index e871f1729d4b..eee9ab6a2fc4 100644
@@ -4487,10 +4487,12 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		if (!ret)
 			ret = hidpp_ff_init(hidpp, &data);
 
-		if (ret)
+		if (ret) {
 			hid_warn(hidpp->hid_dev,
 		     "Unable to initialize force feedback support, errno %d\n",
 				 ret);
+			ret = 0;
+		}
 	}
 
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
drivers/hid/hid-logitech-hidpp.c +0 -0
 	/*
Signature · 1 line
2.53.0.473.g4a7958ca14-goog

What are the subsystem preferences in terms of pokes or [RESENDS], please?

Just send a gently ping like this on the thread, this will make it pop up in our mailboxes :)

Quoted 2 lines

I'm happy to submit a [RESEND] if that's required to get this back into view.

Nah, no need to send a [RESEND] when the patch is just a couple of weeks old.

Cheers,
Benjamin

Quoted 4 lines
Signature · 2 lines
-- 
Lee Jones [李琼斯]
author
#4 lore raw
Quoted 49 lines · Benjamin Tissoires
Quoted 39 lines · Lee Jones
Quoted 37 lines · Günther Noack
Quoted 36 lines · Lee Jones

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

We have 2 options; continue to return the error, but ensure that all of the infrastructure is torn down accordingly or continue to treat this condition as a warning by emitting the message but returning success. It is thought that the original author's intention was to emit the warning but keep the device functional, less the force feedback feature, so let's go with that.

---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index e871f1729d4b..eee9ab6a2fc4 100644
@@ -4487,10 +4487,12 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		if (!ret)
 			ret = hidpp_ff_init(hidpp, &data);
 
-		if (ret)
+		if (ret) {
 			hid_warn(hidpp->hid_dev,
 		     "Unable to initialize force feedback support, errno %d\n",
 				 ret);
+			ret = 0;
+		}
 	}
 
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
drivers/hid/hid-logitech-hidpp.c +0 -0
 	/*
Signature · 1 line
2.53.0.473.g4a7958ca14-goog

What are the subsystem preferences in terms of pokes or [RESENDS], please?

Quoted 8 lines

Just send a gently ping like this on the thread, this will make it pop up in our mailboxes :)

Quoted 2 lines

I'm happy to submit a [RESEND] if that's required to get this back into view.

Nah, no need to send a [RESEND] when the patch is just a couple of weeks old.

Understood, thank you.

Signature · 1 line
Lee Jones [李琼斯]
maintainer Applied
#5 lore raw

Re: (subset) [PATCH 1/1] HID: logitech-hidpp: Prevent use-after-free on force feedback initialisation failure

In reply to Lee Jones
Quoted 8 lines · Lee Jones

Presently, if the force feedback initialisation fails when probing the Logitech G920 Driving Force Racing Wheel for Xbox One, an error number will be returned and propagated before the userspace infrastructure (sysfs and /dev/input) has been torn down. If userspace ignores the errors and continues to use its references to these dangling entities, a UAF will promptly follow.

[...]

Applied, thanks!

[1/1] HID: logitech-hidpp: Prevent use-after-free on force feedback initialisation failure

      commit: f7a4c78bfeb320299c1b641500fe7761eadbd101

Best regards,

Signature · 1 line
Benjamin Tissoires <[email protected]>