Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp240867ybi; Wed, 29 May 2019 20:27:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7KCTwkgouGv/hkFpLbM1tMN9U0nKivpArXiXLhb923AHMwVRkHa1mXP0l21i7jihBFl0z X-Received: by 2002:aa7:880f:: with SMTP id c15mr1526467pfo.100.1559186846583; Wed, 29 May 2019 20:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186846; cv=none; d=google.com; s=arc-20160816; b=o8JWlTc8SQr66dyTXg/W5BUZ3quJwWJ1RonM+M0Ubrl+pBzn/RH1MSbHygRoj3nC32 zH/dqw4j54++H7J7vAwTQTFQG1zIAi9hchiVz7HV1d/qwDwwKAepFzqm5pCbvuhulPym Bdm+a5BY+cPpXJDyv4Vh0THltx2QBml7mGzHP9M6ztnFf/l3nCbpGYaqwXGPiQBNYWbW yQcoU0ysUz0qdRp4xn6bDjp1kDRaqbpMvuGUU3fGhFhkG/t37KqWZlPIweaQVq2cUQMn OYPJBJ0GdCzytV/zAT+kPwlVd0Ai9fqbSP2h8zFO+DTaA3YV8fmkNHU35U/1zDdX/dZq nYuw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RHYw1XK6LzmQTFsHCEQutChFYAriFpW+REjkCxkEEJQ=; b=ZNM8ODne2tJNyVurHaDoVMIoOd1PWTR6AY+cm1iJvDOEqlWjFcpU4LKIGGsGAH25IB cYoifO4Q93J2w4LyWgVTs7cb5yFg0teFAY94eWKPBCSH3YTgvRdvLe+Y9SPTIji3wKGV Ua95P8ltuBtz2ua3z5sd62JHHFKrzR+vrIarF66c9g+EC7RXENnML4t7VC7oMR9wJxwe jZpXaZPs1eZyUtrdxuxwYvRmE7Q5Pyroz76O6v+W5VHW62ORzBDX+PkX//pfqoYdfrh2 tvSRhqhtGVATgBKBuY3rwM8//qEFQWrPKm2at6NkkI1d+v6CV5rW6TfuX399Az7Ej+62 c0oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b58sU1oW; 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 l1si2019017pgi.278.2019.05.29.20.27.09; Wed, 29 May 2019 20:27:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=b58sU1oW; 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 S1732732AbfE3DZU (ORCPT + 99 others); Wed, 29 May 2019 23:25:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:50856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731535AbfE3DSZ (ORCPT ); Wed, 29 May 2019 23:18:25 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 716282479B; Thu, 30 May 2019 03:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186304; bh=0BK1sgaU5LR/sd1M8lx0WjOwW1JgDyFaTY3j81AsQKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b58sU1oWAf4t95IbV9yYFl1RbyZC6dbqtTro3mlYefI70qWQ839tmGlOaYPuCXX65 axuNOF9+JRBjwb8hUhymKOwpCqThKHvPDiuqQx9Zqthedwu0dIJpHXuWNTNbstZTZW 646Q/mnV61P5nrmWyoz74x8HWOUG17uStbZBBJCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, siliu@redhat.com, Pankaj Gupta , Sasha Levin Subject: [PATCH 4.19 228/276] virtio_console: initialize vtermno value for ports Date: Wed, 29 May 2019 20:06:26 -0700 Message-Id: <20190530030539.365627657@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4b0a2c5ff7215206ea6135a405f17c5f6fca7d00 ] For regular serial ports we do not initialize value of vtermno variable. A garbage value is assigned for non console ports. The value can be observed as a random integer with [1]. [1] vim /sys/kernel/debug/virtio-ports/vport*p* This patch initialize the value of vtermno for console serial ports to '1' and regular serial ports are initiaized to '0'. Reported-by: siliu@redhat.com Signed-off-by: Pankaj Gupta Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/char/virtio_console.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 5b5b5d72eab7f..c55f6aeb4227a 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -75,7 +75,7 @@ struct ports_driver_data { /* All the console devices handled by this driver */ struct list_head consoles; }; -static struct ports_driver_data pdrvdata; +static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; static DEFINE_SPINLOCK(pdrvdata_lock); static DECLARE_COMPLETION(early_console_added); @@ -1405,6 +1405,7 @@ static int add_port(struct ports_device *portdev, u32 id) port->async_queue = NULL; port->cons.ws.ws_row = port->cons.ws.ws_col = 0; + port->cons.vtermno = 0; port->host_connected = port->guest_connected = false; port->stats = (struct port_stats) { 0 }; -- 2.20.1