From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio Subject: Re: [PATCH net 2/2] neighbour: BUG_ON() writing before skb->head in neigh_hh_output() Date: Wed, 5 Dec 2018 01:38:49 +0100 Message-ID: <20181205013849.292614d5@redhat.com> References: <05374f1f2dbd78bc76cf19991bd6a6991d031689.1543967847.git.sbrivio@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: David Miller , Jianlin Shi , Hangbin Liu , Stephen Hemminger , netdev To: Eric Dumazet Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53956 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeLEAi4 (ORCPT ); Tue, 4 Dec 2018 19:38:56 -0500 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 4 Dec 2018 16:26:05 -0800 Eric Dumazet wrote: > > + /* skb_push() won't panic if we have room for the unaligned size > > only */ > > + BUG_ON(skb_headroom(skb) < hh_alen); > > > > What about avoiding the panic and instead call kfree_skb() ? > > if (WARN_ON_ONCE(skb_headroom(skb) < hh_alen)) { > kfree_skb(skb); > return NET_XMIT_DROP; > } Okay, I guess it won't go unnoticed anyway, and it's probably better than the alternative. > > + > > skb_push(skb, hh_len); > > > > Maybe we can use __skb_push() here, since prior safety check should be > enough ? Indeed, I'll change that in v2. Thanks! -- Stefano