Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp690798img; Fri, 22 Mar 2019 06:40:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjtO9TLAP8y5vS/Xbmgs+EIr0FzmNBz1Od/bXHodPnYi7dczd/5xF+YVbQfuBjFHPsKW2+ X-Received: by 2002:a17:902:f20e:: with SMTP id gn14mr9558362plb.334.1553262032295; Fri, 22 Mar 2019 06:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553262032; cv=none; d=google.com; s=arc-20160816; b=I/89vFVa8JoN3DytSnipM5tRJwR1SsHkepdWF9wJ7Drh6RH7/PGqCti5Sg79QrkApL OvIk0lFA6nfUYf+h23ml8c0ZnSrYmgjfjimznCrstOI4map93eY29htj7zD8tXAXq+z7 6dN0xiMNm91oaQzbwcykgyDq1jvngAlWBP9ouKHpVzWltO5LpYd841PTO0sMpf1oLzF9 4mxjTrbSj0317iQ1wo3fXtuqQG8ysQpFdgTk+6ROow8bblNwsuQvOn2ksWVCnzExzAg2 lT4FyzpRrQdYEZPnHLcOv1qF2WLCOKIJgO4gXHNSS51D2Ah/YBkY1L5dcdccrnkJvFs9 Y4Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=XtCZTbLOSSQ20W3X5b1PtKVAQLtaunItAuf4EPYg83U=; b=uOvaHjsBokh1tjrnnZX55ZAVDQWcdmU4nNNXMNXdMksNgIqqM4YUlbNHMF24sUjNk7 kzuBa9gGZScIP515vUT184KN/uCoOnYSqxIHDr2GHxIRVHyBl5BlQZQ9+6jBFKBnvOy2 gtSkMUu3L/eoFUoQpZ96Jui5qzpOQ5DyGe1kA3UgybmkK6IHuQz2ud5nqZAgNMn6HQZr nl6vHzQcb8C9FQGOxKz7K3r87vrtLRGIXcMQA/2YLw0r4eXoGL9jUVvnGrr26psKetLs OQfPp9aUA7q+GPnI0IFqO7g0PXiiJ0GOyWvji5Vp6COEDleOqPn1RWtq83vZzZONv6bs U8XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d62si7024075pfg.209.2019.03.22.06.40.16; Fri, 22 Mar 2019 06:40:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728332AbfCVNji (ORCPT + 99 others); Fri, 22 Mar 2019 09:39:38 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45090 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728119AbfCVNjh (ORCPT ); Fri, 22 Mar 2019 09:39:37 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 323F1982A746CDEA4EBA; Fri, 22 Mar 2019 21:39:34 +0800 (CST) Received: from [127.0.0.1] (10.177.31.96) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Fri, 22 Mar 2019 21:39:32 +0800 Subject: Re: [PATCH] dccp: Fix memleak in __feat_register_sp To: Mukesh Ojha , , References: <20190321141058.14580-1-yuehaibing@huawei.com> <21f94a25-949a-1a6a-2ba2-59c829edeb04@codeaurora.org> CC: , , From: YueHaibing Message-ID: Date: Fri, 22 Mar 2019 21:39:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <21f94a25-949a-1a6a-2ba2-59c829edeb04@codeaurora.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/3/22 19:52, Mukesh Ojha wrote: > > On 3/21/2019 7:40 PM, Yue Haibing wrote: >> From: YueHaibing >> >> If dccp_feat_push_change fails, we forget free the mem >> which is alloced by kmemdup in dccp_feat_clone_sp_val. >> >> Reported-by: Hulk Robot >> Fixes: e8ef967a54f4 ("dccp: Registration routines for changing feature values") >> Signed-off-by: YueHaibing >> --- >> net/dccp/feat.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/net/dccp/feat.c b/net/dccp/feat.c >> index f227f00..083e012 100644 >> --- a/net/dccp/feat.c >> +++ b/net/dccp/feat.c >> @@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local, >> if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) >> return -ENOMEM; >> - return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); >> + if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { >> + kfree(val->sp.vec); > > Please atleast check the compilation first, don't just rush into sending patch. > > s/val/fval A copy-paste typo, will fix it. Thanks! > > > Thanks, > Mukesh > >> + return -ENOMEM; >> + } >> + >> + return 0; >> } >> /** > > . >