Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3940686pxj; Mon, 21 Jun 2021 09:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG07MfSsOV0jmwzYHAtZaRIhIsv73NcwqgQnj6pnVz0767bnsgYkYFx5iwfkC33CZ9TDVY X-Received: by 2002:a92:3647:: with SMTP id d7mr18896189ilf.231.1624294196376; Mon, 21 Jun 2021 09:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294196; cv=none; d=google.com; s=arc-20160816; b=f9XXwY4HygCJDSE5KGO0UZYskfk7sV+VdPnU5E2wnIgKunXCqShaFWcfAMUM2YJSZ5 fmYh+MFe5uaUo7+u1nRDXrSTdRMtj6oY6tm/q2s01CT45eXxGHzdu5s2XgeeqOejYzDb tTkOSEkLzyVMGtxoyGYhfMBnyk1upkZnKDNDQ3Q973c6EPKoyXPOpZkuumMz/egfMWIr d+Baz3lsdflLW7rxr1UsO7VbhzS40PdGDuEG2i+UvA2wdvvL+B2zNvBohTsm9pSQjlm7 eCcVKUL4eXTq5oogmKWApVTUzxc2tfhaIqjf2ofvEQ7fXT5LpLzu4vGm5wpe1J50FG4e 8kpA== 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=psjugBR3iXkxM52DWy9rWKTtCb+YqxfekB2luRVaXso=; b=KF0iT2zaC6fYx+94pA52RNQvX1wboI7X2+yyDDUSPxUOKszn/cn+BF9cm8TJMRfUaH RWoXwGbLtFI3ggrcQu1z1ac99pVyFEhYx50uAJyCucrxOKqFYYjx5guLXScvR+KQ8tlC nSuEH6sD/ROyOftw41kAgVAHtN1uVIu8v4hm1be4OAiEm4AKZO8SVJNi6DQme96K2pU3 nKd21IuSsqjndUnV8g2DJWZFtRP/8WMas3XAwwAqCsfAstOAVLe/96W6M0SE/hrFQvH4 mmuO3XaFDvfF86cGOkJGeVHtaFn23WVarg68IN33iP7XVgIoUOGV8YCGcp4JIiJT3wJ7 8M/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RQw8WxV5; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si9696087jam.119.2021.06.21.09.49.43; Mon, 21 Jun 2021 09:49:56 -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=@linuxfoundation.org header.s=korg header.b=RQw8WxV5; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233214AbhFUQtZ (ORCPT + 99 others); Mon, 21 Jun 2021 12:49:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:37050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233684AbhFUQpM (ORCPT ); Mon, 21 Jun 2021 12:45:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C6D76128E; Mon, 21 Jun 2021 16:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293152; bh=gZsWYGD6DSZN9b0ieH25qpJfCk/qelBdQLh26Y8L3ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQw8WxV5PxFSFwefo7z54cPkLJrcyrMZrLTS2wAbQVRpQnmPqGCA/qhxtByB9+ZJ8 80xv+266gomPWLkT4a20wMuK62nj02DAFyHwqVppJlhZXpO/mxMoNTw4PWd15v7QOR YIE6rE9t9n7TPej6lS5fPLwgcqynwHXA+w2v8FlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Norbert Slusarek , Oliver Hartkopp , Marc Kleine-Budde Subject: [PATCH 5.12 117/178] can: bcm: fix infoleak in struct bcm_msg_head Date: Mon, 21 Jun 2021 18:15:31 +0200 Message-Id: <20210621154926.762542509@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@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: Norbert Slusarek commit 5e87ddbe3942e27e939bdc02deb8579b0cbd8ecc upstream. On 64-bit systems, struct bcm_msg_head has an added padding of 4 bytes between struct members count and ival1. Even though all struct members are initialized, the 4-byte hole will contain data from the kernel stack. This patch zeroes out struct bcm_msg_head before usage, preventing infoleaks to userspace. Fixes: ffd980f976e7 ("[CAN]: Add broadcast manager (bcm) protocol") Link: https://lore.kernel.org/r/trinity-7c1b2e82-e34f-4885-8060-2cd7a13769ce-1623532166177@3c-app-gmx-bs52 Cc: linux-stable Signed-off-by: Norbert Slusarek Acked-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/bcm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -402,6 +402,7 @@ static enum hrtimer_restart bcm_tx_timeo if (!op->count && (op->flags & TX_COUNTEVT)) { /* create notification to user */ + memset(&msg_head, 0, sizeof(msg_head)); msg_head.opcode = TX_EXPIRED; msg_head.flags = op->flags; msg_head.count = op->count; @@ -439,6 +440,7 @@ static void bcm_rx_changed(struct bcm_op /* this element is not throttled anymore */ data->flags &= (BCM_CAN_FLAGS_MASK|RX_RECV); + memset(&head, 0, sizeof(head)); head.opcode = RX_CHANGED; head.flags = op->flags; head.count = op->count; @@ -560,6 +562,7 @@ static enum hrtimer_restart bcm_rx_timeo } /* create notification to user */ + memset(&msg_head, 0, sizeof(msg_head)); msg_head.opcode = RX_TIMEOUT; msg_head.flags = op->flags; msg_head.count = op->count;