From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] net: skb_segment() should not return NULL Date: Sat, 21 Jul 2018 19:35:08 -0700 (PDT) Message-ID: <20180721.193508.388778757269740663.davem@davemloft.net> References: <20180719230438.190659-1-edumazet@google.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, alexander.h.duyck@intel.com To: edumazet@google.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:48348 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbeGVDaF (ORCPT ); Sat, 21 Jul 2018 23:30:05 -0400 In-Reply-To: <20180719230438.190659-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Eric Dumazet Date: Thu, 19 Jul 2018 16:04:38 -0700 > syzbot caught a NULL deref [1], caused by skb_segment() > > skb_segment() has many "goto err;" that assume the @err variable > contains -ENOMEM. > > A successful call to __skb_linearize() should not clear @err, > otherwise a subsequent memory allocation error could return NULL. Ugh, good catch. > While we are at it, we might use -EINVAL instead of -ENOMEM when > MAX_SKB_FRAGS limit is reached. ... > Fixes: ddff00d42043 ("net: Move skb_has_shared_frag check out of GRE code and into segmentation") > Signed-off-by: Eric Dumazet > Cc: Alexander Duyck > Reported-by: syzbot Applied and queued up for -stable.