Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp909835pxb; Wed, 27 Oct 2021 15:01:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn1cfHu0bapmXYPmFc9scdfMi7IpOiXNsCqEYUVWv++CBIyY2ybE+YHx6ZBpFTKi40A3xb X-Received: by 2002:a05:6402:350c:: with SMTP id b12mr725221edd.244.1635372074011; Wed, 27 Oct 2021 15:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635372074; cv=none; d=google.com; s=arc-20160816; b=dqT1V349lxRa1xte8yXtoBUlNeYnP00cufoeE8RcExEcBx8C4akRBZogcpsofLYj5x vlqVdJrhse8sygFWFJtmXbYY8pQJlbhAAGtEnvzzSysCZNvdlx+WPfvJ9V4+y0khFReV 7tWw8bxmB5Xtf1h9fP/zI4Zd5kqxKX9WC9THQZ5TbIQf65ZGnLQLd2VZQYKjIrVs38bB vVG9ihkAhRNUviwzK359UytI7f5SXf/jgUa/7KqpwQA1XtWbH6fTcefzwoERGrdzDDQQ fNPTpby7MehOHC+XqChHraN0Pn9z31tmBqnae6WQOIDLxIXoUMlzV8UUj3XVBirc7nxu dV5g== 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; bh=mb0Y3wYj7BF8ZoJLg1h16yj+3u3ARbbLM49sVTMwbiU=; b=GgxAMqz3MjdBLHcCS8HCPHzRc05TV/J6JRXsLWPb2eicawsSun/csg7bJoWszSye/l k8yHsD3j40JuyWTKztrpHMZDgdCJoGqDAF2ZjX+Y/EBhMQ4UC4MvybO1HrlE8fulr2CT m/YjxKfDaMt/Q82e9YG5x+4+CdvEdlsCpixKJfUvVXgAdjUErv7Y5xtjt8jX6H8lAA8z ijwCCKBFrm0SAuZPDJrXcppVurbZtHvPUumcxvt9mDYnk9eqBWfcXBKmIIgTIlMncrBo 6ZHHklSxwARxDmwzlO5U7v1MF7DCbEn1873YRBJ5frbKefcjQzkmvD5NXDcKSplBdnH3 yTdg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd33si1568793ejc.287.2021.10.27.15.00.50; Wed, 27 Oct 2021 15:01:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240992AbhJ0Iu6 (ORCPT + 98 others); Wed, 27 Oct 2021 04:50:58 -0400 Received: from mail-yb1-f176.google.com ([209.85.219.176]:44881 "EHLO mail-yb1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232108AbhJ0Iu5 (ORCPT ); Wed, 27 Oct 2021 04:50:57 -0400 Received: by mail-yb1-f176.google.com with SMTP id v200so4407237ybe.11; Wed, 27 Oct 2021 01:48:32 -0700 (PDT) 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=mb0Y3wYj7BF8ZoJLg1h16yj+3u3ARbbLM49sVTMwbiU=; b=UWpZ3kYbR0zUzOWgtZJgmZ1MfMyvkCbPBJ3wdz9yYekQ2q78ZDU2ckPsFlNqgqfOWm 9c6XlRgeDsGrhF3TXosScP4Ow9/WMD18ozrhdIOIvAT6JaFwAI2iuKuZr1IQUdbBjVd6 /q4qqEIqAcgdL5TyrdYjr2DaRO6kKnQHpUAjFs3kA6Wae55cWnAIuCZh6p6bjb8uHqVe nmlUp/OBb3tyZBLFm+OCzk/llaZnFC/y835R1ArNWcZXC8DVrq8F3P9/TSge0iagWaFh j8O4PJMWEQkB6jylbbofwxyKh6N3UMtP9w58/HPdYBGdusMBSEBBY18SPMpSIToTXWfn rufA== X-Gm-Message-State: AOAM532tgPgT/UJwuoPjjxHn3hh41YCghjeSGrhKkMfe6l2R0m6FfOJ/ 9whQTEhfNuRyC3CGhPHLJfpaM5TaQqygf2XnnRlYWeZp X-Received: by 2002:a25:80d2:: with SMTP id c18mr25790053ybm.113.1635324511827; Wed, 27 Oct 2021 01:48:31 -0700 (PDT) MIME-Version: 1.0 References: <20211026180740.1953265-1-mailhol.vincent@wanadoo.fr> <20211027073905.aff3mmonp7a3itrn@pengutronix.de> In-Reply-To: <20211027073905.aff3mmonp7a3itrn@pengutronix.de> From: Vincent MAILHOL Date: Wed, 27 Oct 2021 17:48:21 +0900 Message-ID: Subject: Re: [PATCH v1] can: etas_es58x: es58x_rx_err_msg: fix memory leak in error path To: Marc Kleine-Budde Cc: linux-can , netdev , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed. 27 Oct 2021 at 16:39, Marc Kleine-Budde wrote: > On 27.10.2021 03:07:40, Vincent Mailhol wrote: > > In es58x_rx_err_msg(), if can->do_set_mode() fails, the function > > directly returns without calling netif_rx(skb). This means that the > > skb previously allocated by alloc_can_err_skb() is not freed. In other > > terms, this is a memory leak. > > > > This patch simply removes the return statement in the error branch and > > let the function continue. > > > > * Appendix: how the issue was found * > > Thanks for the explanation, but I think I'll remove the appendix while > applying. The commit will have a link to this thread so if you don't mind, I suggest to replace the full appendix with: Issue was found with GCC -fanalyzer, please follow the link below for details. You can of course do the same for the m_can patch. Yours sincerely, Vincent Mailhol