Message ID | 20230627202800.1.Id63f7f59536d20f1ab83e1abdc1fda1471c7d031@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8458204vqr; Tue, 27 Jun 2023 13:39:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NFz7rL5lwmfjyVx2gK1KTS2KmA+KhHcPgBMN9mY9CBjyFNWb4b0h98/WlIEgb2K+UE8Q9 X-Received: by 2002:a05:6a20:9155:b0:10b:cb87:f5e with SMTP id x21-20020a056a20915500b0010bcb870f5emr24675437pzc.45.1687898363875; Tue, 27 Jun 2023 13:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687898363; cv=none; d=google.com; s=arc-20160816; b=Ye6iVe5w50WiPLC8nsnpnm0ulY+NONzzRXXICxBfFXRSvS6JKrzo0gmzdy7YQvzXps sx99V6BO7Z/jSTCLWcJRWLc0TSVpSdhfLTUYYaNhnFtIKSJRRV14g9OQp90I+YvYLHlG TqWIxeOa1vgXgTHyG7yiHFXR03SEtCFb1a1+dIZjwODupclz8p2kUY9BskipYXRIdV3k wFNB8RgsNTpb3ejssEYT7dMecb+F/o2PlLFXBqZ3/Jol68F2F0wqR2PXLsJMe+8nfv5c Ay8ZTKNs4WkoKV4y67+9FPLl606dPkgDg3g+6NHPRASUk6uMIeySIxok7Z5vI5Yfo/WK Jpqg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=PFLrb4WV2M4S89RJ5tGpysGkvtpZPYvXfwu8Q/oJAtk=; fh=56bAUhIePoFlck3u6e1Zf4811JVzw8+t4SRaD7pZKLo=; b=BpxKOMKOpKVwbIIAeBR/BpLUG54ff9Qezsd3NiYWpBmN5Rc3wnhZTmXKisWjaByxQw EsBmmW5tDNLuR/4Rp8Jr/Pu7plQyJvGPg5JLiOlsICf2jFGJYIYdOVR5Al2sQ0zdrMNZ 57mkVl92R8SxyfGoeIwsD4BG2sQOUZC+9wrLzusInLxTi2O2kfwEX+ENLvdl6Y6aXMUo FsjuYnCy9uv8wpsdQV+YUcvT2xUU7z4AqAgv9ea7RrDjqU8J4DJjQ428se58XGR8kl4T F971/n0looov8ty19y8L54n8HhOrGY4m590A8paLGwUgkjF0REppE84YfV1TZfrsDCvh b3Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YqGAEVAB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a63c144000000b00530b6228f91si8158258pgi.895.2023.06.27.13.39.10; Tue, 27 Jun 2023 13:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YqGAEVAB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbjF0U2w (ORCPT <rfc822;nicolai.engesland@gmail.com> + 99 others); Tue, 27 Jun 2023 16:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbjF0U2u (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Jun 2023 16:28:50 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 069F526BC for <linux-kernel@vger.kernel.org>; Tue, 27 Jun 2023 13:28:49 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-7836272f36eso91628439f.1 for <linux-kernel@vger.kernel.org>; Tue, 27 Jun 2023 13:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687897728; x=1690489728; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PFLrb4WV2M4S89RJ5tGpysGkvtpZPYvXfwu8Q/oJAtk=; b=YqGAEVAB7jKY3SC7JMS+YVlGCMX3bcVrEjuve8PF40RpF5EQXfMiKRzEisKlIoDjiZ EwIwa+P4b2OvYAHRGqWpivlALLBlzKRWraPtNato/tW1mRff5lW4YJrCJx/mSG5elsif 9lU1eNeWLShQXNeyrpCXNtFkGVKh1IW9i/VFI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687897728; x=1690489728; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PFLrb4WV2M4S89RJ5tGpysGkvtpZPYvXfwu8Q/oJAtk=; b=RxrVOTvaBIDfRV680BoPsfcXQqElZ9Cn/MmFZihOZp/FMIEmvP84s0pjs41jYswZRH NwxwPaFPf9JW2psPuE/V875mOyfCSzxdDws30r2odS78eMtHIyIFVzNQwiE4vq/NBKoz INAq/fHbXpfPlMjyVoUa3sUP+UjvNPAJBXMwhhKaFLgh1IT/2lvU8p1Ft73las3Iher2 RR7/kCRoFiHe7LXO1S2H5FPm2QMlCuOJwXaay6oBQQYmM2Qj/rDT0yeq1JXwSduFBEMi I3Ojr8V8Zn934vmgwQu0KgWkWjNaSsWmrzHVLbcj47TxtMolkGOHzujPtBrG0wUqXUEw vJsw== X-Gm-Message-State: AC+VfDyplVjJYC6ompX5IQ3plHmCCZNB+c9U5vpoU0dK0Tz+2Lxc5T9G 6vrjQNkagjRLcswNi4+gENchbg== X-Received: by 2002:a92:d08a:0:b0:345:8373:4ca8 with SMTP id h10-20020a92d08a000000b0034583734ca8mr10285835ilh.27.1687897728420; Tue, 27 Jun 2023 13:28:48 -0700 (PDT) Received: from localhost (30.23.70.34.bc.googleusercontent.com. [34.70.23.30]) by smtp.gmail.com with UTF8SMTPSA id k11-20020a02c64b000000b0042ae80a56d6sm387463jan.73.2023.06.27.13.28.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Jun 2023 13:28:48 -0700 (PDT) From: Matthias Kaehlcke <mka@chromium.org> To: Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, Kees Cook <keescook@chromium.org> Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org, Matthias Kaehlcke <mka@chromium.org>, stable@vger.kernel.org Subject: [PATCH] dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter Date: Tue, 27 Jun 2023 20:28:01 +0000 Message-ID: <20230627202800.1.Id63f7f59536d20f1ab83e1abdc1fda1471c7d031@changeid> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769889714548549069?= X-GMAIL-MSGID: =?utf-8?q?1769889714548549069?= |
Series |
dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter
|
|
Commit Message
Matthias Kaehlcke
June 27, 2023, 8:28 p.m. UTC
Add a NULL check for the 'bdev' parameter of
dm_verity_loadpin_is_bdev_trusted(). The function is called
by loadpin_check(), which passes the block device that
corresponds to the super block of the file system from which
a file is being loaded. Generally a super_block structure has
an associated block device, however that is not always the
case (e.g. tmpfs).
Cc: stable@vger.kernel.org # v6.0+
Fixes: b6c1c5745ccc ("dm: Add verity helpers for LoadPin")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/md/dm-verity-loadpin.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Tue, 27 Jun 2023 20:28:01 +0000, Matthias Kaehlcke wrote: > Add a NULL check for the 'bdev' parameter of > dm_verity_loadpin_is_bdev_trusted(). The function is called > by loadpin_check(), which passes the block device that > corresponds to the super block of the file system from which > a file is being loaded. Generally a super_block structure has > an associated block device, however that is not always the > case (e.g. tmpfs). > > [...] Applied, thanks! [1/1] dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter https://git.kernel.org/kees/c/47f04616f2c9 Best regards,
diff --git a/drivers/md/dm-verity-loadpin.c b/drivers/md/dm-verity-loadpin.c index 4f78cc55c251..0666699b6858 100644 --- a/drivers/md/dm-verity-loadpin.c +++ b/drivers/md/dm-verity-loadpin.c @@ -58,6 +58,9 @@ bool dm_verity_loadpin_is_bdev_trusted(struct block_device *bdev) int srcu_idx; bool trusted = false; + if (bdev == NULL) + return false; + if (list_empty(&dm_verity_loadpin_trusted_root_digests)) return false;