Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4479208ivc; Tue, 3 Nov 2020 13:06:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+VQS6jut/uq+w0WMMfKocHQS8pedMIal2guTIKO94S3h7oIzA19+BqWgAlzYuVRGhH0Wl X-Received: by 2002:a17:906:e2c3:: with SMTP id gr3mr21311777ejb.471.1604437587424; Tue, 03 Nov 2020 13:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437587; cv=none; d=google.com; s=arc-20160816; b=kZG8euzu5NlqoRtF20j1uTtDwyKVsbTL45W8HcjLs5eLw8lvHmJ0RLNfzOsX6mi4WY u1M2413VK1wmLpyblLdYdjbKgx818jgTnvMM/KLNtDAbw8fBDU4Z5wJ1Gckibp/KdiA+ 1OdhuV9Zn1rATby4o3Rgr4jWqCy4g+OzXMMih6zo5Gf2L37TrmvF6rjvvX+LOxMTHHAS pO+BQx9PNYc3jJN+oKXRhXV6Yyv4vXi09XnJn84MdWqqOgCyamSzU82/okV8wSV4TIFG fFViu9tA84rUR+8PTHJqMOSF5aHbZTnqSjsWVL0IreoSWLHUaeogBPXaOPBqxaX7NAmQ lypA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bN8q7CtB2WoPFYsQ+K7xXrVMaZnrNM9upbsNEm5KWkY=; b=tf20lDk3U9fcZpE6B4T06QAP2vrt9Kxo1RXKMIUm+2lxvkZh/CPX7qs7IGYYcGYUNg DTdl0lLdCXnHx1CI+SJNa0/gxTcebtZbI4bmgLcu80nDaOLfLrgcNLMhggkFN2fhfP83 yvcNCb2VoKpNXDxVvvKXqbf1MkuvNXsV2fuF9+80bX/Zb2qBaBRAL0zGUsXQGFCevz0D TR61u7Xl57aONd4ZacmWQSAniVUWFiEqywoTOdZtfSTEAFSw1Ym1B+99EL/YjLQ7Ph2+ BeJNppXs1QddfRbBgBa8prNW97BB/uPlCXuYDv+tGYC6Mq4nbbSXlpYXUN0pPA3lKwGM 5V9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qriT3jKU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si4252509edv.433.2020.11.03.13.06.04; Tue, 03 Nov 2020 13:06:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qriT3jKU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388034AbgKCVEv (ORCPT + 99 others); Tue, 3 Nov 2020 16:04:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:42950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388025AbgKCVEq (ORCPT ); Tue, 3 Nov 2020 16:04:46 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 B6E9F20658; Tue, 3 Nov 2020 21:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437486; bh=TFjh0sAIslQkKxg1R6R4R3LdqE9rg+jVnb4eMRp5rdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qriT3jKUBp5YrNSsHfEFmJfm/a13QO2t6gdRMcDGHmsBGPCm3POGgtk9nF2t+WzSL fha1y+iWHmXVVgTlKgMEqPia9q/ldKYItSxPPcc2r8iBZTM1PnL+vyYZXz0gk9+l1x ypD45/i7WrgCFoyyqleBGH3tJiJDu/Rk6uwahlIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com, Anant Thazhemadam , Dominique Martinet , Sasha Levin Subject: [PATCH 4.19 098/191] net: 9p: initialize sun_server.sun_path to have addrs value only when addr is valid Date: Tue, 3 Nov 2020 21:36:30 +0100 Message-Id: <20201103203242.956970230@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anant Thazhemadam [ Upstream commit 7ca1db21ef8e0e6725b4d25deed1ca196f7efb28 ] In p9_fd_create_unix, checking is performed to see if the addr (passed as an argument) is NULL or not. However, no check is performed to see if addr is a valid address, i.e., it doesn't entirely consist of only 0's. The initialization of sun_server.sun_path to be equal to this faulty addr value leads to an uninitialized variable, as detected by KMSAN. Checking for this (faulty addr) and returning a negative error number appropriately, resolves this issue. Link: http://lkml.kernel.org/r/20201012042404.2508-1-anant.thazhemadam@gmail.com Reported-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com Tested-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com Signed-off-by: Anant Thazhemadam Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- net/9p/trans_fd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index b6dcb40fa8a7d..9268f808afc08 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -1038,7 +1038,7 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) csocket = NULL; - if (addr == NULL) + if (!addr || !strlen(addr)) return -EINVAL; if (strlen(addr) >= UNIX_PATH_MAX) { -- 2.27.0