Step 1: Trigger Condition: An attacker must be able to interact with the mp2650_data_log_write function, likely through a crafted input to the charger IC driver.
Step 2: Parameter Manipulation: The attacker crafts a malicious input, specifically manipulating the len parameter to a value larger than the allocated buffer size within the mp2650_data_log_write function.
Step 3: Buffer Overflow: The mp2650_data_log_write function attempts to write data to the buffer, but due to the unchecked len parameter, it overflows the buffer, overwriting adjacent memory.
Step 4: Code Execution (Exploitation): The attacker leverages the buffer overflow to overwrite critical data structures, such as the return address or function pointers, to redirect program execution to attacker-controlled code (e.g., shellcode) or to modify kernel data structures to gain elevated privileges. This could lead to a complete system compromise.