Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5361578ybl; Tue, 27 Aug 2019 03:32:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3W53rc4LTtqoOmwcx5k5Kn9XJDtxcoRbYbsRFATZ3ym7MsNwzlqRy9a1nWETcugPZxUoQ X-Received: by 2002:a63:d315:: with SMTP id b21mr21125370pgg.326.1566901947017; Tue, 27 Aug 2019 03:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566901947; cv=none; d=google.com; s=arc-20160816; b=LP3Adn+RMAsk4CiYHrqWLo+Sl/d3NbtB0R6fHbC8iKq2Wy3v01zgTyjpYZ6xHUGCnZ 8Iku0zV80X9byUcp720tI0b5L0Bmn77WdrqdR22mLH7KLFkqj6l54vo70ZSD42elz85N FMPGrCanEvU0e2qfj6wRoDEMR7f66O4U3pwWFQOkdPreZgKsGxUjC95L4FQdSMPZaRQZ aYrlp9oY2Opxojs98hvjyQWHcWlaWk/dETgbY0kj8PIJLX2U+gGYlXiUhe7Scp/Yd8Bu 9lwZjlysiZcBXzG/R/RNGSpgRsfb9iFxAfnIv6sTtuk4Vl7uQsj+OjgQc3cT705EGWV5 VXdg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=zFdCvjisfDYhqHSUgKKS8zTQVNpKkaoZf0qbz1xhEcQ=; b=L26F7W1hFkkA110vINpE8lniVzuCyEW541JjujgpGq4qbyiHtncktp4wQy/DTjCtVB 0ekYXvn2vTYVwvsnJl7JZvO2gPFVIw8S2/fm3XTqGOQ1fIokId3yOT4sm0tDNhT5uiQC 0zVPznOqVEV8n5if/3cdrltjAGxmTZ259sgjdiiSx4d3ilzKXOoBYLJC7vdO3QIPYFz1 z5cMJZalJUKyXJhYnYjervgpKBFISbQ1YXi+knTEH81VYK/t6qLbovFMRbcwOp0Siiwp ezpGVFK1Al7giCsoh5zB8/sCIGVQoJWQpkQ3HmSRPvXhlPFjQoGwYaPzuEYGW9oMcar6 cVMA== 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 b3si12572174pld.356.2019.08.27.03.32.09; Tue, 27 Aug 2019 03:32:27 -0700 (PDT) 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 S1729378AbfH0K3g (ORCPT + 99 others); Tue, 27 Aug 2019 06:29:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43644 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbfH0K3g (ORCPT ); Tue, 27 Aug 2019 06:29:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D8613C93; Tue, 27 Aug 2019 10:29:36 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C98A45CB; Tue, 27 Aug 2019 10:29:31 +0000 (UTC) Date: Tue, 27 Aug 2019 12:29:28 +0200 From: Cornelia Huck To: Parav Pandit Cc: alex.williamson@redhat.com, jiri@mellanox.com, kwankhede@nvidia.com, davem@davemloft.net, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 2/4] mdev: Make mdev alias unique among all mdevs Message-ID: <20190827122928.752e763b.cohuck@redhat.com> In-Reply-To: <20190826204119.54386-3-parav@mellanox.com> References: <20190826204119.54386-1-parav@mellanox.com> <20190826204119.54386-3-parav@mellanox.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 27 Aug 2019 10:29:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Aug 2019 15:41:17 -0500 Parav Pandit wrote: > Mdev alias should be unique among all the mdevs, so that when such alias > is used by the mdev users to derive other objects, there is no > collision in a given system. > > Signed-off-by: Parav Pandit > --- > drivers/vfio/mdev/mdev_core.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c > index e825ff38b037..6eb37f0c6369 100644 > --- a/drivers/vfio/mdev/mdev_core.c > +++ b/drivers/vfio/mdev/mdev_core.c > @@ -375,6 +375,11 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, > ret = -EEXIST; > goto mdev_fail; > } > + if (tmp->alias && strcmp(tmp->alias, alias) == 0) { Any way we can relay to the caller that the uuid was fine, but that we had a hash collision? Duplicate uuids are much more obvious than a collision here. > + mutex_unlock(&mdev_list_lock); > + ret = -EEXIST; > + goto mdev_fail; > + } > } > > mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);