Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp226383pxb; Mon, 13 Sep 2021 17:41:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEYlD3vvN+AGZNgwit58sOJv2xX980JHkwapp/jq9eIkAfdz7NsONBZmnngSbNTxgqq14F X-Received: by 2002:a05:6638:32a0:: with SMTP id f32mr12020126jav.69.1631580072910; Mon, 13 Sep 2021 17:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580072; cv=none; d=google.com; s=arc-20160816; b=AHKWgR1YUOH9kB6K8KJlBkKlMSBDB1MGKV3V2tQNoMVq6lBEnuaSzThLoPw04dTXer i9D33sE7k7rDZegAdQkIQsywMcTt5R9wY93jNbrcVzzdBwwHkydL36AHmsb3F4QlDJcm RgjorqLUU88e7JCkIhw0V4WgLoy3h4FaT0z9ps6qYEwyRgykOFBGKx5irroYaIZTECSt v8Ch7ZF0RbA7NF7zrXA8uMDYvuENyr/fR/fTMhWB79gm32vdBAF+/MeL4bA4ccAkEgmP kZq5xStdQXJnM42vn/kMbjCgZ2mRUY+scZG8z7IeU1P+u/73IGQd8xC6IgdS8VEx7G/X ujEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=y8e8w0kKoaJhT8dyqa2pOVw4qDbmG7nE5qlFFhzJWFY=; b=epwsZgfcBjPCbeabTIqmG2nodrhvpPKJi8xah+PtW4PlVBxTqr7QFPcXW5erNSefLg Iaw8/x/++1pnA20koX6ghNtGoSGAm0NkAKX26igaoItauhJe19mJEsCr++pWPEeYS1W8 4Xck2ucvsGJw+wC/YiycIy3frn6WxEyG5fEGJ7CGXtIioAsH760TOLZR5JUq58HJTcLw Lddl4EXC16AYmeWIk3t2aqYfeCdqyXWBIG1VqpW6ghmrl79N+DZOA51wycI/YHnjQczf BdN88X977kEx2Yxedy1MMvrEHyc7F8P9y9jVfhcc3fPKFyCyEQiC4+dLTrPqpQwWaEYV A9TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ijAvSsGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si8749634ilm.91.2021.09.13.17.41.01; Mon, 13 Sep 2021 17:41:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ijAvSsGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345910AbhIMQQw (ORCPT + 99 others); Mon, 13 Sep 2021 12:16:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345685AbhIMQQv (ORCPT ); Mon, 13 Sep 2021 12:16:51 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC0AC061760 for ; Mon, 13 Sep 2021 09:15:35 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id k65so21629677yba.13 for ; Mon, 13 Sep 2021 09:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y8e8w0kKoaJhT8dyqa2pOVw4qDbmG7nE5qlFFhzJWFY=; b=ijAvSsGpPp+LZHuO/yXuBtmgAn7rBrGWYJtJ3yH1XR4qPpXLVJUhp/AwOC50DL5x1c 9HUNewJp/2hOYoqvF+b85BazPQw8e0ODASI1ennNmVE78b433h+Syn7K52gylu7TpQ4l hHNep6B/3zbO+JGgK1qEOByjhfsEPARziapnap/79qlV2BZQHWxl9D3RcZ9oBfM+5QNc n/TMymP23VcICMIL1yAz4DHt3dQvKpkaiCXgAbV0vkflzd6WHumauoz/z/rRDyzir7+P 5tUZDaD4DyhnJhODwI40Hf6PpIBkmkbcvWlG+v1S/EI20hjQmaxWL1Ny2/yrGdaWYtQD h6gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y8e8w0kKoaJhT8dyqa2pOVw4qDbmG7nE5qlFFhzJWFY=; b=RRS+BLK15cNzeNwwaZbtAPo911SJuzFedE7zVmPw98sZmIDtuC5LqzuYampj5IEpL/ XSFY0zxfnxh/NRGk7wjFqu8l1Bm3tGppGhGlxHQ/e7ggFx7MX3AcHzMCjwfqk+u5iFAm sE3TII8LXi6/8babNezVzf5/Wi/o8ceNO8RSxmBVrkTJqXiVWYuLhlenwIh9rsYUs372 5VSMjUUUJp28fZnPl7GU4xigeak81sbMiqcuvHIX5Xu8kxH9N8Wv2V8KHV3xVchTY1zI 0nwT6J17IKjfYQslymg+n7aKoteP1gEyMgcFmcQqvlyhR36JylZnPMKwBPALO2c9BvC+ 5nAg== X-Gm-Message-State: AOAM530c5bb7QwBE0khWoHorzRsFbQljBnhxapkJ7PxclADcPs8GFkMD FYaK1S+ql5ZeFP1ikWLrd61Q9OMOHQavmdaTFnhlTg== X-Received: by 2002:a25:dd46:: with SMTP id u67mr16065628ybg.295.1631549734404; Mon, 13 Sep 2021 09:15:34 -0700 (PDT) MIME-Version: 1.0 References: <20210913040442.2627-1-yajun.deng@linux.dev> In-Reply-To: <20210913040442.2627-1-yajun.deng@linux.dev> From: Eric Dumazet Date: Mon, 13 Sep 2021 09:15:23 -0700 Message-ID: Subject: Re: [PATCH] Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" To: Yajun Deng Cc: David Miller , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , netdev , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 12, 2021 at 9:04 PM Yajun Deng wrote: > > This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. > > There is only when ip_options_get() return zero need to free. > It already called kfree() when return error. > > Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") > Signed-off-by: Yajun Deng > --- I do not think this is a valid patch, not sure why David has merged so soon before us reviewing it ? You are bringing back the memory leaks. ip_cmsg_send() can loop over multiple cmsghdr() If IP_RETOPTS has been successful, but following cmsghdr generates an error, we do not free ipc.ok If IP_RETOPTS is not successful, we have freed the allocated temporary space, not the one currently in ipc.opt. Can you share what your exact finding was, perhaps a syzbot repro ??? Thanks.