Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3719096pxt; Tue, 10 Aug 2021 09:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGKw4lfsx/j/Fzy4lsI90umtmWzov8ZM3zU4kj8/TtMwjUopXbGc/T7Gve63Rj2Qojkyda X-Received: by 2002:a92:d64d:: with SMTP id x13mr692366ilp.202.1628613913211; Tue, 10 Aug 2021 09:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628613913; cv=none; d=google.com; s=arc-20160816; b=X+F7mD9OcaA7yh6NuDeNDNOQnJAUzvW/zyRXGuwkQ6HKcUdecWQRDyFF+2a1DnH2gU xYuu/62m7mksRS0R7BXikyMCfXCg+rC4fU6vX8oCXvr0hPlUUGrdmd9EiDz8IyoXk2Md ej4H19h0e1I9xZAGWo6OcoyXdGpMyyZZ9B8V4TJs8ImiqKOUsgNsAeBKgO4o158vUL3T lSMXHaetJ3LFFyE0a331Rlp0PoBZtA1lZuUdqpkpz6N2kUJjuYvNFKfnjO+fESuSBjwz lciiz1GxlxDna3uoDWEJYUTcfkDHRgp4AQUbTgLQYGdK0/sd+RyTW3drC1gI+MWDd0+M jsAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=+wBn9YuOM/eyu+RHGz4c6Yg7GxC+HziL1H8YVANbAiA=; b=WwMmCjrWKSfZ6Iuf23zs6zwQH1SZwVQXPxAPkLLBuROLs1Lq1ZWgsA6xtdVHzurYu1 XiM7mRrkgnaSdGndsMba65bv81Tw1PfR1ahj326/Q8GtmyduzAOtlbUzg5F/afTjPlKn 3CcPgCL36avxq+a0kci8c2HDqCuvECQlui6rSj2sanc/IhdjwNAZodcrnIxO+iqtt+nz en8ilXEB/0JlPV+7AH5qIRDF11LwlfeKgDj2oHRCAKIwukKCuctKNiqseBd7i90zDxzx MRBgYrtvAoV5BwxFNzg7NRFLlbcV/ncapPWzQO3GXho79sW1ELAAzjQL+IKCdikJOqRs Qg+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si22540084jar.33.2021.08.10.09.44.58; Tue, 10 Aug 2021 09:45:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234542AbhHJQSZ (ORCPT + 99 others); Tue, 10 Aug 2021 12:18:25 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:41219 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234658AbhHJQQd (ORCPT ); Tue, 10 Aug 2021 12:16:33 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 17AGFTJl012556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Aug 2021 12:15:29 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 0997115C3DD0; Tue, 10 Aug 2021 12:15:29 -0400 (EDT) Date: Tue, 10 Aug 2021 12:15:28 -0400 From: "Theodore Ts'o" To: Lukas Czerner Cc: linux-ext4@vger.kernel.org Subject: Re: [PATCH 7/7] mkquota: Fix potental NULL pointer dereference Message-ID: References: <20210806095820.83731-1-lczerner@redhat.com> <20210806095820.83731-7-lczerner@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210806095820.83731-7-lczerner@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Aug 06, 2021 at 11:58:20AM +0200, Lukas Czerner wrote: > get_dq() function can fail when the memory allocation fails and so we > could end up dereferencing NULL pointer. Fix it. > > Also, we should really return -ENOMEM instead of -1, or even 0 from > various functions in quotaio_tree.c when memory allocation fails. > Fix it as well. The quota*.c files were taking from the quota_tools package, and are currently using the converion of setting errno and returning -1. I don't think an incomplete conversion to the kernel error return convention is the way to go. My long term plan for the quota functions in libsupport is to convert them to use the comerr_t error return convention, remove all of the printf functions from the functions, so they can be properly moved into libext2fs library as a first class supported library functions, and so that the high-level ext2fs functions would update the quota files --- so that programs like fuse2fs would properly update the quota records. So I'm going to drop the error handling changes from this patch before applying it. Cheers, - Ted