Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1380911imu; Thu, 13 Dec 2018 14:11:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UygSg8fM5oJnzWpSSZq0zFM0mSFz/xuAMaBna7a/Hy2d5uDu3Z1UdeIKCcT6puNgupAHT9 X-Received: by 2002:a63:3858:: with SMTP id h24mr473359pgn.300.1544739116121; Thu, 13 Dec 2018 14:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544739116; cv=none; d=google.com; s=arc-20160816; b=PIosejC1cKBO78NM0pTLuNSMPUIrWqGr2ULlkwXTYCU4geB4KgQ9TCA+KHVfz8K0B/ PHUtrG19YyUYN7NWz4P4a1H6a1QPilMYiM35jeIrANeh7eoCRBAccIXxDZD4jps9aVay IYVRCaD7U1LkDMQdBO7wb4yxyRQfs5zyu0qm2hzjtnft8bbuAMOKlz7SMAJ9M3u8f8Yt Hw0bsK2mUgtw12wt/aho1w0W90IA8HMPeO/MkM8B7Noi4PrIhKBD/O3WN79LxtfwpVTe KYe5uWV/Lmf652PhmL1fXt593pIOWW7fEOxG6W4xcLevLg+foyfu1hx4ysrb9/HlEyRB 73Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7B5ot9nWHjfgACg4Rkh14ah9ZqtbjUwPLbTohYUiZgY=; b=gZGt8yQ6zlwFs6z74iCa7lARjP/UWfbQeUYcATMMvMSwqs0wNHEycJl2Am6FEB043B z/Sp8cANZj5p6kS2uJfGjBTtTE4MPvVotSZaHpNhvHZ3VzzuCDbBloF2qrhKDGF4qI/b MTwS42YF10FBt61yp1q+IJbQVd62Z7V2Z09wsHfpq1Shb7wrceJM3rAptPrcEeOzgyBj 9f0siPJqdVNpun2pdLTfJm7c16ZKRi5Q7+huVXakfe+/qeF9B+HmYcDcC8WS6vZWbpxt 1CG2p/VIYtEQBKA2abf81/5+cmgjM32OZeTS2Kls7N9Ah9iK/SzyTlG3J9V/ABGNf5QQ a0wg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l66si1632707pga.151.2018.12.13.14.11.40; Thu, 13 Dec 2018 14:11:56 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728021AbeLMWKo (ORCPT + 99 others); Thu, 13 Dec 2018 17:10:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42254 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbeLMWKn (ORCPT ); Thu, 13 Dec 2018 17:10:43 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62602653C7; Thu, 13 Dec 2018 22:10:43 +0000 (UTC) Received: from treble (ovpn-120-195.rdu2.redhat.com [10.10.120.195]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75D3A19008; Thu, 13 Dec 2018 22:10:39 +0000 (UTC) Date: Thu, 13 Dec 2018 16:10:37 -0600 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu Subject: Re: [PATCH v14 03/11] livepatch: Consolidate klp_free functions Message-ID: <20181213221037.qaxd5jswdrbv5oxz@treble> References: <20181129094431.7801-1-pmladek@suse.com> <20181129094431.7801-4-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181129094431.7801-4-pmladek@suse.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 13 Dec 2018 22:10:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 10:44:23AM +0100, Petr Mladek wrote: > +static void klp_free_funcs(struct klp_object *obj) > { > struct klp_func *func; > > - for (func = obj->funcs; func->old_name && func != limit; func++) > - kobject_put(&func->kobj); > + klp_for_each_func(obj, func) { > + /* Might be called from klp_init_patch() error path. */ > + if (func->kobj_alive) { > + func->kobj_alive = false; > + kobject_put(&func->kobj); > + } Why does it set 'kobj_alive' to false? The value will never be read again anyway, right? Also, the name isn't quite right. The kobject is technically still alive here, and may even continue to be alive after the kobject_put(), if there's a sysfs reference to it somewhere. Maybe it should be called something like 'kobj_initialized' instead. Then it doesn't ever need to be set to false -- unless I'm missing something. (And the same comment for the other 'kobj_alive' fields in klp_object/patch.) -- Josh