* [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability
@ 2026-06-19 16:31 madhu.m
2026-06-20 5:10 ` Greg KH
2026-06-23 0:32 ` [PATCH v3] " madhu.m
0 siblings, 2 replies; 4+ messages in thread
From: madhu.m @ 2026-06-19 16:31 UTC (permalink / raw)
To: gregkh; +Cc: heikki.krogerus, akuchynski, linux-usb, linux-kernel, Madhu M
From: Madhu M <madhu.m@intel.com>
Some docks/Type-C dongles expose a malformed DP Capabilities VDO: they
claim a DFP_D (source) or UFP_D (sink) capability but leave the
corresponding pin assignment field empty. Such a device can never have
Alt Mode configured. Currently the driver still proceeds, which is
misleading and offers no diagnostic.
Per VESA DPAM v2.1a Section 5.4.1 (Table 5-6):
Case 1 (receptacle): A DP Source device receptacle (DFP_D) declares its
lane routing in the DP Source Pin field (Bits 15:8); a DP Sink device
receptacle (UFP_D) declares its lanes in the DP Sink Pin field
(Bits 23:16).
Case 2 (direct-attach plug): A DP Sink device plug (UFP_D) declares its
lane routing in the DP Source Pin field (Bits 15:8), and a DP Source
device plug (DFP_D) declares its lanes in the DP Sink Pin field
(Bits 23:16).
In either case the field holds the supported pin assignment values
(e.g. C/D/E); 00000000b means no pin assignment is supported for that
capability.
Reject such a DP Alt Mode VDO in dp_altmode_probe(): if the claimed
capability has no matching pin assignments, fail probe with -ENODEV,
releasing the SOP' plug reference on the error path.
Signed-off-by: Madhu M <madhu.m@intel.com>
Reviewed-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
drivers/usb/typec/altmodes/displayport.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 263a89c5f324..2a553cfcf61d 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -764,6 +764,7 @@ int dp_altmode_probe(struct typec_altmode *alt)
struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
struct fwnode_handle *fwnode;
struct dp_altmode *dp;
+ u32 cap = DP_CAP_CAPABILITY(alt->vdo);
/* Port can only be DFP_U. */
if (typec_altmode_get_data_role(alt) != TYPEC_HOST)
@@ -778,6 +779,18 @@ int dp_altmode_probe(struct typec_altmode *alt)
return -ENODEV;
}
+ /*
+ * Make sure the DisplayPort VDO is valid (VESA DPAM v2.1a, Section
+ * 5.4.1, Table 5-6, DP Capabilities VDO). A device exposing DP on a
+ * USB-C receptacle must advertise at least one pin assignment for the
+ * capability it claims, otherwise Alt Mode can never be configured.
+ */
+ if ((cap == DP_CAP_DFP_D && !DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)) ||
+ (cap == DP_CAP_UFP_D && !DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo))) {
+ typec_altmode_put_plug(plug);
+ return -ENODEV;
+ }
+
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
if (!dp) {
typec_altmode_put_plug(plug);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability
2026-06-19 16:31 [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability madhu.m
@ 2026-06-20 5:10 ` Greg KH
2026-06-20 15:53 ` M, Madhu
2026-06-23 0:32 ` [PATCH v3] " madhu.m
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-06-20 5:10 UTC (permalink / raw)
To: madhu.m; +Cc: heikki.krogerus, akuchynski, linux-usb, linux-kernel
On Fri, Jun 19, 2026 at 10:01:09PM +0530, madhu.m@intel.com wrote:
> From: Madhu M <madhu.m@intel.com>
>
> Some docks/Type-C dongles expose a malformed DP Capabilities VDO: they
> claim a DFP_D (source) or UFP_D (sink) capability but leave the
> corresponding pin assignment field empty. Such a device can never have
> Alt Mode configured. Currently the driver still proceeds, which is
> misleading and offers no diagnostic.
>
> Per VESA DPAM v2.1a Section 5.4.1 (Table 5-6):
> Case 1 (receptacle): A DP Source device receptacle (DFP_D) declares its
> lane routing in the DP Source Pin field (Bits 15:8); a DP Sink device
> receptacle (UFP_D) declares its lanes in the DP Sink Pin field
> (Bits 23:16).
> Case 2 (direct-attach plug): A DP Sink device plug (UFP_D) declares its
> lane routing in the DP Source Pin field (Bits 15:8), and a DP Source
> device plug (DFP_D) declares its lanes in the DP Sink Pin field
> (Bits 23:16).
> In either case the field holds the supported pin assignment values
> (e.g. C/D/E); 00000000b means no pin assignment is supported for that
> capability.
>
> Reject such a DP Alt Mode VDO in dp_altmode_probe(): if the claimed
> capability has no matching pin assignments, fail probe with -ENODEV,
> releasing the SOP' plug reference on the error path.
>
> Signed-off-by: Madhu M <madhu.m@intel.com>
> Reviewed-by: Andrei Kuchynski <akuchynski@chromium.org>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/altmodes/displayport.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 263a89c5f324..2a553cfcf61d 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -764,6 +764,7 @@ int dp_altmode_probe(struct typec_altmode *alt)
> struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
> struct fwnode_handle *fwnode;
> struct dp_altmode *dp;
> + u32 cap = DP_CAP_CAPABILITY(alt->vdo);
>
> /* Port can only be DFP_U. */
> if (typec_altmode_get_data_role(alt) != TYPEC_HOST)
> @@ -778,6 +779,18 @@ int dp_altmode_probe(struct typec_altmode *alt)
> return -ENODEV;
> }
>
> + /*
> + * Make sure the DisplayPort VDO is valid (VESA DPAM v2.1a, Section
> + * 5.4.1, Table 5-6, DP Capabilities VDO). A device exposing DP on a
> + * USB-C receptacle must advertise at least one pin assignment for the
> + * capability it claims, otherwise Alt Mode can never be configured.
> + */
> + if ((cap == DP_CAP_DFP_D && !DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)) ||
> + (cap == DP_CAP_UFP_D && !DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo))) {
> + typec_altmode_put_plug(plug);
> + return -ENODEV;
> + }
> +
> dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
> if (!dp) {
> typec_altmode_put_plug(plug);
> --
> 2.34.1
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability
2026-06-20 5:10 ` Greg KH
@ 2026-06-20 15:53 ` M, Madhu
0 siblings, 0 replies; 4+ messages in thread
From: M, Madhu @ 2026-06-20 15:53 UTC (permalink / raw)
To: Greg KH; +Cc: heikki.krogerus, akuchynski, linux-usb, linux-kernel
Hi Greg,
Thanks for catching this. You're right that the changelog below the ---
line was missing.
For context: v1 was an internal review (with Heikki) and was never posted
to the list, so this v2 is effectively the first public submission - that's
why there was no prior version on lore to diff against.
I'll resend as v3 with a proper "Changes" section below the --- line
(per Documentation/process/submitting-patches.rst, "The canonical patch
format") summarizing what changed since the internal v1.
Sorry for the noise.
Thanks,
Madhu M
-----Original Message-----
From: Greg KH <gregkh@linuxfoundation.org>
Sent: 20 June 2026 10:41
To: M, Madhu <madhu.m@intel.com>
Cc: heikki.krogerus@linux.intel.com; akuchynski@chromium.org; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability
On Fri, Jun 19, 2026 at 10:01:09PM +0530, madhu.m@intel.com wrote:
> From: Madhu M <madhu.m@intel.com>
>
> Some docks/Type-C dongles expose a malformed DP Capabilities VDO: they
> claim a DFP_D (source) or UFP_D (sink) capability but leave the
> corresponding pin assignment field empty. Such a device can never have
> Alt Mode configured. Currently the driver still proceeds, which is
> misleading and offers no diagnostic.
>
> Per VESA DPAM v2.1a Section 5.4.1 (Table 5-6):
> Case 1 (receptacle): A DP Source device receptacle (DFP_D) declares
> its lane routing in the DP Source Pin field (Bits 15:8); a DP Sink
> device receptacle (UFP_D) declares its lanes in the DP Sink Pin field
> (Bits 23:16).
> Case 2 (direct-attach plug): A DP Sink device plug (UFP_D) declares
> its lane routing in the DP Source Pin field (Bits 15:8), and a DP
> Source device plug (DFP_D) declares its lanes in the DP Sink Pin field
> (Bits 23:16).
> In either case the field holds the supported pin assignment values
> (e.g. C/D/E); 00000000b means no pin assignment is supported for that
> capability.
>
> Reject such a DP Alt Mode VDO in dp_altmode_probe(): if the claimed
> capability has no matching pin assignments, fail probe with -ENODEV,
> releasing the SOP' plug reference on the error path.
>
> Signed-off-by: Madhu M <madhu.m@intel.com>
> Reviewed-by: Andrei Kuchynski <akuchynski@chromium.org>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/altmodes/displayport.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/usb/typec/altmodes/displayport.c
> b/drivers/usb/typec/altmodes/displayport.c
> index 263a89c5f324..2a553cfcf61d 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -764,6 +764,7 @@ int dp_altmode_probe(struct typec_altmode *alt)
> struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
> struct fwnode_handle *fwnode;
> struct dp_altmode *dp;
> + u32 cap = DP_CAP_CAPABILITY(alt->vdo);
>
> /* Port can only be DFP_U. */
> if (typec_altmode_get_data_role(alt) != TYPEC_HOST) @@ -778,6
> +779,18 @@ int dp_altmode_probe(struct typec_altmode *alt)
> return -ENODEV;
> }
>
> + /*
> + * Make sure the DisplayPort VDO is valid (VESA DPAM v2.1a, Section
> + * 5.4.1, Table 5-6, DP Capabilities VDO). A device exposing DP on a
> + * USB-C receptacle must advertise at least one pin assignment for the
> + * capability it claims, otherwise Alt Mode can never be configured.
> + */
> + if ((cap == DP_CAP_DFP_D && !DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)) ||
> + (cap == DP_CAP_UFP_D && !DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo))) {
> + typec_altmode_put_plug(plug);
> + return -ENODEV;
> + }
> +
> dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
> if (!dp) {
> typec_altmode_put_plug(plug);
> --
> 2.34.1
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability
2026-06-19 16:31 [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability madhu.m
2026-06-20 5:10 ` Greg KH
@ 2026-06-23 0:32 ` madhu.m
1 sibling, 0 replies; 4+ messages in thread
From: madhu.m @ 2026-06-23 0:32 UTC (permalink / raw)
To: gregkh; +Cc: heikki.krogerus, akuchynski, linux-usb, linux-kernel, Madhu M
From: Madhu M <madhu.m@intel.com>
Some docks/Type-C dongles expose a malformed DP Capabilities VDO: they
claim a DFP_D (source) or UFP_D (sink) capability but leave the
corresponding pin assignment field empty. Such a device can never have
Alt Mode configured. Currently the driver still proceeds, which is
misleading and offers no diagnostic.
Per VESA DPAM v2.1a Section 5.4.1 (Table 5-6):
Case 1 (receptacle): A DP Source device receptacle (DFP_D) declares its
lane routing in the DP Source Pin field (Bits 15:8); a DP Sink device
receptacle (UFP_D) declares its lanes in the DP Sink Pin field
(Bits 23:16).
Case 2 (direct-attach plug): A DP Sink device plug (UFP_D) declares its
lane routing in the DP Source Pin field (Bits 15:8), and a DP Source
device plug (DFP_D) declares its lanes in the DP Sink Pin field
(Bits 23:16).
In either case the field holds the supported pin assignment values
(e.g. C/D/E); 00000000b means no pin assignment is supported for that
capability.
Reject such a DP Alt Mode VDO in dp_altmode_probe(): if the claimed
capability has no matching pin assignments, fail probe with -ENODEV,
releasing the SOP' plug reference on the error path.
Signed-off-by: Madhu M <madhu.m@intel.com>
Reviewed-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
Changes in v3:
- No functional change. Restore the version changelog below the --- line.
Note: v1 was an internal review (with Heikki) and was never posted to the
list, so v2 was effectively the first public submission.
Changes in v2 (vs internal v1):
- Drop the explicit "if (alt->vdo & DP_CAP_RECEPTACLE)" guard and the
nested block. Use the receptacle-aware DP_CAP_PIN_ASSIGN_DFP_D()/
DP_CAP_PIN_ASSIGN_UFP_D() macros instead of the raw
DP_CAP_DFP_D_PIN_ASSIGN()/DP_CAP_UFP_D_PIN_ASSIGN() ones. They already
apply the Bit 6 (Receptacle Indication) swap, so a single check now
covers both receptacles and direct-attach plugs.
- Return -ENODEV instead of -EOPNOTSUPP, matching the existing
pin-configuration rejection path right above.
- Drop the dev_err() diagnostic line (raw VDO + "DFP_D"/"UFP_D" string).
- Hoist "cap" to a function-scope u32 at the top of dp_altmode_probe()
(was a local u8 inside the receptacle block).
- Reword subject: "usb: typec: altmodes/displayport: validate dp pin
assignments for USB-C receptacles" -> "usb: typec: displayport: Reject
DP Alt Mode VDO with no pin assignment for its capability".
- Rewrite commit body: describe the VESA Table 5-6 pin-field routing for
both receptacles and direct-attach plugs (including the 00000000b
"not supported" encoding).
drivers/usb/typec/altmodes/displayport.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 263a89c5f324..2a553cfcf61d 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -764,6 +764,7 @@ int dp_altmode_probe(struct typec_altmode *alt)
struct typec_altmode *plug = typec_altmode_get_plug(alt, TYPEC_PLUG_SOP_P);
struct fwnode_handle *fwnode;
struct dp_altmode *dp;
+ u32 cap = DP_CAP_CAPABILITY(alt->vdo);
/* Port can only be DFP_U. */
if (typec_altmode_get_data_role(alt) != TYPEC_HOST)
@@ -778,6 +779,18 @@ int dp_altmode_probe(struct typec_altmode *alt)
return -ENODEV;
}
+ /*
+ * Make sure the DisplayPort VDO is valid (VESA DPAM v2.1a, Section
+ * 5.4.1, Table 5-6, DP Capabilities VDO). A device exposing DP on a
+ * USB-C receptacle must advertise at least one pin assignment for the
+ * capability it claims, otherwise Alt Mode can never be configured.
+ */
+ if ((cap == DP_CAP_DFP_D && !DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)) ||
+ (cap == DP_CAP_UFP_D && !DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo))) {
+ typec_altmode_put_plug(plug);
+ return -ENODEV;
+ }
+
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
if (!dp) {
typec_altmode_put_plug(plug);
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-23 0:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-19 16:31 [PATCH v2] usb: typec: displayport: Reject DP Alt Mode VDO with no pin assignment for its capability madhu.m
2026-06-20 5:10 ` Greg KH
2026-06-20 15:53 ` M, Madhu
2026-06-23 0:32 ` [PATCH v3] " madhu.m
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox