Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4312834ybc; Fri, 15 Nov 2019 02:36:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwi8oHhNSyRGnrROPdN8+b3EelC2jgCRJLotexb+9HKWHUrcNz/BxWMSCcXc1tYawXSUO7l X-Received: by 2002:a17:907:216e:: with SMTP id rl14mr13048945ejb.291.1573814181957; Fri, 15 Nov 2019 02:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573814181; cv=none; d=google.com; s=arc-20160816; b=aDtSi8je2X/K5UMcxPKVk+X5do4zPTu1DeTAs49GSd/oNJL2IjUTJj74FZHR0Vo1pD bRmN+GrLAka3ieiF5AO/VwS+ZqZLdiXkCUKzCNIA/yDKncbLiN322vzsrEkqHdCiMHCF wZWTu6Jno7w6cWNRGzwRxh/EijmnXg+zhaKcwreXbQsKohyk0z/diygP8ytmrxJQQzro 9j2a/pOtf1pOHd7/JtNxY6S1X3IK5wRtHrn1CkBPyFwRN3bKbgYXSd0n+USoSn9suP7S k4+eq54YA3h5Wilv8XHC5BF1/Jh4TG9KBqUEzlPVSsKgmRDE3ft9E/gDozN9MoaiCMvR 8ajA== 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:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=LEboKIm4XtYUXiW1Vq6xcXCe3zY0ylQ/Sqx7enK/HH0=; b=leXYMFOeN8tInJTu3q7amtmZkeE7fgHa0isoiKFowC/cGP6K7SOQqHmG0+f8GkhS/M 82zncu62CCZSbBdtx5JNjUeWJ8//V8+KkhlvsMr8cfyMl1I96z+sySa3it3iBTiClyqk 8EK8twcSOaRTmnc6iT8Xc274bWDjKVVIdAiAwSb4TUDDf+OlLv3SoOJKVwp0RbiO9oIm pH2EvXciK+P4QTKgakwcdYoPHIU2OESQsUvIdDt1fpI0pY3UBwJivQQu84ynxP3hsErB O5UTxR7yHEQhUIvKcSf9LMlX2CTxkmtV8GS8jKAgO6SKlXVOJd7F6r7MCE5C38K3a1cU M0NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@unikie-com.20150623.gappssmtp.com header.s=20150623 header.b=kKgwjlUa; 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 s13si5893931edt.427.2019.11.15.02.35.55; Fri, 15 Nov 2019 02:36:21 -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=@unikie-com.20150623.gappssmtp.com header.s=20150623 header.b=kKgwjlUa; 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 S1727151AbfKOKcf (ORCPT + 99 others); Fri, 15 Nov 2019 05:32:35 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33991 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbfKOKcf (ORCPT ); Fri, 15 Nov 2019 05:32:35 -0500 Received: by mail-lf1-f67.google.com with SMTP id y186so7661097lfa.1 for ; Fri, 15 Nov 2019 02:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unikie-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=LEboKIm4XtYUXiW1Vq6xcXCe3zY0ylQ/Sqx7enK/HH0=; b=kKgwjlUa0n1nWif0RELshhBBhRTkumivvKv5zGSPuMJXP0PGwQRe+V0QxOeL2/rbqP /rUoBJlJLRf0/ER76UH6Ehiw1Gaek8IVIbWXvLqDdX+lcmylJVdZygdlx8yCdCc6K0Zd WBS3NeSIrhK9DlrnmvfQ3Dw9ScQOwqvQ83frLLb16yhIfadkeqiGI6+WqrrbGmTmS8IR wWBvYFCq9C0FN/gD8hPEaU6S6rzKLITZ4jI55LLNe4kG65y7FNZvlbZ7U18SGTE08Qb8 lae3dgXXh+z/VhLvDs6Mdhdp4q1wVyMdp8NPw42wuOWmP/AF+481TzuY4oeWIqnf9Qz/ oFUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=LEboKIm4XtYUXiW1Vq6xcXCe3zY0ylQ/Sqx7enK/HH0=; b=Yr05rts9H7IfddUs+EJuXjSJamCtpvl2A/1Hoziki6v99L4foKNxKFT79k9dGi4Tdf lVgWsGTYlYbxGigj3WbfZMd/5g6PLu2iWQjUduaPxDpvHnF9GBXnlCRSniM6KG9Y8QKO q+wuMSexTxLPzg+ayycplYtSQdQnwqCRblA5/XJH35GLk1SaumNb36l975A1V1hkPDeF wBGJkswhrE1r620svB1KwCbdOTRMvngf7EooBsUQ1JWbXUC5tFblAayXlJZBsvLrWlVh q6+kVydC1mTjlxZnS87HH3z9T/unTJy5wTlbAAvdrqm8PUWESaszKSHNvj0HiSkEkoAG DArg== X-Gm-Message-State: APjAAAXClJDJblwHBFeju+/7/wIQ5YtFy4O/ZEjdNS/kfJTsTWtts12i Cquu0PyOsrpYKGJwyq15d8abNQ== X-Received: by 2002:a19:790c:: with SMTP id u12mr11108700lfc.183.1573813953142; Fri, 15 Nov 2019 02:32:33 -0800 (PST) Received: from GL-434 ([109.204.235.119]) by smtp.gmail.com with ESMTPSA id t12sm4030431lfc.73.2019.11.15.02.32.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Nov 2019 02:32:32 -0800 (PST) From: jouni.hogander@unikie.com (Jouni =?utf-8?Q?H=C3=B6gander?=) To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Lukas Bulwahn Subject: Re: [PATCH] drivers/base: Fix memory leak in error paths References: <20191114121840.5585-1-jouni.hogander@unikie.com> <20191115032603.GG793701@kroah.com> <878soha7tc.fsf@unikie.com> <20191115082022.GB55909@kroah.com> <8736epa202.fsf@unikie.com> <20191115101902.GB337025@kroah.com> Date: Fri, 15 Nov 2019 12:32:31 +0200 In-Reply-To: <20191115101902.GB337025@kroah.com> (Greg Kroah-Hartman's message of "Fri, 15 Nov 2019 18:19:02 +0800") Message-ID: <87y2wh8m68.fsf@unikie.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 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 Greg Kroah-Hartman writes: >>=20 >> Ok, did some more debugging on >> this. net/core/net-sysfs.c:netdev_register_kobject is doing >> device_initialize(dev). This is in >> drivers/base/core.c:device_initialize: >>=20 >> * NOTE: Use put_device() to give up your reference instead of freeing >> * @dev directly once you have called this function. >>=20 >> My understanding is that remaining reference on error path is taken by >> device_initialize and as instructed in the note above it should be given >> up using put_device? > > Yes, that is correct. > >> Tested this and it's fixing the memory leak I found in my Syzkaller >> exercise. Addition to that it seems to be fixing also this one: >>=20 >> https://syzkaller.appspot.com/bug?id=3Df5f4af9fb9ffb3112ad6e30f717f769de= cdccdfc > > Great! Care to submit a patch for this? I will submit another patch and Cc you there. This patch should be ignored. BR, Jouni H=C3=B6gander