On 11/30/26 4:49 AM, Andrew Lunn wrote:
> On Mon, Nov 30, 2026 at 02:55:13AM +0200, Cristian Ciocaltea wrote:
>> aeon_ipc_send_msg() intends to skip reading the IPC reply when the
>> caller passes no buffer for it, but the check tests the input buffer
>> (data) rather than the output buffer (ret_data).
>
> The comment at the beginning of the function is also wrong:
>
> /* If data is NULL, return 0 or negative error.
> * If data not NULL, return number of Bytes received from IPC or
> * a negative error.
> */
> static int aeon_ipc_send_msg(struct phy_device *phydev,
> u16 opcode, u16 *data, unsigned int data_len,
> u16 *ret_data)
> {
>
>
> Maybe a later patch fixes that?
Sure, I somehow missed to correct it.
>> A caller supplying
>> a payload but a NULL ret_data would have the reply written through a
>> NULL pointer.
>>
>> Check ret_data before copying the reply. While at it, validate the
>> input buffer at function entry, rejecting a NULL data pointer with a
>> non-zero data_len.
>
> I would actually let this explode. The oops makes it clear where the
> bug is, returning EINVAL will be harder to correct, there is already
> three of them in this function.
Ok, I'll drop the 'data_len && !data' check and just keep the '!ret_data' one.
>> Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")
>> Signed-off-by: Cristian Ciocaltea <cris…@collabora.com>
>
> This is purely about validation of the passed parameters, that the
> validation is not strictly correct. As far as i see, nothing in the
> happy days case is actually broken? So this should go via net-next.
Indeed, let's move this to the next series.
Thanks,
Cristian