Skip to content

Commit 6e56a6d

Browse files
kmaincentPaolo Abeni
authored andcommitted
net: pse-pd: Add power limit check
Checking only the current limit is not sufficient. According to the standard, voltage can reach up to 57V and current up to 1.92A, which exceeds the power limit described in the standard (99.9W). Add a power limit check to prevent this. Acked-by: Oleksij Rempel <[email protected]> Signed-off-by: Kory Maincent <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 675d0e3 commit 6e56a6d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/net/pse-pd/pse_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,9 @@ int pse_ethtool_set_pw_limit(struct pse_control *psec,
877877
int uV, uA, ret;
878878
s64 tmp_64;
879879

880+
if (pw_limit > MAX_PI_PW)
881+
return -ERANGE;
882+
880883
ret = regulator_get_voltage(psec->ps);
881884
if (!ret) {
882885
NL_SET_ERR_MSG(extack,

include/linux/pse-pd/pse.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
/* Maximum current in uA according to IEEE 802.3-2022 Table 145-1 */
1313
#define MAX_PI_CURRENT 1920000
14+
/* Maximum power in mW according to IEEE 802.3-2022 Table 145-16 */
15+
#define MAX_PI_PW 99900
1416

1517
struct phy_device;
1618
struct pse_controller_dev;

0 commit comments

Comments
 (0)