From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8DB1C433EF for ; Tue, 14 Sep 2021 02:21:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE02760F24 for ; Tue, 14 Sep 2021 02:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237590AbhINCWk (ORCPT ); Mon, 13 Sep 2021 22:22:40 -0400 Received: from out1.migadu.com ([91.121.223.63]:62342 "EHLO out1.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236565AbhINCWh (ORCPT ); Mon, 13 Sep 2021 22:22:37 -0400 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1631586079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QoLIOI/r8M2fowTTekfDxFkvj7NLl9iwu+uZKG1Y57M=; b=EO/va6LXViFeaWJSXt7yLDpgRcXFpmXCBuB22n7/SLVd4pSgdfDwUi+LcGBsEBnK7kWewd kWmpLe/ZGdjY2Pd/N1wqMKQodXIMAX6msmhybg/9+J1ABCpGqyUDExozM8pJSWuRYHyHP3 H5CgBCnzKtjtCGGr7L0Xdr5CiO79MR4= Date: Tue, 14 Sep 2021 02:21:19 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: yajun.deng@linux.dev Message-ID: <2a95994f251db7d1c5d3318f4468b324@linux.dev> Subject: Re: [PATCH] Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" To: "Eric Dumazet" Cc: "David Miller" , "Hideaki YOSHIFUJI" , "David Ahern" , "Jakub Kicinski" , "netdev" , "LKML" In-Reply-To: References: <20210913040442.2627-1-yajun.deng@linux.dev> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: yajun.deng@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org September 14, 2021 12:15 AM, "Eric Dumazet" wrote:= =0A=0A> On Sun, Sep 12, 2021 at 9:04 PM Yajun Deng = wrote:=0A> =0A>> This reverts commit 919483096bfe75dda338e98d56da91a2637= 46a0a.=0A>> =0A>> There is only when ip_options_get() return zero need to= free.=0A>> It already called kfree() when return error.=0A>> =0A>> Fixes= : 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers")=0A>> = Signed-off-by: Yajun Deng =0A>> ---=0A> =0A> I do n= ot think this is a valid patch, not sure why David has merged so=0A> soon= before us reviewing it ?=0A> =0A> You are bringing back the memory leaks= .=0A> =0A> ip_cmsg_send() can loop over multiple cmsghdr()=0A> =0A=0AYes,= I forgot the loop, it was my mistake.=0A=0A> If IP_RETOPTS has been succ= essful, but following cmsghdr generates an error,=0A> we do not free ipc.= ok=0A> =0A> If IP_RETOPTS is not successful, we have freed the allocated = temporary space,=0A> not the one currently in ipc.opt.=0A> =0A> Can you s= hare what your exact finding was, perhaps a syzbot repro ???=0A> =0A> Tha= nks.