From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH] net: cxgb3: add error handling for some functions Date: Mon, 11 Jun 2018 14:23:21 -0700 (PDT) Message-ID: <20180611.142321.1509037661741097364.davem@davemloft.net> References: <1528706547-35243-1-git-send-email-jiazhouyang09@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: santosh@chelsio.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: jiazhouyang09@gmail.com Return-path: In-Reply-To: <1528706547-35243-1-git-send-email-jiazhouyang09@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Zhouyang Jia Date: Mon, 11 Jun 2018 16:42:26 +0800 > When sysfs_create_group or alloc_skb fails, the lack of error-handling > code may cause unexpected results. > > This patch adds error-handling code after the functions. > > Signed-off-by: Zhouyang Jia The ->nofail_skb handling is perfectly fine. It is a backup SKB, meant to handle alloc_skb() failures for the primary 'skb' allocation the _next_ time this function is called. Even if the ->nofail_skb allocation fails, the primary operation done by init_tp_parity() has succeeeded and we should return success. All of the code in this function is perfectly prepared to handle the case where ->nofail_skb is NULL.