Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp66647yba; Mon, 1 Apr 2019 01:46:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGd691J8Y9CQYkfKf1lpvo3lWg2YHjSqnUVECqwHLyMWFA8URLQvLjJm26G0ALNjyilCm2 X-Received: by 2002:a62:415d:: with SMTP id o90mr60769110pfa.236.1554108417058; Mon, 01 Apr 2019 01:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554108417; cv=none; d=google.com; s=arc-20160816; b=A4RWlgdz4BU2c8+azJwSyCRnDmdT2bUYd7oubGtuRUwEzQWjLtiYnbFEzt2SlssLq0 qfku1P7K/N20cj/GCkjof5wzIVh8q9mYzYSMo36PL+SnV5spS6GKJwHoNVC6tEF7R+Fk 6aJAaKFBo/l9/3RE1Su/bCDgVswZiyKGhwycVuh+pAYC+4ORuC+QNdBH58uamcl4kZMl c1Po2kUcgNMdL6LDnItqbdBNlCNzUtdJEuuPHr5qs02FQa/PReo6VagZpHTCI09n4rda N9w216pSAASsyYk85APoKxw7LMHecFjtERF7mGYsebDRm54lRKhiQsY+teZLVjwRtAqX OTug== 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=jw3MPY9xDVhrwl0aZebBqOAD211NeXYsUBXFeoc2msQ=; b=hoiAvj4zRPDDNI+Z/lplJYYQvfM1DegukEhaPeJn7Y6+4Eq01O9pjuKK4T8hf7s1rA 90U8WNWUeNBshrhtmklilJYq7REcxirVGARfICagz8pteUfknTHYlncycYPzp3EVYTB4 u8NMuz4H2O588LAQvvEf65EylkV17cPHOk1ucKzp2sKA0zTa2hHuTgSaB06vhOzLjr2K LN9Cul7YqKcnNoyHKyVxH1yM9iAtHQp+fI9/m7jbp3DxUpUXBryWmVzLK/zWVu8oZKDj th+Hait+p/W8AIBkh5FyZ3KFFuIEhJAKXorLBajHm2f1lPKVgHzmoAP66oMMJQkzd6Ig oh1g== 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 o2si8323759pgv.144.2019.04.01.01.46.41; Mon, 01 Apr 2019 01:46:57 -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 S1727150AbfDAIpz (ORCPT + 99 others); Mon, 1 Apr 2019 04:45:55 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51904 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726352AbfDAIpy (ORCPT ); Mon, 1 Apr 2019 04:45:54 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 97F7CB9E5222BF692E0D; Mon, 1 Apr 2019 16:44:40 +0800 (CST) Received: from [127.0.0.1] (10.177.31.96) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Mon, 1 Apr 2019 16:44:36 +0800 Subject: Re: [PATCH] dccp: Fix memleak in __feat_register_sp To: Mukesh Ojha , , References: <20190401013554.17488-1-yuehaibing@huawei.com> <4ad301d4-7af2-87e4-9b52-9c4eee09b79c@codeaurora.org> CC: , , From: YueHaibing Message-ID: <2022d726-4785-5d64-c8b5-37171d2dc220@huawei.com> Date: Mon, 1 Apr 2019 16:44:35 +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: <4ad301d4-7af2-87e4-9b52-9c4eee09b79c@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/4/1 16:24, Mukesh Ojha wrote: > > On 4/1/2019 7:05 AM, 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") >> Reviewed-by: Mukesh Ojha >> Signed-off-by: YueHaibing >> --- > > > I don't think it is the first version. Do keep in mind to put detail here . Yes, this is the v3 resend. > > -Mukesh > >> 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..db87d9f 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(fval.sp.vec); >> + return -ENOMEM; >> + } >> + >> + return 0; >> } >> /** > >