| Message ID | 20261103213002.1673560-8-lee@kernel.org |
|---|---|
| State | New |
| Headers | show |
| Series | pinctrl: Fix out-of-bounds accesses, divide-by-zero, and error handling | expand |
> The Realtek pinctrl driver uses NA (0xffffffff) as the sentinel for unsupported > pin configuration features. However, RTK_PIN_CONFIG omits > input_volt_offset, slew_rate_offset, and hvil_offset, and > RTK_PIN_CONFIG_V2 omits slew_rate_offset and hvil_offset. Because C99 > designated initialisers zero-initialise omitted members, those fields default to 0 > instead of NA, causing rtd_pconf_parse_conf() to treat unsupported features as > valid at bit offset base_bit + 0 and corrupt adjacent register bits. > > Explicitly initialise the omitted offset fields to NA in RTK_PIN_CONFIG and > RTK_PIN_CONFIG_V2. > > Fixes: dcc9334435b0 ("pinctrl: realtek: add support for slew rate, input voltage > and high VIL") This should be: Fixes: e99ce78030db ("pinctrl: realtek: Add common pinctrl driver for Realtek DHC RTD SoCs") > Fixes: e309dbd523b8 ("pinctrl: realtek: add rtd1625 pinctrl driver") > Closes: > https://sashiko.dev/#/bug/linux-fbd0bf54-6dba-4652-9418-270b11fb6d8b > Cc: stable@vger.kernel.org > Signed-off-by: Lee Jones <lee@kernel.org> Otherwise, looks good to me. Thanks for the fixes. Reviewed-by: Yu-Chun Lin <eleanor.lin@realtek.com> > --- > drivers/pinctrl/realtek/pinctrl-rtd.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.h > b/drivers/pinctrl/realtek/pinctrl-rtd.h > index 77c30ea76443..86db54ea3ce8 100644 > --- a/drivers/pinctrl/realtek/pinctrl-rtd.h > +++ b/drivers/pinctrl/realtek/pinctrl-rtd.h > @@ -96,6 +96,9 @@ struct rtd_pin_reg_list { > .smt_offset = _smt_off, \ > .power_offset = _pow_off, \ > .curr_type = _curr_type, \ > + .input_volt_offset = NA, \ > + .slew_rate_offset = NA, \ > + .hvil_offset = NA, \ > } > > #define RTK_PIN_CONFIG_V2(_name, _reg_off, _base_bit, _pud_en_off, \ > @@ -112,6 +115,8 @@ struct rtd_pin_reg_list { > .power_offset = _pow_off, \ > .input_volt_offset = _input_volt_off, \ > .curr_type = _curr_type, \ > + .slew_rate_offset = NA, \ > + .hvil_offset = NA, \ > } > > #define RTK_PIN_CONFIG_I2C(_name, _reg_off, _base_bit, _pud_en_off, \ > -- > 2.56.0.385.gac671c819a-goog
On Tue, Nov 3, 2026 at 10:31 PM Lee Jones <lee@kernel.org> wrote: > The Realtek pinctrl driver uses NA (0xffffffff) as the sentinel for > unsupported pin configuration features. However, RTK_PIN_CONFIG omits > input_volt_offset, slew_rate_offset, and hvil_offset, and > RTK_PIN_CONFIG_V2 omits slew_rate_offset and hvil_offset. Because C99 > designated initialisers zero-initialise omitted members, those fields > default to 0 instead of NA, causing rtd_pconf_parse_conf() to treat > unsupported features as valid at bit offset base_bit + 0 and corrupt > adjacent register bits. > > Explicitly initialise the omitted offset fields to NA in RTK_PIN_CONFIG > and RTK_PIN_CONFIG_V2. > > Fixes: dcc9334435b0 ("pinctrl: realtek: add support for slew rate, input voltage and high VIL") > Fixes: e309dbd523b8 ("pinctrl: realtek: add rtd1625 pinctrl driver") > Closes: https://sashiko.dev/#/bug/linux-fbd0bf54-6dba-4652-9418-270b11fb6d8b > Cc: stable@vger.kernel.org > Signed-off-by: Lee Jones <lee@kernel.org> This patch 7/10 applied to the pinctrl tree for fixes. Yours, Linus Walleij
> On Tue, Nov 3, 2026 at 10:31 PM Lee Jones <lee@kernel.org> wrote: > > > The Realtek pinctrl driver uses NA (0xffffffff) as the sentinel for > > unsupported pin configuration features. However, RTK_PIN_CONFIG omits > > input_volt_offset, slew_rate_offset, and hvil_offset, and > > RTK_PIN_CONFIG_V2 omits slew_rate_offset and hvil_offset. Because C99 > > designated initialisers zero-initialise omitted members, those fields > > default to 0 instead of NA, causing rtd_pconf_parse_conf() to treat > > unsupported features as valid at bit offset base_bit + 0 and corrupt > > adjacent register bits. > > > > Explicitly initialise the omitted offset fields to NA in > > RTK_PIN_CONFIG and RTK_PIN_CONFIG_V2. > > > > Fixes: dcc9334435b0 ("pinctrl: realtek: add support for slew rate, > > input voltage and high VIL") > > Fixes: e309dbd523b8 ("pinctrl: realtek: add rtd1625 pinctrl driver") > > Closes: > > https://sashiko.dev/#/bug/linux-fbd0bf54-6dba-4652-9418-270b11fb6d8b > > Cc: stable@vger.kernel.org > > Signed-off-by: Lee Jones <lee@kernel.org> > > This patch 7/10 applied to the pinctrl tree for fixes. > > Yours, > Linus Walleij Hi Linus, Thanks for applying this patch. Just a quick heads-up on the merged commit [1]: 1. The first Fixes tag kept the original 'dcc9334435b0' instead of the corrected 'e99ce78030db' I suggested. 2. Branch: It was applied to 'for-next' instead of 'fixes'. Just checking if this was intended. [1] https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=0e62a6aadef5bf93a379ac7aa9a89f43596f83e4 Best regards, Yu-Chun
On Fri, Nov 6, 2026 at 3:49 AM Yu-Chun Lin [林祐君] <eleanor.lin@realtek.com> wrote: > Thanks for applying this patch. Just a quick heads-up on the merged commit [1]: > > 1. The first Fixes tag kept the original 'dcc9334435b0' instead of the corrected > 'e99ce78030db' I suggested. I went in and fixed it up. > 2. Branch: It was applied to 'for-next' instead of 'fixes'. Just checking if > this was intended. Yes Lee reached out to me on IRC and asked that the paches be queued for-next as nonurgent fixes. Yours, Linus Walleij
diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.h b/drivers/pinctrl/realtek/pinctrl-rtd.h index 77c30ea76443..86db54ea3ce8 100644 --- a/drivers/pinctrl/realtek/pinctrl-rtd.h +++ b/drivers/pinctrl/realtek/pinctrl-rtd.h @@ -96,6 +96,9 @@ struct rtd_pin_reg_list { .smt_offset = _smt_off, \ .power_offset = _pow_off, \ .curr_type = _curr_type, \ + .input_volt_offset = NA, \ + .slew_rate_offset = NA, \ + .hvil_offset = NA, \ } #define RTK_PIN_CONFIG_V2(_name, _reg_off, _base_bit, _pud_en_off, \ @@ -112,6 +115,8 @@ struct rtd_pin_reg_list { .power_offset = _pow_off, \ .input_volt_offset = _input_volt_off, \ .curr_type = _curr_type, \ + .slew_rate_offset = NA, \ + .hvil_offset = NA, \ } #define RTK_PIN_CONFIG_I2C(_name, _reg_off, _base_bit, _pud_en_off, \
The Realtek pinctrl driver uses NA (0xffffffff) as the sentinel for unsupported pin configuration features. However, RTK_PIN_CONFIG omits input_volt_offset, slew_rate_offset, and hvil_offset, and RTK_PIN_CONFIG_V2 omits slew_rate_offset and hvil_offset. Because C99 designated initialisers zero-initialise omitted members, those fields default to 0 instead of NA, causing rtd_pconf_parse_conf() to treat unsupported features as valid at bit offset base_bit + 0 and corrupt adjacent register bits. Explicitly initialise the omitted offset fields to NA in RTK_PIN_CONFIG and RTK_PIN_CONFIG_V2. Fixes: dcc9334435b0 ("pinctrl: realtek: add support for slew rate, input voltage and high VIL") Fixes: e309dbd523b8 ("pinctrl: realtek: add rtd1625 pinctrl driver") Closes: https://sashiko.dev/#/bug/linux-fbd0bf54-6dba-4652-9418-270b11fb6d8b Cc: stable@vger.kernel.org Signed-off-by: Lee Jones <lee@kernel.org> --- drivers/pinctrl/realtek/pinctrl-rtd.h | 5 +++++ 1 file changed, 5 insertions(+)