Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp461872yba; Wed, 15 May 2019 04:32:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzM8nwkNUAKWNcpkdQ1Q5yzAwhmhS1j3E75322gaUvJzOraUH640kgutPoyHyaBOzRATRe0 X-Received: by 2002:aa7:9289:: with SMTP id j9mr1705154pfa.251.1557919924949; Wed, 15 May 2019 04:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557919924; cv=none; d=google.com; s=arc-20160816; b=zKtH6BCeEnzCvIXuoDXYhs588O7AENth0W7SUlF1S1MC4IWhv+U9xbxQZcwJqxn65I b78wDHktQ1cHBaIrJ2PoJpKJPNJih5bqIpzCohOW1+3xEWKQOHpU/68bfpzRkPKgmChD 0Beqq1EdFMeLx9z6ligMDLy1Ol+zvfodj7LyyzALL7or967N2KERZrioO3NLd9I5GZ6K 2+RmCJIE5vrkmChIe5x+6wuQDhQmNiaUAjV8h1TlqmOdgAH9SS9KdMbApTn05xf0dTw2 EpkJcnNmp9avYyfXo6sOSjdInCWvBwpPDmjXnX7S+FvbFegzbWskGt+EAAw5zjbuL5ER EtSg== 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:dkim-signature; bh=B9bIzM2/ZZEu5WOOy5P27jpy41ljD4odtW6oT+veGJg=; b=aGGEDgRB4SSIqQUHq3Y7r3IyqmNpl331UEwSMyk63lUJxda3Rp1D2We03SmUDv3NbE s1iinf5zzGnmViRNKpFqvCeaMuj9w4QkHZcosPVuqas4A6pcT4+MzWTWg3sK5eSkbdMq hkE/4yhUc9rp7NeN9WMNAiYJfZeTtKnVTA8DCghDXwum6RRqcFcuU8DYrzSk8lVzCGRP daR1VDZpF4YmCugVCcOZ4xUbdzF5nRRXq9srIMPt2ANUGnZbwUsKGjKv8Ipzcx6L9r82 aDKjAPiYPcXWWsUAvBXLMu847nBWK3CaAEqjklA9aYUYr9M/l1Pgyz/Xb536eXu8t2rw f16w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fIvCw+uO; 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 j1si1565015pld.399.2019.05.15.04.31.49; Wed, 15 May 2019 04:32:04 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fIvCw+uO; 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 S1731749AbfEOL3P (ORCPT + 99 others); Wed, 15 May 2019 07:29:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:40422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731818AbfEOL3M (ORCPT ); Wed, 15 May 2019 07:29:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 94FBF20843; Wed, 15 May 2019 11:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919752; bh=Yx3WQak/aTWgcbpjeR3qw4nu2BfrfB+OfSk2eJbZTyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIvCw+uOWc6xo9+naTPoOo0vpw/FWLoWsDbMb66BCK+fDVAM8cg/4oCEo9QesCmjX vX6Tyxr0iHLMgsPAJ9wBMthOt3RupA5298sx9Qc894y1WkJyKQWfYZ3Bc6UzhDu9NS ymQNbTga5GydX8mHGTo3sUc3lL4k5uJTnSw2WDts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 5.0 036/137] mISDN: Check address length before reading address family Date: Wed, 15 May 2019 12:55:17 +0200 Message-Id: <20190515090655.987485141@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 238ffdc49ef98b15819cfd5e3fb23194e3ea3d39 ] KMSAN will complain if valid address length passed to bind() is shorter than sizeof("struct sockaddr_mISDN"->family) bytes. Signed-off-by: Tetsuo Handa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index 15d3ca37669a4..04da3a17cd950 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c @@ -710,10 +710,10 @@ base_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) struct sock *sk = sock->sk; int err = 0; - if (!maddr || maddr->family != AF_ISDN) + if (addr_len < sizeof(struct sockaddr_mISDN)) return -EINVAL; - if (addr_len < sizeof(struct sockaddr_mISDN)) + if (!maddr || maddr->family != AF_ISDN) return -EINVAL; lock_sock(sk); -- 2.20.1