Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp725712pxb; Tue, 2 Feb 2021 16:49:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfgeVedYHl07Fa65fV50XBKuOUD87HQFirG9xLm6Yut8cEstggl0LISCkL0BA8OkQtNqxa X-Received: by 2002:a50:b223:: with SMTP id o32mr636886edd.79.1612313344034; Tue, 02 Feb 2021 16:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313344; cv=none; d=google.com; s=arc-20160816; b=XXG63vt53qrn2zotU25RKu/XgKb+OfJOm4OMuJiT8dyHawT5045UY6IJm3Y6UKeXg+ XkSYryp0+RmdPRQbRHMOg5ISN4k0JYvCmzGsjJ3A/bAxbYXi95XClqye9fxfsG2WeSf5 JWlt4m68+iow8D3KPsscAxTCKcT4bYD7jM3W1cCoF3Wz3kRd6mT0Xh0UtuDg8F2nuBUQ +0RWCav7EeiaH1qsdchXF3g4RtJpgx2Wv1CbMsRT4vVQdQ+co/oeTVS1KVPqb3pr07iD kHX6wpDZC5QVqBulD4NxCMj5KMCAYEabqVumXbg66hV8/qLlNI/mZkPqE6BkBLh6+U0c pi3g== 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=wqZxGWJafWReJNCnnxmhEvpRLPSrBBiRRV/7vI9/TsY=; b=FtsdbygybC9qYQWxMEkekovYti3P93sNRWvAY52TGMIb9iGVEQCqakjnTmNAkhTrAQ 2nUh53Z2fZnqaX3Aqm6pdgW1YqkntI2CbtqPGsL2yiw8CqsB2v3kxgOjCkZJigJqgvJ7 2CDoTEpMZUSrx935DOM26y4EGAO7Me55b7i9trprI5tY1o3JvDB+4xX7LHyK3WKle4+f As7zxUlFaAJSED9i0Fe6SDzF5DobRfwh99nFPVT1tnNuW3xKKO5TJNB837/NqjDKveY7 vSH2ErWXQMsehCPtj+q+rQJn5n3noSOEpHrYBzZ2YH5zb7qquaSynCjGROXA/NcKaRlS sYEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VMnPL2aG; 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 hq8si294708ejc.65.2021.02.02.16.48.39; Tue, 02 Feb 2021 16:49:04 -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=@linuxfoundation.org header.s=korg header.b=VMnPL2aG; 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 S239968AbhBBTiz (ORCPT + 99 others); Tue, 2 Feb 2021 14:38:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:43044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233281AbhBBNzJ (ORCPT ); Tue, 2 Feb 2021 08:55:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9FE5664FDA; Tue, 2 Feb 2021 13:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273485; bh=p7RgX990Zy43ln7VD0Ml2WPAEEjgm+INSlqnYqdBOAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VMnPL2aGz1SS1AZMbFkGKT7/Qp5xLz/pYw3nQl3fkr1dC3dOcSZBuWiNubsAe0yVq GcCG7aIeJzWkdX2ipMBiF1TT8zSJy/I7bqfCWedp+tbBXgrNoUPHmQwexZ7jTmV+6i LCRoIR/pjiIpmK1EL6FLcd669UEc9cOelkhZUPG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10 125/142] can: dev: prevent potential information leak in can_fill_info() Date: Tue, 2 Feb 2021 14:38:08 +0100 Message-Id: <20210202133002.854597314@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Dan Carpenter [ Upstream commit b552766c872f5b0d90323b24e4c9e8fa67486dd5 ] The "bec" struct isn't necessarily always initialized. For example, the mcp251xfd_get_berr_counter() function doesn't initialize anything if the interface is down. Fixes: 52c793f24054 ("can: netlink support for bus-error reporting and counters") Link: https://lore.kernel.org/r/YAkaRdRJncsJO8Ve@mwanda Signed-off-by: Dan Carpenter Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 09879aea9f7cc..24cd3c1027ecc 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -1163,7 +1163,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) { struct can_priv *priv = netdev_priv(dev); struct can_ctrlmode cm = {.flags = priv->ctrlmode}; - struct can_berr_counter bec; + struct can_berr_counter bec = { }; enum can_state state = priv->state; if (priv->do_get_state) -- 2.27.0