[PATCH 06/16] gtp: add error handling to gtp_newlink

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Andreas Schultz aschultz at tpip.net
Mon Nov 16 18:16:58 UTC 2015


----- Original Message -----
> From: "Pablo Neira Ayuso" <pablo at soleta.eu>
> To: "Andreas Schultz" <aschultz at tpip.net>
> Cc: openbsc at lists.osmocom.org, "Harald Welte" <laforge at gnumonks.org>
> Sent: Monday, November 16, 2015 6:46:29 PM
> Subject: Re: [PATCH 06/16] gtp: add error handling to gtp_newlink

> On Mon, Nov 16, 2015 at 04:06:47PM +0100, Andreas Schultz wrote:
>> Signed-off-by: Andreas Schultz <aschultz at tpip.net>
>> ---
>>  gtp.c | 32 +++++++++++++++++++++++---------
>>  1 file changed, 23 insertions(+), 9 deletions(-)
>> 
>> diff --git a/gtp.c b/gtp.c
>> index 11f8fad..4f5729e 100644
>> --- a/gtp.c
>> +++ b/gtp.c
>> @@ -756,8 +756,12 @@ static int gtp_newlink(struct net *src_net, struct
>> net_device *dev,
>>  
>>  	if (!tb[IFLA_MTU])
>>  		dev->mtu = real_dev->mtu;
>> -	else if (dev->mtu > real_dev->mtu)
>> -		return -EINVAL;
>> +	else if (dev->mtu > real_dev->mtu) {
>> +		netdev_dbg(dev, "GTP mtu greater that transport MTU (%d > %d)\n",
>> +			   dev->mtu, real_dev->mtu);
>> +		err = -EINVAL;
>> +		goto out_err;
> 
> This is function is using __dev_get_by_index(), so we're not holding a
> reference on the netdevice here.

But there is a 'dev_hold(real_dev);' right before that if condition. Doesn't that
take a reference to the netdevice?

Anyway, the conversion to the iptunnel framework makes this code largely
obsolete. So I'm going to drop this change.

Andreas

> 
>> +	}
>>  
>>  	gti = netdev_priv(dev);
>>  	gti->real_dev = real_dev;
> [...]
>> +out_err:
>> +	dev_put(real_dev);
>>  	return err;
> >  }



More information about the OpenBSC mailing list