Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp824570pxb; Tue, 3 Nov 2020 13:35:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+U/MlkOi/UtVMCGHbh0vEPXFvmq/5/f6C9F7zKXOp1MsK060PH3lT3tqgoYjFP6MTHTkQ X-Received: by 2002:a17:907:2677:: with SMTP id ci23mr21982379ejc.270.1604439347448; Tue, 03 Nov 2020 13:35:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439347; cv=none; d=google.com; s=arc-20160816; b=IMa6FuLeHJgCb5TtCA/k0Z0/pHeNo/F/coE1IzSry18luWlWAV/rBRHVATjeTjWqHP RaOH5FWron76jSLt7OFIfuKdk8VGZH2nNgzATbdPBJ23IhHyo/YwWnNnpdCYJBgSoKzu XMOatPljjDEuygints2yCoiD9EDTkpjV61K0COjGrA6V9+o5n4IVOev1vlLlruf/IPBZ ZmSU9WowTdt2O2jqAkAc4ubZOJ9lgJmrvQBvUiptGf4g0FGfBGjhtcHcHKOjVCl3+N1R o9OAwV7UfCa2NjIM/PGmEqAIcFeur03J9un2W/tddklQ2PoLxDXnTDtlsubYwyf6ctNu GzWw== 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=iiPxP48/HXLxGSWWHAumwZoBFbCfzfbOQ/F9mK6Kbr4=; b=IzSdYkWVfU9InNQyhiG+Il+i9w1XA7OgvAjEitdOneD78Wh/HucANBSBhaVGkUpV5K RlsYBCM67WJjN7a8Niun4Q2Xshzt7ToYh8Otmdf2i7YlMdDuNA+iC6ODKa3vmxA2+z4d pVoY7HdVr1+YUR5gE9gy6hLEnWaItKna0vbmNVdqvD9PeQfaKBRk+X5DrsyRrwzaKXrJ nXhu73ZLDNBBKT5cUhkbmwLtNGzkvwQO5TcDt9+iOjSw+/myzjs1QK9+eJxQCXw9uk8n xVGsEbse3XC2/wLUCOdP+/aX/aS5ISSc8q2nn0TUHAwIzNd3NnadVcc/2qDFYv3SO3nc 6h6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UO6lLcGN; 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 r17si16141490eds.37.2020.11.03.13.35.24; Tue, 03 Nov 2020 13:35:47 -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=UO6lLcGN; 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 S1733184AbgKCVcW (ORCPT + 99 others); Tue, 3 Nov 2020 16:32:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:59398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730386AbgKCU5N (ORCPT ); Tue, 3 Nov 2020 15:57:13 -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 EDBAE22226; Tue, 3 Nov 2020 20:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437032; bh=tojmaWMUV3iy/cP86K61ACVA+41ZaEcguQ0S7Wdq04Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UO6lLcGN8sT4ygLRmb6H+YsGao7ZwghNIxtt/r7iHvfXxUFJIOS9x0KWkSSRcpyMp AMlkOSpu2W883p2ceN2mBfdwAFDJsJpyFyZYY5V2+eWuGgv3vIL4o8HMTs/KDdWXg/ OFsIVxl6nSfm9sotpanade2RZUB0DKZqX2Y352R0= 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 5.4 079/214] net: 9p: initialize sun_server.sun_path to have addrs value only when addr is valid Date: Tue, 3 Nov 2020 21:35:27 +0100 Message-Id: <20201103203257.770567375@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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 12ecacf0c55fb..60eb9a2b209be 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -1023,7 +1023,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