Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2504726imm; Mon, 24 Sep 2018 05:35:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaSEznKZdd+8PmD3qdv7fkCTB+nBCdgDYgMXIYugirROlFpydW927UMBa+kNGcO9SYE4qD+ X-Received: by 2002:a62:4ec9:: with SMTP id c192-v6mr402502pfb.221.1537792544972; Mon, 24 Sep 2018 05:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792544; cv=none; d=google.com; s=arc-20160816; b=ZJxvl8rDmnU7MNezqZT2j9STaOXlpGszgRV83Qa34HVzjRAJHU7X/JpjOW+Vfe53bF HElOIsuFr+cG8DWMVP+19ebQCYQX70YbPLmGTpHMgOip/1cl0vPgxjwb1QF0MaUMdHvk xJBKVJWASsdIvX44GxnFU18dJ1D1oVM2gGjdih7GYMg34gwQRmwyQq1AoPL8nrKmcQGB t7OL/7ekeXfUcxMza3K47fMWy4kICzJbUZkPKNGlxrmR4GUGkNG4TY0VVLkgQZmGrr8w MDTQcYmJoGZZ7xEhr9n3JJBQAU9BIuaqpZZGzBE95lmx6oYpCGVtCuSGrPWqNkmnfVbg s8Pw== 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; bh=59B8lKyhBdmZVaq0EEh8B9N8AHUyjnz/vB5OawAiBZU=; b=SsI5UQ7UknrzUExPfMQU4fUB/aftNOLFqhtLiTo2cotWBU4F2+aHLy0d2djlkgDXAF Die7AyIcKVNOZrLBrg8MrR3+dHJ2xw9shUfrOqGqPKwLhRlCCSrb89LkmMed9Yns58Hw GVL5s97T7jvDsyzyKaqSb31NBUnaLCI/KwoijqdWsULvyr81B5iJZW/2Ux9U/whuCSh7 STtXHvfCxzYD85oaiN1PIJ6IOm+HhNNE4+GcUayCBsRNnVSmoOKdDaXz2M+mfJM+k4ai yh0t23yy5GRa+6gL3N5koVFWYKdV071H0xiU5GZuJbN/x99eri4w2GwRBS6PDfzxs6ma lPwA== 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 d81-v6si1469753pfm.40.2018.09.24.05.35.29; Mon, 24 Sep 2018 05:35:44 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388095AbeIXSgT (ORCPT + 99 others); Mon, 24 Sep 2018 14:36:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58418 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729816AbeIXSgS (ORCPT ); Mon, 24 Sep 2018 14:36:18 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 91E301018; Mon, 24 Sep 2018 12:34:22 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Hemminger , "K. Y. Srinivasan" Subject: [PATCH 4.18 109/235] vmbus: dont return values for uninitalized channels Date: Mon, 24 Sep 2018 13:51:35 +0200 Message-Id: <20180924113116.640890602@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephen Hemminger commit 6712cc9c22117a8af9f3df272b4a44fd2e4201cd upstream. For unsupported device types, the vmbus channel ringbuffer is never initialized, and therefore reading the sysfs files will return garbage or cause a kernel OOPS. Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info") Signed-off-by: Stephen Hemminger Signed-off-by: K. Y. Srinivasan Cc: # 4.15 Signed-off-by: Greg Kroah-Hartman --- drivers/hv/vmbus_drv.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1178,6 +1178,9 @@ static ssize_t vmbus_chan_attr_show(stru if (!attribute->show) return -EIO; + if (chan->state != CHANNEL_OPENED_STATE) + return -EINVAL; + return attribute->show(chan, buf); }