Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp872821pxx; Tue, 27 Oct 2020 02:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAN/zWiQ5mNWAD9tvyJma5t3SNK/6EctgjLNAw8wDCEVRPt1xAOgFLfUHTGA4BAHA2Xyc5 X-Received: by 2002:a50:d555:: with SMTP id f21mr1284936edj.334.1603791350542; Tue, 27 Oct 2020 02:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603791350; cv=none; d=google.com; s=arc-20160816; b=QertHIEt6ahjpU3OzRe4FSxCY7GJfs7zIo/M9zBGaybF5bD71y9nnN56G1bHVd3V2G oXropl/wc5X1/+yliHAsgappNRQXCdw0dkXvnYR9uL+2eZHoJ3YZ8X0zrYgsPIgge79x hS3d5VvM21GgayH9QZWSBQjlqLm1S5ZISsS7F7sK0BbSmxF8CJwdeSzl+Sp7bYO1G6fo YKeVzWD0dcNIkBkAMCSumlglc9FlAbPdjeVI+bDiO+Vw5S95sPG1MKduamMYBZ7C6MT8 fBbJckYNnH6+ys535MSNi4S/EtU/gJATx7sw3GENuLfB5HqH5vWjhe5F1q2vhaA12G3y bVBA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/ZurCQWMzW3udKQLw2rKOkWrPiHq14hAyYkvBspiXts=; b=yBFC0UXexhMm+CaDEB+lI/kfVYn+MlAo1BTEuxHlvprocky5GzlStJPJHv3nctyaQS 6LYTYtbKuEP+DtZLHiXhEGo/dBm0nRB0eEUbjG5+iV+MPkEOCupmLRt2WBLkU4aR1cBh Ex0uKnUeW8gpTjaTojBPZ7INPWb/Jzx3C5fnl8qEShXQSyjJEyPmfrUA2bl0PbHcJLiF BBpDLKgI3vXCd/i2XqU36Uw5N2TPJu5GHlfuD79cOmf0EDHDMgdwewDXoJxwCryylRrF N2WBv0z3NF9yGL8Mwj5WS73pKSEHJRlAhVMB8AelrbYG4Fy+VvshuNpXhq4uI6H/s+sN b33w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zQKNFd1d; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si489560edq.98.2020.10.27.02.35.29; Tue, 27 Oct 2020 02:35:50 -0700 (PDT) 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=zQKNFd1d; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409538AbgJZXvt (ORCPT + 99 others); Mon, 26 Oct 2020 19:51:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:52186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409404AbgJZXv0 (ORCPT ); Mon, 26 Oct 2020 19:51:26 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24C8520872; Mon, 26 Oct 2020 23:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756286; bh=s0rkcfRo2H2UVNq7sVdFjdowKR+FjljpilL/7POFG58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zQKNFd1dRA7GUl2T0x4sWLtNfpSoO54RNuAq2IsOAr+xAOo2qkrvxRAMaJEisYJ1y JZgijyE6fm5FvNXOAzDOm+eDl8lWPkYZgT4Cfwry0a5s0n+qN1k6EvhQ9LqPhJcI7Z Vx/B8YC6zrQAq81NXBrQAh7j9uNlAveqetwmjnCU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anant Thazhemadam , syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com, Dominique Martinet , Sasha Levin , v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.9 115/147] net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid Date: Mon, 26 Oct 2020 19:48:33 -0400 Message-Id: <20201026234905.1022767-115-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 c0762a302162c..8f528e783a6c5 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.25.1