Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3209451pxb; Mon, 9 Nov 2020 05:39:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMvkVlAhrvtuvBJ7f+Y1J8F+MgdT7to3WP6/LWnzCX1DQSYneyXpIg6t4BZXOof5KIs7IZ X-Received: by 2002:a05:6402:1456:: with SMTP id d22mr15226690edx.77.1604929179581; Mon, 09 Nov 2020 05:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929179; cv=none; d=google.com; s=arc-20160816; b=wUS6f1ozIPgTVRqaetvujEhiURfSa0BhQWRLn+fgBKjoyDeraszcR0W3axQXxIPlV2 Xqg2u94WJypxCMmMLFkCTUmJyUziJCfgL/kcu+uO0ju4r2ncMJj03KZj+AQ1Cz5Ufqck ++scNSp8IYNFX8qtwfOfRAP0BK2mUj5aS0cZRRFosPpo8aB7QLHTukCG2GTlOm9/2F8/ oqhSOC2gfnUkFv4iUZcRzXQfLhxKWuQI3Ec3UwYedywqGc0OEU82Z389tBXb1qSixKdn wEtw5bVwHKz/Ej811LOqps5h0zPfk7kh3bZotEfqwPypl3lp2pvciFjWU55n1uAwOzVH wNKg== 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=6jfNArv7lIDwvwI1rQBSkeMnaQBcscf0Tz2D9IvIC/8=; b=fVbiST0T/GHZzJeZoZcnpdn+jFYTTuQARgyK4VFD/s8QBcsmiT5EwgvrDHipp8pDOb Eaqq9IRZ9qoXSkQzJ1U3uwcdZo+5sMSqwGlm0RSqM3BxdMlfj8mAbMJMX7TA8OzGTOQL 0vcSwMnGCMn90eFTIilYesZ+5KySjbEM+4tQY1omSMV1zqBNVUYIa7ubutjaN3eo/5SG Awq/zf2B4H1ERlAu1MWyJOoB98y/qzyVGevVxWZzVSI9S+kUkZNjPfcogaz0+Y77H4WW 9w2R4VYZ4KJZhpEZrv2SN10pnGJFcmdk9+4EY/feLVCnwksBKw9kZOzts4N/lyTExiz3 0dYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B9HOFqm5; 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 d19si3279142edq.303.2020.11.09.05.39.15; Mon, 09 Nov 2020 05:39:39 -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=B9HOFqm5; 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 S1730726AbgKINDn (ORCPT + 99 others); Mon, 9 Nov 2020 08:03:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:55428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730560AbgKINB1 (ORCPT ); Mon, 9 Nov 2020 08:01:27 -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 39DB120663; Mon, 9 Nov 2020 13:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926885; bh=EDtVwN3JSegsju5pE85BZdm/GJThnzrY7HU9bmE/3xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B9HOFqm5GqE0k8lx093vRlDkf6nIWFVgsgjP38X6+QoRKEBQwpvWeIzRXDWklMh7H 9jDO1M5okZeYcAo2ZCYfKurNTlw6tUq2MMiHuStZnoES8qVmMIkrsqY0qKSGXF+1oO RVdAAVwRWMUcqLbTHGEPikZmn8RfT8WPJ2XWuyEY= 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.9 037/117] net: 9p: initialize sun_server.sun_path to have addrs value only when addr is valid Date: Mon, 9 Nov 2020 13:54:23 +0100 Message-Id: <20201109125027.413568934@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@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 bad27b0ec65d6..33b317a25a2d5 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -1013,7 +1013,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