e1000e: Fix possible overflow in LTR decoding
Subsystems (2)
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
When we decode the latency and the max_latency u16 value does not fill the required size and could lead to the wrong LTR representation. Replace the u16 type with the u32 type and allow corrected LTR representation.
---
v2: added link tag
drivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +2 -2
@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) {u32 reg = link << (E1000_LTRV_REQ_SHIFT +E1000_LTRV_NOSNOOP_SHIFT ) | link <<E1000_LTRV_REQ_SHIFT |E1000_LTRV_SEND ; -u16 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ -u16 lat_enc_d =0 ;/* latency decoded */ +u32 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ +u32 lat_enc_d =0 ;/* latency decoded */ u16 lat_enc =0 ;/* latency encoded */ if (link) {
Signature · 1 line
2.30.2
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
Quoted 10 lines · Sasha Neftin
When we decode the latency and the
max_latencyu16 value does not fill the required size and could lead to the wrong LTR representation. Replace the u16 type with the u32 type and allow corrected LTR representation.Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for 10M")Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>
Quoted 5 lines
---
v2: added link tagdrivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
In reply to Sasha NeftinDear Sasha,
Thank you for your patch.
Am 05.04.22 um 17:56 schrieb Sasha Neftin:
Quoted 2 lines
When we decode the latency and the
max_latencyu16 value does not fill the required size
Do you mean ?fit into? or ?is too small for the required size??
Quoted 1 line
and could lead to the wrong LTR representation.
Maybe give an example of values leading to incorrect behavior?
Quoted 2 lines
Replace the u16 type with the u32 type and allow corrected LTR representation.
Maybe: Increase the variable size from u16 to u32, so the decoded latency can be represented. Why are 32 bit enough? Why not 64 bit?
Please use 75 characters per line.
Quoted 5 lines
Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for 10M")Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>
Add
30))
Quoted 11 lines
---
v2: added link tagdrivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/ich8lan.c +0
-0
drivers/net/ethernet/intel/e1000e/ich8lan.c static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) · line 1016
Quoted 10 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +2
-2@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) {u32 reg = link << (E1000_LTRV_REQ_SHIFT +E1000_LTRV_NOSNOOP_SHIFT ) | link <<E1000_LTRV_REQ_SHIFT |E1000_LTRV_SEND ; -u16 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ -u16 lat_enc_d =0 ;/* latency decoded */ +u32 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ +u32 lat_enc_d =0 ;/* latency decoded */ u16 lat_enc =0 ;/* latency encoded */ if (link) {
The diff looks good.
Kind regards,
Paul
Neftin
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
Quoted 13 lines · Paul Menzel
Dear Sasha,
Thank you for your patch.
Am 05.04.22 um 17:56 schrieb Sasha Neftin:
Quoted 2 lines
When we decode the latency and the
max_latencyu16 value does not fill the required sizeDo you mean ?fit into? or ?is too small for the required size??
Quoted 1 line
and could lead to the wrong LTR representation.
Quoted 7 lines
Maybe give an example of values leading to incorrect behavior?
Quoted 2 lines
Replace the u16 type with the u32 type and allow corrected LTR representation.
Maybe: Increase the variable size from u16 to u32, so the decoded latency can be represented. Why are 32 bit enough? Why not 64 bit?
Hello Paul,
Scaling represented as:
scale 0 - 1 (2^(5*0)) = 2^0 scale 1 - 32 (2^(5 *1))= 2^5 scale 2 - 1024 (2^(5 *2)) =2^10 scale 3 - 32768 (2^(5 *3)) =2^15 scale 4 ? 1048576 (2^(5 *4)) = 2^20 scale 5 ? 33554432 (2^(5 *4)) = 2^25
scale 4 and scale 5 required 20 and 25 bits respectively. scale 6 reserved.
Quoted 10 lines
Please use 75 characters per line.
Quoted 6 lines
Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for10M")
Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>
Quoted 4 lines
Add
30))
I will let James add this tag.
Quoted 18 lines
Quoted 18 lines
---
v2: added link tag?
drivers/net/ethernet/intel/e1000e/ich8lan.c| 4 ++-- ? 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/ich8lan.c +0
-0@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) ? {????? u32 reg = link << (
E1000_LTRV_REQ_SHIFT+E1000_LTRV_NOSNOOP_SHIFT) |
????????? link <<E1000_LTRV_REQ_SHIFT|E1000_LTRV_SEND;
Quoted 8 lines
Quoted 6 lines
-??? u16
max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ -??? u16lat_enc_d= 0;??? /* latency decoded */
+??? u32max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ +??? u32lat_enc_d= 0;??? /* latency decoded */
????? u16lat_enc= 0;??? /* latency encoded */
????? if (link) {The diff looks good.
Thanks
Quoted 5 lines
Kind regards,
Paul
Sasha
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
Quoted 73 lines · Sasha,
Quoted 13 lines · Paul Menzel
Dear Sasha,
Thank you for your patch.
Am 05.04.22 um 17:56 schrieb Sasha Neftin:
Quoted 2 lines
When we decode the latency and the
max_latencyu16 value does not fill the required sizeDo you mean ?fit into? or ?is too small for the required size??
Quoted 1 line
and could lead to the wrong LTR representation.
Quoted 7 lines
Maybe give an example of values leading to incorrect behavior?
Quoted 2 lines
Replace the u16 type with the u32 type and allow corrected LTR representation.
Maybe: Increase the variable size from u16 to u32, so the decoded latency can be represented. Why are 32 bit enough? Why not 64 bit?
Hello Paul,
Scaling represented as:scale 0 - 1 (2^(5*0)) = 2^0 scale 1 - 32 (2^(5 *1))= 2^5 scale 2 - 1024 (2^(5 *2)) =2^10 scale 3 - 32768 (2^(5 *3)) =2^15 scale 4 ? 1048576 (2^(5 *4)) = 2^20 scale 5 ? 33554432 (2^(5 *4)) = 2^25scale 4 and scale 5 required 20 and 25 bits respectively. scale 6 reserved.
Quoted 10 lines
Please use 75 characters per line.
Quoted 6 lines
Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for10M")
Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>Quoted 3 lines
Add
(rev
Quoted 1 line
30))
I will let James add this tag.
Quoted 18 lines
Quoted 18 lines
---
v2: added link tagdrivers/net/ethernet/intel/e1000e/ich8lan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/ich8lan.c +0
-0@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) { u32 reg = link << (E1000_LTRV_REQ_SHIFT +
E1000_LTRV_NOSNOOP_SHIFT) |link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND;Quoted 8 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) · line 1016
Quoted 6 lines
drivers/net/ethernet/intel/e1000e/ich8lan.c +2
-2-u16 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ -u16 lat_enc_d =0 ;/* latency decoded */ +u32 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ +u32 lat_enc_d =0 ;/* latency decoded */ u16 lat_enc =0 ;/* latency encoded */ if (link) {The diff looks good.
Quoted 8 lines
Thanks
Quoted 5 lines
Kind regards,
Paul
Sasha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20220406/0bda17e6/attachment-0001.html>
PATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
In reply to NeftinDear Sasha, dear Tony,
Am 06.04.22 um 16:33 schrieb Neftin, Sasha:
Quoted 9 lines · Paul Menzel
Quoted 8 lines
Thank you for your patch.
Am 05.04.22 um 17:56 schrieb Sasha Neftin:
Quoted 2 lines
When we decode the latency and the
max_latencyu16 value does not fill the required sizeDo you mean ?fit into? or ?is too small for the required size??
Tony, I saw you committed this patch [1]. Is it still possible to fix the wording?
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
and could lead to the wrong LTR representation.
Maybe give an example of values leading to incorrect behavior?
Quoted 2 lines
Replace the u16 type with the u32 type and allow corrected LTR representation.
Maybe: Increase the variable size from u16 to u32, so the decoded latency can be represented. Why are 32 bit enough? Why not 64 bit?
Quoted 10 lines
Hello Paul,
Scaling represented as:
scale 0 - 1???????? (2^(5*0)) = 2^0
scale 1 - 32??????? (2^(5 *1))= 2^5
scale 2 - 1024????? (2^(5 *2)) =2^10
scale 3 - 32768???? (2^(5 *3)) =2^15
scale 4 ? 1048576?? (2^(5 *4)) = 2^20
scale 5 ? 33554432? (2^(5 *4)) = 2^25
scale 4 and scale 5 required 20 and 25 bits respectively. scale 6 reserved.
This would have been nice in the commit message.
Quoted 38 lines
Quoted 9 lines
Please use 75 characters per line.
Quoted 6 lines
Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latency for10M")
Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>Quoted 3 lines
Add
I will let James add this tag.
Quoted 17 lines
Quoted 17 lines
---
v2: added link tag?
drivers/net/ethernet/intel/e1000e/ich8lan.c| 4 ++-- ? 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/ich8lan.c +0
-0@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) ? {????? u32 reg = link << (
E1000_LTRV_REQ_SHIFT+E1000_LTRV_NOSNOOP_SHIFT) | ????????? link <<E1000_LTRV_REQ_SHIFT|E1000_LTRV_SEND;Quoted 8 lines
Quoted 6 lines
-??? u16
max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ -??? u16lat_enc_d= 0;??? /* latency decoded */
+??? u32max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ +??? u32lat_enc_d= 0;??? /* latency decoded */
????? u16lat_enc= 0;??? /* latency encoded */
????? if (link) {The diff looks good.
Quoted 1 line
Thanks
Kind regards,
Paul
Tony Nguyen
maintainerPATCH v2 1/1 e1000e: Fix possible overflow in LTR decoding
Quoted 8 lines · Paul Menzel
Dear Sasha, dear Tony,
Am 06.04.22 um 16:33 schrieb Neftin, Sasha:
Quoted 4 lines · Paul Menzel
Quoted 3 lines
Thank you for your patch.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Am 05.04.22 um 17:56 schrieb Sasha Neftin:
Quoted 2 lines
When we decode the latency and the
max_latencyu16 value does not fill the required sizeDo you mean ?fit into? or ?is too small for the required size??
Tony, I saw you committed this patch [1]. Is it still possible to fix the wording?
Yes, it can still be changed. I'll check with Sasha on any edits he wants to make before sending on to netdev.
Thanks,
Tony
Quoted 73 lines
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
and could lead to the wrong LTR representation.
Maybe give an example of values leading to incorrect behavior?
Quoted 2 lines
Replace the u16 type with the u32 type and allow corrected LTR representation.
Maybe: Increase the variable size from u16 to u32, so the decoded latency can be represented. Why are 32 bit enough? Why not 64 bit?
Quoted 10 lines
Hello Paul,
Scaling represented as:
scale 0 - 1???????? (2^(5*0)) = 2^0
scale 1 - 32??????? (2^(5 *1))= 2^5
scale 2 - 1024????? (2^(5 *2)) =2^10
scale 3 - 32768???? (2^(5 *3)) =2^15
scale 4 ? 1048576?? (2^(5 *4)) = 2^20
scale 5 ? 33554432? (2^(5 *4)) = 2^25
scale 4 and scale 5 required 20 and 25 bits respectively. scale 6 reserved.This would have been nice in the commit message.
Quoted 40 lines
Quoted 9 lines
Please use 75 characters per line.
Quoted 6 lines
Fixes 44a13a5d99c7 ("e1000e: Fix the max snoop/no-snoop latencyfor 10M")
Reported-by James Hutchinson <[email protected]>Suggested-by Dima Ruinskiy <[email protected]>Signed-off-by Sasha Neftin <[email protected]>Quoted 4 lines
Add
(rev 30))
I will let James add this tag.
Quoted 18 lines
Quoted 18 lines
---
v2: added link tag?
drivers/net/ethernet/intel/e1000e/ich8lan.c| 4 ++-- ? 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/e1000e/ich8lan.c +0
-0@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) ? {????? u32 reg = link << (
E1000_LTRV_REQ_SHIFT+E1000_LTRV_NOSNOOP_SHIFT) |
????????? link <<E1000_LTRV_REQ_SHIFT|E1000_LTRV_SEND;Quoted 8 lines
Quoted 6 lines
-??? u16
max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ -??? u16lat_enc_d= 0;??? /* latency decoded */
+??? u32max_ltr_enc_d= 0;??? /* maximum LTR decoded by platform */ +??? u32lat_enc_d= 0;??? /* latency decoded */
????? u16lat_enc= 0;??? /* latency encoded */
????? if (link) {The diff looks good.
Quoted 1 line
Thanks
Kind regards,
Paul