Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1137101ybg; Mon, 27 Jul 2020 08:47:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCoNYdq3gMpcvPIQVNQWf3rJd/0UA3oE+B9uB4aD87d9HLi6zhr7Q9zi9X4H0tDvQJM1CD X-Received: by 2002:a17:906:70cf:: with SMTP id g15mr20478017ejk.531.1595864867113; Mon, 27 Jul 2020 08:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595864867; cv=none; d=google.com; s=arc-20160816; b=QHGlERVgY1MnY56X9MoFyjO/+FtCJCbXph+s9lK3yEAWWOi6Fi3HFgdtq2h7iGebdL wyM+S0m7tauAb0PES1NkH1jpllJzqK1ldurYNoeyb0xa5RIECNvzLw4nTgyXpfXdCRcy 2YpSdF5gdwbdiJRGr+j7emDlrAM6iIj+ef3fejHy1YZp8SePUlIBpbWhsfeep5pgmSG+ BzOlX4kc0WJL/duZDNYw/LHpC2P8tM9Gyo5mQfRmkSAui0Z2gGKy0Fv6z4witLLHmYEd ZaNaPBw2tKJ/yzLUV3cYxnefZPsuHopicUqoP0h/OtST/iYYCierdfCXozD5pzguiEv7 fGCQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eq6Q8ztU/SV0qKLD6bpCFHf5g7ycq71mi8wbaYyCfwM=; b=0SkFPnLrcpYFualKjtmym3qIyyu9Zf8E3sPVUgbOt/BtCgGkOWadZgEKFCn6TwRaO8 BtGutkWzHTF0PktQNouZDTpUxN7dE2rh1eD5RetzbH+zU4+tZkUu5Lgu5eS+1jov7svd +LU4cGupCSYnrXL/7F/tfH9MJtGoTGMs0DOIgr01vof2cNRCXfIlXek4JcbzCo8Ly+Av DTpDXPcRi4ATF78NAOWPvRl8rQtQWEX5acMpmCLERyG0DrGTSw00pvO40bkR39FXA0T8 hEobKl5Ki/YREwP/MmtZh7uonwW/S+zxeW2tyZkpDbmCvs5LMqlWrppk8B+XrGKlevIv O8XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=useCPffe; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr3si6005342ejb.525.2020.07.27.08.47.24; Mon, 27 Jul 2020 08:47:47 -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=@gmail.com header.s=20161025 header.b=useCPffe; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730973AbgG0Pqn (ORCPT + 99 others); Mon, 27 Jul 2020 11:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729040AbgG0Pqn (ORCPT ); Mon, 27 Jul 2020 11:46:43 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50869C061794 for ; Mon, 27 Jul 2020 08:46:43 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id b14so13943468qkn.4 for ; Mon, 27 Jul 2020 08:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eq6Q8ztU/SV0qKLD6bpCFHf5g7ycq71mi8wbaYyCfwM=; b=useCPfferacyo/0JUXOwYUSEUXb19osX2BOfpi1ycjVc26Azr4WGsIO+HRRWYTQr30 ySYFahM0ujDCbR+y3GgsggUMD87PZjJagx6VbBz9Vl6sire8+gHrnPbKMCOGyTfujuv2 RcQgoQWn38hlsB6hYzRNKe3yQfu11PHLhztVBbtLsP5nvUSCSOqDLKfV7HJR0So428Kx vzVnQEAK+vY+ePlywy2k6mxRztpQxEbhVd9c0M/oK7EzxRiqm7cmvka0Mkb1byNec6lO 7NMb6BRwQs5LTdbinevBq0SBoK/XHbKto6yTn1+SYs+JjMMutAWY2c6AnDIYoCHLbLmS bzeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eq6Q8ztU/SV0qKLD6bpCFHf5g7ycq71mi8wbaYyCfwM=; b=ZqcBuHy3xFiMgS2nvtazsxCLNTAKh05VRThExKM3lCT23ZZu1F5MksvMRw01+0vuB6 sY7wGvRK8lB4ugjB/GeSwgXoqFCAfSqFmhYqsfsegYv6lIyRtlZH75YjB6AZo8bscYzi jbHywXU5zIzIJwTiTxit6q5ltWegtT8WFZ3pfUwvJCayTQdm/1mfLudd8TTWVCgxvIsq E9LEdgZbqkG5N55CES42rMSdLblSQeTYPox8VqCK+w7d78yWFmX+YAvAzogdWmFu72Jn bUanS4qlmFokynBzrtBI8VjEw0SVNVILT9+sfb74lJmtTCriGo+K/rOwYgFFF4N2dCrd B47w== X-Gm-Message-State: AOAM530xFzQtbDCersWaJpvEI/AEBCf2lFRVWkKpjVY5e/gdRLQ9jyTC JJ5mpWhbCvjZs8BrtzwZFOri51dcTA== X-Received: by 2002:a05:620a:1089:: with SMTP id g9mr23428430qkk.252.1595864802583; Mon, 27 Jul 2020 08:46:42 -0700 (PDT) Received: from localhost.localdomain ([209.94.141.207]) by smtp.gmail.com with ESMTPSA id w18sm14390947qtn.3.2020.07.27.08.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 08:46:42 -0700 (PDT) From: Peilin Ye To: Stefan Richter Cc: Peilin Ye , Dan Carpenter , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel-mentees@lists.linuxfoundation.org, linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [Linux-kernel-mentees] [PATCH v2] firewire: Prevent kernel-infoleak in ioctl_get_info() Date: Mon, 27 Jul 2020 11:45:21 -0400 Message-Id: <20200727154521.315774-1-yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200727151537.315023-1-yepeilin.cs@gmail.com> References: <20200727151537.315023-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ioctl_get_info() is copying uninitialized stack memory to userspace due to the compiler not initializing holes in statically allocated structures. Fix it by initializing `event` using memset() in fill_bus_reset_event(). Cc: stable@vger.kernel.org Fixes: 344bbc4de14e ("firewire: Generalize get_config_rom to get_info.") Suggested-by: Dan Carpenter Suggested-by: Arnd Bergmann Acked-by: Arnd Bergmann Signed-off-by: Peilin Ye --- Change in v2: - Add an appropriate `Fixes` tag. (Suggested by Arnd Bergmann ) drivers/firewire/core-cdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index fb6c651214f3..2341d762df5b 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -340,6 +340,8 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event, { struct fw_card *card = client->device->card; + memset(event, 0, sizeof(*event)); + spin_lock_irq(&card->lock); event->closure = client->bus_reset_closure; -- 2.25.1