From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] net: Fix one possible memleak in ip_setup_cork Date: Sun, 15 Apr 2018 22:55:56 -0400 (EDT) Message-ID: <20180415.225556.1579770058342079388.davem@davemloft.net> References: <1523845005-6353-1-git-send-email-gfree.wind@vip.163.com> <1523845005-6353-2-git-send-email-gfree.wind@vip.163.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: kuznet@ms2.inr.ac.ru, netdev@vger.kernel.org To: gfree.wind@vip.163.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:35770 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbeDPCz7 (ORCPT ); Sun, 15 Apr 2018 22:55:59 -0400 In-Reply-To: <1523845005-6353-2-git-send-email-gfree.wind@vip.163.com> Sender: netdev-owner@vger.kernel.org List-ID: From: gfree.wind@vip.163.com Date: Mon, 16 Apr 2018 10:16:45 +0800 > From: Gao Feng > > It would allocate memory in this function when the cork->opt is NULL. But > the memory isn't freed if failed in the latter rt check, and return error > directly. It causes the memleak if its caller is ip_make_skb which also > doesn't free the cork->opt when meet a error. > > Now move the rt check ahead to avoid the memleak. > > Signed-off-by: Gao Feng Why did you post this patch twice?