Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5676886ybv; Tue, 18 Feb 2020 01:51:07 -0800 (PST) X-Google-Smtp-Source: APXvYqwLJW8bi9MxMZt3NOHCrDc4ggmyNUoBRs/NQ9nAVKkfZ+nvpAvipfkXtXRqun4rAfrlrbWr X-Received: by 2002:aca:2207:: with SMTP id b7mr707232oic.109.1582019467069; Tue, 18 Feb 2020 01:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582019467; cv=none; d=google.com; s=arc-20160816; b=l8xAkpFRtYJKZtkuMOCSSoDTUac4U/v4Mn10RLRsauZ0UCuNtb2govxa0ju/2IyYaD rAmAUJRHUF/H6LHIHf6VuBCEfR+QE6xykBMFEhoFCbSlVeO3rmBomcS7o8IC4hi2DMQE SwF/eWUH0wUVCzzGF0te/FYsAKW5yEJ/TGvQmI2l82GnMfcC/CSrJBdu6y2BoehTjQHU U4R8ciAAsu2Q5A/XoIbMZcSPU2eQsK8kZZpoSVNSbv7+2NIYguSC+XOxzDi8YwKzaiiH vNU9MWDrk3gZ/Wyn5dBtyFOD9v4e2AoXwEpCe6W5/fQC6Nz6x429ZbbM2hnrwT66cKv3 lglA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CMpbsuUrAguPuwyvtKyydMgGKcHAmQpZ4ST+OIxCEvo=; b=PT9rENXJ1sbh7Dw4Ul46X7VJvkc7zLN4+SYa0NTaJNApSa/oPvVrU+3Ax/Za0WoXnB de0WD789rnGRuLzUM497vUrjAe9ly3ib+ZGIxpcAbSpSoPdH+P8LiQo6kD0DhzuIikkn Eaa7+9HJ3ytUzuoeLEaOSPM7f7BriezyS1sgufjCvBsdJJ34Z8G/52HMzo5o7wJLYvVw nOOjivBXGZrjIR0R6UvFBETDYNsYxj+f6NpRnu6rp0uImnkHkJWpQi6N0fNLF355IVQl FQKgkz58vMNmYcCS1RvgoN3wdX2t8y1Azl6IQMW81a++lGv9wvYbmEmRdxPeeCuCHodY wN9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=UcxFtM3Q; 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 v18si1453694otn.174.2020.02.18.01.50.54; Tue, 18 Feb 2020 01:51:07 -0800 (PST) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=UcxFtM3Q; 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 S1726373AbgBRJur (ORCPT + 99 others); Tue, 18 Feb 2020 04:50:47 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:41660 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbgBRJur (ORCPT ); Tue, 18 Feb 2020 04:50:47 -0500 Received: by mail-qv1-f65.google.com with SMTP id s7so8851689qvn.8 for ; Tue, 18 Feb 2020 01:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CMpbsuUrAguPuwyvtKyydMgGKcHAmQpZ4ST+OIxCEvo=; b=UcxFtM3QvoELxSrxXjAyIIXy3ToxtOp8v/RoUtffuAnl+jI58nEFBR1JfxJY6YtEQw 9bYRta+CO8LsBnfm/X4eLsihAf5TgEDgmxF4Bs5PE4fRh4/h//8ujYNZxkb/Mm4Sb7mE Pi7Xvy5MjSfNG4TV0lpR+UxwArd/G1fzDVmtqd2vyDsNRPzBqc+NURhylRKULiboYYvF lWHTHJZVF4CySygCylj+JeRXkC95mF3hk5uK4Bh2fLxSKi46PMaN+rFyPssMcSzFT3FE 1912mA/8K9fr3BZd/ovrfL67iBHvZ7vBCRcoTsF0XuWtmLafy8R1n5hjtG95q+ZSPHd+ EiKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CMpbsuUrAguPuwyvtKyydMgGKcHAmQpZ4ST+OIxCEvo=; b=RB+Dp2Ex5IZFY7EjoHkFCk+V/mj/rV75YkoAbdpx19DFPmxlVdw7q+ZD3YSHwY8ZYs 70CTbWVQQ6cgft+EMQbAdjO3N7j0eZoiVRtG8ZM4fRU1HNOmowaPzNaec5Ejn5O1czAm Vyj+j5453bFYhGW/UBspFCzDr8OcjAi6qMZVObPtL7xGjH9EgKP/cfTYjLwm8ttTeRZd c+8MsNq6chZ0wSRrnT3BbCl9g/74cye8UBqyaOyDeXYF1fac2H4S/zd2BSb+aPh96T6y You+sCBU73yDaS1ozuxmWR0cX3R+nERGAYS5kUNO9aFv8c9xGZmLEcXR/3ExeJBQfa7I f0Bw== X-Gm-Message-State: APjAAAUVhNJI0xxxEaqgsvT300aYJVmpSyhAlRp19seXVGsnFedAEo5x sZPkaPpe72iARyKs8zdl844Zeuryk6GWznoKSdR39A== X-Received: by 2002:a0c:f28f:: with SMTP id k15mr15645199qvl.76.1582019446430; Tue, 18 Feb 2020 01:50:46 -0800 (PST) MIME-Version: 1.0 References: <20200218094234.23896-1-brgl@bgdev.pl> <20200218094234.23896-3-brgl@bgdev.pl> <9519ba1b-17fe-7121-ce00-d940b3de2777@linaro.org> In-Reply-To: <9519ba1b-17fe-7121-ce00-d940b3de2777@linaro.org> From: Bartosz Golaszewski Date: Tue, 18 Feb 2020 10:50:35 +0100 Message-ID: Subject: Re: [PATCH v2 2/7] nvmem: fix another memory leak in error path To: Srinivas Kandagatla Cc: Bartosz Golaszewski , Linus Walleij , Khouloud Touil , Geert Uytterhoeven , linux-gpio , LKML , "Stable # 4 . 20+" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wt., 18 lut 2020 o 10:47 Srinivas Kandagatla napisa=C5=82(a): > > > > On 18/02/2020 09:42, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > The nvmem struct is only freed on the first error check after its > > allocation and leaked after that. Fix it with a new label. > > > > Cc: > > Signed-off-by: Bartosz Golaszewski > > looks like 1/7 introduced the bug and 2/7 fixes it. > IMO, you should 1/7 and 2/7 should be single patch. > The bug already exists in mainline - the nvmem object is only freed if ida_simple_get() fails, but any subsequent error leads to a memory leak. In other words: it doesn't matter if it's a single patch or two. Bart