Message ID | 20230130113036.7087-2-jgross@suse.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2133051wrn; Mon, 30 Jan 2023 03:47:19 -0800 (PST) X-Google-Smtp-Source: AK7set/pQbZNOG3u0qHqixD0RkmC7IIJF2zz+02yyEw+iByZB15ycRYBXs5uYxid3Zd7gzbbKqCg X-Received: by 2002:a17:906:e2d1:b0:878:702c:bd86 with SMTP id gr17-20020a170906e2d100b00878702cbd86mr14082877ejb.74.1675079239695; Mon, 30 Jan 2023 03:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675079239; cv=none; d=google.com; s=arc-20160816; b=XqkVF12psnsp9NM6hBU7X/9qFsuBTR4Q/kJPzDJJUUN7T/K8B/KQZ8JrBDTQjoORal y0JBUJIrrjIYTKnSSkaaem5SXTffnn7mDWBS6x+9OysMRIkensH/IhWe5UvQmjcamYJH ecg3wU4PO+IUWXZjP0O9d9sfHhakNC4n+5D0csSFGNVOVB4nNJ9f/BHDEMEMGUU4ObJy rWy1D+eG+Sy2QpoqSJEEWSIUyYVQ2PdgwTWUhQQu3MvEPI2O2f+bAFEMNNs7naCZv1ZF +Xy0DfKfo9jgW2jTF0aAx9NvuLtwM7H7nQOYew6wB1rjhn/PiAw5L8HTqlxpxW+28lfD nxFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qviUM8UM8K0sUVl1CBj5NTWfqEBaR5N6NdZBj3tn208=; b=vZoMqVK567TBXnhBVDmWrMlQfjq10os3OJBpziuR7Gr1Hu0E8LtvfUiFAj423DOGiv sprOv1DTljV7a0rszNVZ/0dl1gIDl0mzLKMUYx8+gV5DguclhO/EIyI6C23/HX5MCUTM ftfY2zgpDnsg22ue09WQR67x7FRYBJu9c0GgKe8z3xeyFgE/1Itv3qcv5MhLqm39O5C1 0y3dcjkT1mh/OH0Ae34gBafPkv3QR7jRNjo1tYH6D+qYPM2D/T2nPlzgmJUsXuZ6PBzr VNdo7NPl2xtA1+1ub+mJaJ23/aF95GGRsZKrx+MoOHmbxNnKoMqK8gXfy+Djo8DlZ/JF 7Y4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UF2rIHgn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a170906000c00b008786a9dcae3si15035883eja.296.2023.01.30.03.46.56; Mon, 30 Jan 2023 03:47:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UF2rIHgn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236637AbjA3La6 (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Mon, 30 Jan 2023 06:30:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236630AbjA3Lav (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 30 Jan 2023 06:30:51 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D0DCEB4D; Mon, 30 Jan 2023 03:30:47 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D2B541FDCD; Mon, 30 Jan 2023 11:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1675078245; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qviUM8UM8K0sUVl1CBj5NTWfqEBaR5N6NdZBj3tn208=; b=UF2rIHgnaUIktM11KSYG5U2h+oe0l5FVKifw+ts67xZlu7np7lB4W0YPS91C8aWC4rGXhT MQwbi7wGYlC7ZgR0TYC3rlYk4mj7RRCLc6xiH2GIZCR58u9Se2h3uxH5G0OFhVG8w8/y+4 uTXHK70Ch/j0XnnNNmv0prDLt+JrpdU= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 87DC813A06; Mon, 30 Jan 2023 11:30:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RkIKIGWq12PQJQAAMHmgww (envelope-from <jgross@suse.com>); Mon, 30 Jan 2023 11:30:45 +0000 From: Juergen Gross <jgross@suse.com> To: linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org Cc: Juergen Gross <jgross@suse.com>, Eric Van Hensbergen <ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net>, Dominique Martinet <asmadeus@codewreck.org>, Christian Schoenebeck <linux_oss@crudebyte.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Subject: [PATCH 1/2] 9p/xen: fix version parsing Date: Mon, 30 Jan 2023 12:30:35 +0100 Message-Id: <20230130113036.7087-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230130113036.7087-1-jgross@suse.com> References: <20230130113036.7087-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756447888413085026?= X-GMAIL-MSGID: =?utf-8?q?1756447888413085026?= |
Series |
9p/xen: fix 2 issues with connecting to backend
|
|
Commit Message
Juergen Gross
Jan. 30, 2023, 11:30 a.m. UTC
When connecting the Xen 9pfs frontend to the backend, the "versions"
Xenstore entry written by the backend is parsed in a wrong way.
The "versions" entry is defined to contain the versions supported by
the backend separated by commas (e.g. "1,2"). Today only version "1"
is defined. Unfortunately the frontend doesn't look for "1" being
listed in the entry, but it is expecting the entry to have the value
"1".
This will result in failure as soon as the backend will support e.g.
versions "1" and "2".
Fix that by scanning the entry correctly.
Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
net/9p/trans_xen.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Comments
On Mon, Jan 30, 2023 at 12:30:35PM +0100, Juergen Gross wrote: > When connecting the Xen 9pfs frontend to the backend, the "versions" > Xenstore entry written by the backend is parsed in a wrong way. > > The "versions" entry is defined to contain the versions supported by > the backend separated by commas (e.g. "1,2"). Today only version "1" > is defined. Unfortunately the frontend doesn't look for "1" being > listed in the entry, but it is expecting the entry to have the value > "1". > > This will result in failure as soon as the backend will support e.g. > versions "1" and "2". > > Fix that by scanning the entry correctly. > > Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend") > Signed-off-by: Juergen Gross <jgross@suse.com> It's unclear if this series is targeted at 'net' or 'net-next'. FWIIW, I feel I feel it would be more appropriate for the latter as these do not feel like bug fixes: feel free to differ on that. Regardless, Reviewed-by: Simon Horman <simon.horman@corigine.com>
On 31.01.23 19:48, Simon Horman wrote: > On Mon, Jan 30, 2023 at 12:30:35PM +0100, Juergen Gross wrote: >> When connecting the Xen 9pfs frontend to the backend, the "versions" >> Xenstore entry written by the backend is parsed in a wrong way. >> >> The "versions" entry is defined to contain the versions supported by >> the backend separated by commas (e.g. "1,2"). Today only version "1" >> is defined. Unfortunately the frontend doesn't look for "1" being >> listed in the entry, but it is expecting the entry to have the value >> "1". >> >> This will result in failure as soon as the backend will support e.g. >> versions "1" and "2". >> >> Fix that by scanning the entry correctly. >> >> Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend") >> Signed-off-by: Juergen Gross <jgross@suse.com> > > It's unclear if this series is targeted at 'net' or 'net-next'. > FWIIW, I feel I feel it would be more appropriate for the latter > as these do not feel like bug fixes: feel free to differ on that. I'm fine with net-next. Right now there is no problem with the current behavior. This will change only in case Xen starts to support a new transport version. For the other patch the problem would show up only if Xen starts supporting dynamical attach/detach of 9pfs devices, which is not the case right now. > > Regardless, > > Reviewed-by: Simon Horman <simon.horman@corigine.com> > Thanks, Juergen
Juergen Gross wrote on Wed, Feb 01, 2023 at 07:37:04AM +0100: > > It's unclear if this series is targeted at 'net' or 'net-next'. > > FWIIW, I feel I feel it would be more appropriate for the latter > > as these do not feel like bug fixes: feel free to differ on that. > > I'm fine with net-next. It doesn't look like it got picked up in net-next, so I'm queueing it up in the 9p tree. Thanks for the patches and the review!
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 82c7005ede65..ad2947a3b376 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -378,13 +378,19 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev, int ret, i; struct xenbus_transaction xbt; struct xen_9pfs_front_priv *priv = NULL; - char *versions; + char *versions, *v; unsigned int max_rings, max_ring_order, len = 0; versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len); if (IS_ERR(versions)) return PTR_ERR(versions); - if (strcmp(versions, "1")) { + for (v = versions; *v; v++) { + if (simple_strtoul(v, &v, 10) == 1) { + v = NULL; + break; + } + } + if (v) { kfree(versions); return -EINVAL; }