From patchwork Mon Jan 30 11:30:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 50224 Return-Path: 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 + 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 ); 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 ); Mon, 30 Jan 2023 11:30:45 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org Cc: Juergen Gross , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni 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 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: 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?= 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 Reviewed-by: Simon Horman --- net/9p/trans_xen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; }