Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1299222rda; Mon, 23 Oct 2023 08:26:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5EDMuehlrOmY0CymwEVOwroKcnycsBzo29ED/xAZcVkkGdnAxHiapIQqasBup7Vm+Xkjl X-Received: by 2002:a05:6a21:998f:b0:15d:53ad:22fe with SMTP id ve15-20020a056a21998f00b0015d53ad22femr17139930pzb.3.1698074794851; Mon, 23 Oct 2023 08:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698074794; cv=none; d=google.com; s=arc-20160816; b=OyJECqMLfJZwKvv/YZQK2ynF820v+VBRtL38WHBNrPzEdMFAfrrrRLIyXZF+rsbPDk RZmIOfB8FWbT45ZZ6T+Z1eUOAqHbG0zyQ5yPFjbhJH4xTDb0oIuu9w94tMov24w2IRvp 1tdVr0r9OyLBD7qsNcQn+QJFWi6rneTQx4QzrZok1PCJucymzyvAXQ1HxO32p98GXog1 j2XPTNkY3n4DIG8wuNM222oVjPJfxUuv4dNXaRK25NZCAdubk0sgrFYYoBRBMO4a5CnU u2liKSkhCQWHXu6zdMNLUyECHRCq1e9gDfSgwmuJ5s4ud6p6l/wsHi9x8SoTG6sJYE+y WLhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/CzCazOWwc0AjfPDjHwFnPrn4cM8+Qb2ZRBbNbpxMYI=; fh=YyoBZdemY6/VDodIDWi5pPbPV3TcYgvg+LLREe9s0VA=; b=ZWzI2Udu9TrvHzq8kW+dfrpmcQYdmqBAXrNUhStAFF6rXFomv0WzbmOq7nspZ0ZoDw 5zib06xhzcFXFB7mJavTnZQzdt4YMksmUuZeeK7jHnUUwhNw+9gP7FLPIRJ1Rc2Roxff y3es/OznHd04akqs6z6+JLWcus/0ZtvPlCarTmoK0cRjQbgbJE0n0i3wfAGBtoRyy7VH svYG+m1z0Svw5Q0Wdb+uf+VN+cZdjAxKHn8pIN03J+O3Q8h5DH1lAjqOcia/k79jH6yd aX7zrsboyGVHklzqKsEVB8h8fJyi44FFit1hwEt4yx5e0zsoB4K3VcOPn8LgnCA/qVLw NNfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DGJl7WJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l71-20020a633e4a000000b0055b731aa9adsi6246450pga.562.2023.10.23.08.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 08:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DGJl7WJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A93E78080D62; Mon, 23 Oct 2023 08:26:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231742AbjJWP0X (ORCPT + 99 others); Mon, 23 Oct 2023 11:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJWP0W (ORCPT ); Mon, 23 Oct 2023 11:26:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4157793; Mon, 23 Oct 2023 08:26:20 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F46EC433C7; Mon, 23 Oct 2023 15:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698074779; bh=MUWfkAY6YNZNnR9Rk3h3FC500r24diJXi8qGt5DBCVw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DGJl7WJeNjFOzAWvcLZJgiFrY6+i5L3c/Tf8tL4CgtMldYVXHsjGmpWMdiwzlwnMK Xdkyk+cGTLrj4FL/fa/SYMarzia+yw8/gjeyzC/62QiaSkTBGpbfmkgIGGzwDQIqLQ Yxd15ykwhW94vdOU42pZvGf4fET+W0nJhuUni0BpR3H8xg73pOVzS4zvztFneDrLR4 kW5mWmR6HgGlH7FzC4nVlULi72+yDMLTRA4PsqwI/ZLNIZMwQMKayCCLhQhtNArAe3 6nlhFnK+/bIVG4jC9riUy/YWp7lh/BSS+wnM6JGO8wk3s7MXOgFSBozUIUNNrMAeXP TF5nNlYVxWEYQ== Date: Mon, 23 Oct 2023 17:26:16 +0200 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Yang Yingliang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] i2c: fix memleak in i2c_new_client_device() Message-ID: Mail-Followup-To: Wolfram Sang , linux-renesas-soc@vger.kernel.org, Yang Yingliang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230929091952.19957-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="l5HgbAzMGwyq4s6P" Content-Disposition: inline In-Reply-To: <20230929091952.19957-1-wsa+renesas@sang-engineering.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 08:26:31 -0700 (PDT) --l5HgbAzMGwyq4s6P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 29, 2023 at 11:19:52AM +0200, Wolfram Sang wrote: > Yang Yingliang reported a memleak: > =3D=3D=3D >=20 > I got memory leak as follows when doing fault injection test: >=20 > unreferenced object 0xffff888014aec078 (size 8): > comm "xrun", pid 356, jiffies 4294910619 (age 16.332s) > hex dump (first 8 bytes): > 31 2d 30 30 31 63 00 00 1-001c.. > backtrace: > [<00000000eb56c0a9>] __kmalloc_track_caller+0x1a6/0x300 > [<000000000b220ea3>] kvasprintf+0xad/0x140 > [<00000000b83203e5>] kvasprintf_const+0x62/0x190 > [<000000002a5eab37>] kobject_set_name_vargs+0x56/0x140 > [<00000000300ac279>] dev_set_name+0xb0/0xe0 > [<00000000b66ebd6f>] i2c_new_client_device+0x7e4/0x9a0 >=20 > If device_register() returns error in i2c_new_client_device(), > the name allocated by i2c_dev_set_name() need be freed. As > comment of device_register() says, it should use put_device() > to give up the reference in the error path. >=20 > =3D=3D=3D > I think this solution is less intrusive and more robust than he > originally proposed solutions, though. >=20 > Reported-by: Yang Yingliang > Closes: http://patchwork.ozlabs.org/project/linux-i2c/patch/2022112408544= 8.3620240-1-yangyingliang@huawei.com/ > Signed-off-by: Wolfram Sang Applied to for-next, thanks! --l5HgbAzMGwyq4s6P Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmU2kJgACgkQFA3kzBSg KbZeFxAAtaw5Gxe+6T4y2k0dRd0xpmykFob/LvLad0tktcxTXTICU0Os1UyzgaNh Z/oYCy1AXGDchAVqYdwmwANfH3jRPwaC0cnR1VkhAXkRgZCOBYWjmp9LMpb5lwIy 6ERm4BYm3hXAervo2hBVxf13bQlz8NbR7W5tbnhbh0lS1UOsco099zBnl7vQQ4MT UC1AI4NSfoPSgHJyurgOWhETCsycsLU0OG6jXo2ITiZJ+8Ui4RCQ2piHNp+SBLhF Sy8wgYgOOYqYdoP7v+Jx3H56tfYGROCjz5u3o+/Tbq0hHTsiBjC+LDioKlvjia/x MhPZifBkSa2chisIrjoYs+iRfDfoLKsjav8UxKxRD4RWFZIPTjTkYyeRD/T/5FAT ZbLP9ShTcGOAq08iP53OeqHiGNBCtILB13PxIvJSuorJp/l0eDZU4fgZoTwwhEOv gWVfghR7/NY1EgBKsDZzBg3sS7mzGqIc0Hy5w+hPIIH6BwbpYm/IXbnmB1Qd8gjW b/0sDloNoYg4ZLgcx7+n/PaE3uvBjK0Se+SeMASFsBKnasXLjelyefwElhIOWTa1 EP1yCXCPUFcHSJ+N6K5xT3rB22SQP6FEjU8rfg/V7dKqtkebmVJr+Ie/gGgZKLou boWQaSBd7M2QpiPFzQZinOnZZZIrhalx1S6dz4o/7gEsrt8fZlM= =Riax -----END PGP SIGNATURE----- --l5HgbAzMGwyq4s6P--