drivers/dpll/dpll_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Since the driver is broken in the case that src->freq_supported is not
NULL but src->freq_supported_num is 0, add an assertion for it.
Fixes: 830ead5fb0c5 ("dpll: fix pin dump crash for rebound module")
Cc: <stable@vger.kernel.org> # v6.8+
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
Changelog:
v1 -> v2:
1. Replace the check with an assertion.
---
drivers/dpll/dpll_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 32019dc33cca..3296776c1ebb 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -443,8 +443,9 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)
static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
struct dpll_pin_properties *dst)
{
+ BUG_ON(src->freq_supported && !src->freq_supported_num);
memcpy(dst, src, sizeof(*dst));
- if (src->freq_supported && src->freq_supported_num) {
+ if (src->freq_supported) {
size_t freq_size = src->freq_supported_num *
sizeof(*src->freq_supported);
dst->freq_supported = kmemdup(src->freq_supported,
--
2.25.1
Wed, Feb 26, 2025 at 04:09:30AM +0100, jiashengjiangcool@gmail.com wrote:
>Since the driver is broken in the case that src->freq_supported is not
>NULL but src->freq_supported_num is 0, add an assertion for it.
>
>Fixes: 830ead5fb0c5 ("dpll: fix pin dump crash for rebound module")
It's not a real bug in current kernel. I don't think it's worth "fixes"
line and -net tree. I think it should be just sent to -net-next.
>Cc: <stable@vger.kernel.org> # v6.8+
>Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
>---
>Changelog:
>
>v1 -> v2:
>
>1. Replace the check with an assertion.
>---
> drivers/dpll/dpll_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
>index 32019dc33cca..3296776c1ebb 100644
>--- a/drivers/dpll/dpll_core.c
>+++ b/drivers/dpll/dpll_core.c
>@@ -443,8 +443,9 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)
> static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
> struct dpll_pin_properties *dst)
> {
>+ BUG_ON(src->freq_supported && !src->freq_supported_num);
Warnon-return please.
> memcpy(dst, src, sizeof(*dst));
>- if (src->freq_supported && src->freq_supported_num) {
>+ if (src->freq_supported) {
> size_t freq_size = src->freq_supported_num *
> sizeof(*src->freq_supported);
> dst->freq_supported = kmemdup(src->freq_supported,
>--
>2.25.1
>
Since the driver is broken in the case that src->freq_supported is not
NULL but src->freq_supported_num is 0, add an assertion for it.
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
Changelog:
v2 -> v3:
1. Add "net-next" to the subject.
2. Remove the "Fixes" tag and "Cc: stable".
3. Replace BUG_ON with WARN_ON.
v1 -> v2:
1. Replace the check with an assertion.
---
drivers/dpll/dpll_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 32019dc33cca..0927eddbd417 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -443,8 +443,9 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)
static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
struct dpll_pin_properties *dst)
{
+ WARN_ON(src->freq_supported && !src->freq_supported_num);
memcpy(dst, src, sizeof(*dst));
- if (src->freq_supported && src->freq_supported_num) {
+ if (src->freq_supported) {
size_t freq_size = src->freq_supported_num *
sizeof(*src->freq_supported);
dst->freq_supported = kmemdup(src->freq_supported,
--
2.25.1
On 2/26/25 20:37, Jiasheng Jiang wrote:
> Since the driver is broken in the case that src->freq_supported is not
> NULL but src->freq_supported_num is 0, add an assertion for it.
>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
> Changelog:
>
> v2 -> v3:
please post next revision as a separate thread instead of
in-reply-to the previous one
please also do wait a minimum of 24h prior to submitting a new
revision
>
> 1. Add "net-next" to the subject.
> 2. Remove the "Fixes" tag and "Cc: stable".
> 3. Replace BUG_ON with WARN_ON.
>
> v1 -> v2:
>
> 1. Replace the check with an assertion.
> ---
> drivers/dpll/dpll_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
> index 32019dc33cca..0927eddbd417 100644
> --- a/drivers/dpll/dpll_core.c
> +++ b/drivers/dpll/dpll_core.c
> @@ -443,8 +443,9 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)
> static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
> struct dpll_pin_properties *dst)
> {
> + WARN_ON(src->freq_supported && !src->freq_supported_num);
Jiri has asked for an early return too
> memcpy(dst, src, sizeof(*dst));
> - if (src->freq_supported && src->freq_supported_num) {
> + if (src->freq_supported) {
> size_t freq_size = src->freq_supported_num *
> sizeof(*src->freq_supported);
> dst->freq_supported = kmemdup(src->freq_supported,
© 2016 - 2025 Red Hat, Inc.