Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp634631ybv; Thu, 20 Feb 2020 04:46:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxu3X68T+wr6qmbfdD3eHkLW9qPPLWjf/FO0c9WDAJrS7pWZ7KSXbWhpP/X4Q0C1DHLnPlf X-Received: by 2002:a9d:7984:: with SMTP id h4mr23714788otm.297.1582202764385; Thu, 20 Feb 2020 04:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582202764; cv=none; d=google.com; s=arc-20160816; b=dRWGgyjeYsuCSI2iVn0a5Wtl+piH/B05k/17CEVs/oARjKxKviYq7w+qy+jmCz5ift gcM4tC5NzVjGv7BJSuglOes4BFg6I5TayrZELbx+VBLAltdn8pVPWCo9E5z2jFnqSKa9 iVSQ9C4c5sB/YzywOt8DUa47rnKL9qE2BFD7l9+iknMLXUKusRkKEB0XrhdHCRVz7oIN YYEn1xXoqP7wdzGgUij3MoGMdRq24GqKTsfivZARRRNK10bGaDs6dxBdcLCBq6DAb64j f0ZtYkyjT9L9G0REhQUPyiq8REriGoln+yXHvXQRj8Ix6ThnF7bej2iYR/eBEjERmPmC Uukw== 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=S+DR2tqwHDGoIzSaCv59EB/9EwXei3rtQ6/JX+jjHm0=; b=lNbq7qGSZ5zSRZYsV7G65ezCnqXNvgMcDAEEtTAs1yAKoM4Q7yMITV18BcdhTbmlzX bvUG7bSdR4q78JCt8Jj1er3NUJF7DCgnrKxmrpb99cLPqtzE0X/5Hju2FKIUqt0xgqCi niy4fzAOlb9QDjklXi5AESHkC5MwrowNP3p1HEihTTaQT2bQnyIGGuFMk+c0vRzb/tUa 9bzZXF4ncQxSI0+pDal5YaM31GXPRRkCTqkHUeNeXX+YLHUEL5RdDxiNnqkbyQUq44it Agj03OTYq4ElV3pcheIosfXjhiILqAoxp2F0GrtRMxViMJl8UnzeaYYwaysE2dSXpCvt /SxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=u0kGKSV7; 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 t24si1654130oth.319.2020.02.20.04.45.53; Thu, 20 Feb 2020 04:46:04 -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=u0kGKSV7; 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 S1728133AbgBTMpV (ORCPT + 99 others); Thu, 20 Feb 2020 07:45:21 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:41269 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727931AbgBTMpV (ORCPT ); Thu, 20 Feb 2020 07:45:21 -0500 Received: by mail-qk1-f196.google.com with SMTP id d11so3351449qko.8 for ; Thu, 20 Feb 2020 04:45:20 -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=S+DR2tqwHDGoIzSaCv59EB/9EwXei3rtQ6/JX+jjHm0=; b=u0kGKSV7g2gKVQQ0tktOYXAH7/+lxVouJ+8xGYEuQ+Ul+9zBK8tPqwmMCpEFgCrtOt qxrVWpL+RHuA+RbhkCI8sYY6FKdTUxWLwet0QA9Qya0ymHwQetSiv9H3HffGUPO4kA/j hpbls110s0uQMOQotm4P4lnkaWLzcue6FW2kncfAmejTlIFSRFAT/SyQD/Xa/P+aND6o km9tF5TWWSRlNZ1PlpxW8AmXyHC1+IWdBRqhSFzAAhYByCHbsUq5RolPJNuQaODZmPxx lVNMoV2qbwlogdzXgtoJRYF3SaN7wINLQiNYjcSwqfotwm2JMU9G7Lt41zirPPv768j9 J9WQ== 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=S+DR2tqwHDGoIzSaCv59EB/9EwXei3rtQ6/JX+jjHm0=; b=NYahdN9fY2f+BH5qaV8TipWURystFp2e4It+BXQ5OLYplxqgPLyHTrjxVnbGoqCpEw pE+0Rn0FwHOMaXKB0Y3TJJJn6T+McANb7qNVDGBhI3WGciZ90mJbvJ2B1lOo+1xrYS/z WxAs9TaS9iP6GJ/wGcgD/r6tPc8bHf9SNMw7DSwVWJMCacOU1p7Dpb78l3dD6H5UxIl9 W3nPO5mHRowrfpgV1FXdb7deNbOQ5DsDxibN8M8f/AG1F5Y4DD75soLOdM7vgExlXUtY /KFIqe35IvmTvsP8XMY1zpP0EcwREQb0lOUO9u3Cj12TMS+0vh/7EZ7AvG4Z6kNiFxjC zA1Q== X-Gm-Message-State: APjAAAWPlt+Y11QBAPQ5CzxwzE/fOQZtjuIac5m/4CIM6HJlnwQStcyI suiZuxQD+QRggnkf+lgXIar1BEtn05LIGjWzpo4fLg== X-Received: by 2002:a37:a488:: with SMTP id n130mr27484945qke.120.1582202720242; Thu, 20 Feb 2020 04:45:20 -0800 (PST) MIME-Version: 1.0 References: <20200220100141.5905-1-brgl@bgdev.pl> <20200220100141.5905-2-brgl@bgdev.pl> <965f715c-a714-00df-b496-a586969dd086@linaro.org> In-Reply-To: <965f715c-a714-00df-b496-a586969dd086@linaro.org> From: Bartosz Golaszewski Date: Thu, 20 Feb 2020 13:45:09 +0100 Message-ID: Subject: Re: [PATCH v4 1/4] nvmem: fix memory leak in error path To: Srinivas Kandagatla Cc: Bartosz Golaszewski , Linus Walleij , Khouloud Touil , Geert Uytterhoeven , linux-gpio , LKML 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 czw., 20 lut 2020 o 12:30 Srinivas Kandagatla napisa=C5=82(a): > > > > On 20/02/2020 10:01, Bartosz Golaszewski wrote: > > - if (IS_ERR(nvmem->wp_gpio)) > > + if (IS_ERR(nvmem->wp_gpio)) { > > + ida_simple_remove(&nvmem_ida, nvmem->id); > > + kfree(nvmem); > > return ERR_CAST(nvmem->wp_gpio); > You freed nvmem just before this statement, how can nvmem->wp_gpio be > still be valid? > > Are you able to test this changes at your end? > Or > these are just compile tested? > Sorry this was rushed, I will have access to the HW for testing tomorrow. Bartosz