Re: [PATCH v2] openvswitch: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash
From: wei zhang
Date: Sat Apr 05 2014 - 00:21:22 EST
AtÂ2014-04-05Â07:05:59,"JesseÂGross"Â<jesse@xxxxxxxxxx>Âwrote:
>OnÂTue,ÂAprÂ1,Â2014ÂatÂ5:23ÂPM,ÂWeiÂZhangÂ<asuka.com@xxxxxxx>Âwrote:
>>
>>Âv2Â->Âv1:ÂuseÂtheÂsameÂlogicÂofÂtheÂgre_rcv()ÂtoÂdistinguishÂwhichÂpacketÂis
>>ÂintendedÂtoÂus!
>
>AsÂaÂtipÂonÂkernelÂprocess:ÂifÂyouÂputÂtheÂversionÂinformationÂafter
>threeÂdashesÂbelowÂtheÂsigned-off-byÂlineÂthenÂgitÂwillÂautomatically
>removeÂitÂwhenÂtheÂfinalÂpatchÂisÂapplied.
Thanks, should IÂmodify it and send a v3 patch?
>
>>ÂdiffÂ--gitÂa/net/openvswitch/vport-gre.cÂb/net/openvswitch/vport-gre.c
>>ÂindexÂa3d6951..f391df1Â100644
>>Â---Âa/net/openvswitch/vport-gre.c
>>Â+++Âb/net/openvswitch/vport-gre.c
>>Â@@Â-110,6Â+110,21Â@@ÂstaticÂintÂgre_rcv(structÂsk_buffÂ*skb,
>>ÂÂÂÂÂÂÂÂÂreturnÂPACKET_RCVD;
>>ÂÂ}
>>
>>Â+/*ÂCalledÂwithÂrcu_read_lockÂandÂBHÂdisabled.Â*/
>>Â+staticÂintÂgre_err(structÂsk_buffÂ*skb,Âu32Âinfo,
>>Â+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconstÂstructÂtnl_ptk_infoÂ*tpi)
>>Â+{
>>Â+ÂÂÂÂÂÂÂstructÂovs_netÂ*ovs_net;
>>Â+ÂÂÂÂÂÂÂstructÂvportÂ*vport;
>>Â+
>>Â+ÂÂÂÂÂÂÂovs_netÂ=Ânet_generic(dev_net(skb->dev),Âovs_net_id);
>>Â+ÂÂÂÂÂÂÂvportÂ=Ârcu_dereference(ovs_net->vport_net.gre_vport);
>>Â+ÂÂÂÂÂÂÂifÂ(unlikely(!vport))
>>Â+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturnÂPACKET_REJECT;
>>Â+ÂÂÂÂÂÂÂelse
>>Â+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturnÂPACKET_RCVD;
>
>Sorry,ÂIÂforgotÂtoÂsayÂthisÂbeforeÂ-ÂifÂweÂreceiveÂtheÂpacketÂthenÂwe
>shouldÂalsoÂcallÂconsume_skb()ÂonÂit.
Maybe there is no need to call consume_skb()? The icmp_rcv() would
call kfree_skb() for us. I also checked the ipgre_err(), it returnÂ
PACKET_RCVD without call consume_skb() too.
Regards,
Wei Zhang