Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1113131ybl; Tue, 3 Dec 2019 01:49:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw+BnVZYwCwXVROuyennnSVCzFGuyIadrXy3QJQeupsKqKGiLugIuWqV69dUDQk35+qSx4h X-Received: by 2002:a9d:6a98:: with SMTP id l24mr2577842otq.160.1575366573281; Tue, 03 Dec 2019 01:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575366573; cv=none; d=google.com; s=arc-20160816; b=OwFchhFZPpJwdUYIVfcGxVOTIhGnbnNoc5RKW+AwClcRT3vZEJMzQIlrbXPLL6IviC qXM++inR26tnj6ZSlABU57kTdJ2jrgQVcHePiebhTA7QK4EQ845u+ooXWnK2jJuJScUv lTgERuJ1fCwCg7EvK2wWkEy82UzAJCrfbw/ZjPW4piR+kTYsGB6WWwkbRvWmDsosx36J QIR55iYTlIkKT0B8sAP8ntQhXsPSfjcZ2oKqBM+gJQglucMrSGbsJpIndnW/F48gJvBf hmm5UJXdPAyxQ7hSKbO4ioVsOJ0oH5JRZVtplEc1Q+wk1iQlXI+jcJt/BmJDRr8R28bs u8lw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=HfSOXGBITlFr0aDbwgi1r+oHbSrMjhir8QbtOOr5lJg=; b=pp5FC6iG4PEAYKrArV/6sPFOVuxtJWZyQ6jQaZLcDGrEWUnE9Zt+R0b72ZcXA7Lc7q IK8Fkkzb+seeXP2nPyb7TZ0KqjXOe0PtLO8WrRmQXE+njyj3TZMqxvPQpmACidEXNt31 4DIoMMPh501DZA132rGjekq2tE3PbhUacE1cujinXpFllY3TMqzjg4hXD79lxpRZJ4D7 HPxmVEowQyZbzD4cLsuPEDsV6S0Q6OhY0zlu+gY57cWJTV5QPerhKcO6+o8rZKkuZc+k SN6UQobMQBwU+C6nneN6/sDJjxdRXLqE6BlbERIhk8xtOi4RezDETcnP48/SB/mQ7d3b 6FGg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si1004065otq.141.2019.12.03.01.49.21; Tue, 03 Dec 2019 01:49:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfLCJrp (ORCPT + 99 others); Tue, 3 Dec 2019 04:47:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:56108 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725773AbfLCJro (ORCPT ); Tue, 3 Dec 2019 04:47:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F041EAF47; Tue, 3 Dec 2019 09:47:42 +0000 (UTC) Subject: Re: [PATCH v3 1/2] xen/xenbus: reference count registered modules To: Paul Durrant Cc: xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Stefano Stabellini , Boris Ostrovsky , Juergen Gross References: <20191202114117.1264-1-pdurrant@amazon.com> <20191202114117.1264-2-pdurrant@amazon.com> From: Jan Beulich Message-ID: Date: Tue, 3 Dec 2019 10:47:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191202114117.1264-2-pdurrant@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02.12.2019 12:41, Paul Durrant wrote: > To prevent a PV driver module being removed whilst attached to its other > end, and hence xenbus calling into potentially invalid text, take a > reference on the module before calling the probe() method (dropping it if > unsuccessful) and drop the reference after returning from the remove() > method. > > Suggested-by: Jan Beulich > Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich with ... > --- a/drivers/xen/xenbus/xenbus_probe.c > +++ b/drivers/xen/xenbus/xenbus_probe.c > @@ -232,9 +232,16 @@ int xenbus_dev_probe(struct device *_dev) > return err; > } > > + if (!try_module_get(drv->driver.owner)) { > + dev_warn(&dev->dev, "failed to acquire module reference on '%s'.\n", > + drv->driver.name); ... perhaps the full stop dropped here and ... > + err = -ESRCH; > + goto fail; > + } ... (definitely) indentation here changed to use a tab. Jan