[dpdk-dev] [dpdk-stable] [PATCH] net/ixgbe: fix calling null function of VF

Ferruh Yigit ferruh.yigit at intel.com
Wed May 10 11:49:40 CEST 2017


On 5/10/2017 10:34 AM, Gregory Etelson wrote:
> Hello,
> 
> The patch you proposed fixed a crash I experienced in IXGBE VF.
> However, there's still another crash possibility
> if the code will proceed with speed == 0 condition to ixgbe_get_link_capabilities
> VF mac.ops.get_link_capabilities is also set to NULL;

There seems a NULL check in that path, so it should be OK, can you
please check:

ixgbe_get_link_capabilities()
	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, .)

...

#define ixgbe_call_func(hw, func, params, error) \
	(func != NULL) ? func params : error

So, if hw->mac.ops.get_link_capabilities == NULL, this will return
IXGBE_NOT_IMPLEMENTED


> 
> Regards,
> Gregory
> 
> 
> On Wednesday, 10 May 2017 10:00:02 IDT Wei Dai wrote:
>> hw->mac.ops.get_media-type() of ixgbe VF is NULL and should not
>> be called directly. It had better be replaced by calling
>> ixgbe_get_media_type( ) to avoid crash.
>>
>> Fixes: c12d22f65b13 ("net/ixgbe: ensure link status is updated")
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Wei Dai <wei.dai at intel.com>
>> ---
>>  drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
>> index ec667d8..ed2baec 100644
>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
>> @@ -3799,7 +3799,7 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
>>  	hw->mac.get_link_status = true;
>>  
>>  	if ((intr->flags & IXGBE_FLAG_NEED_LINK_CONFIG) &&
>> -		hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) {
>> +		ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
>>  		speed = hw->phy.autoneg_advertised;
>>  		if (!speed)
>>  			ixgbe_get_link_capabilities(hw, &speed, &autoneg);
>>
> 



More information about the dev mailing list