Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp116363rdb; Mon, 22 Jan 2024 14:02:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEA26Hgp3pSmp+wiNt5xKrI/ERpLfSkCANYWMLyoMzCJNTZr4/ZB+oF8SJJnlbWNUFAndgu X-Received: by 2002:a17:906:3514:b0:a2d:4472:307b with SMTP id r20-20020a170906351400b00a2d4472307bmr2223867eja.117.1705960925581; Mon, 22 Jan 2024 14:02:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705960925; cv=pass; d=google.com; s=arc-20160816; b=LkHaEDQgU7V7CRcPVfI2t4tQPUIxfporiY66HI2MtFd1g1tbbH1Ee02IEK0zA7uD+e DRf0aj8E0wCX1JgbQijDV/5d28q8NZWFqDzN58Ek7PUENa11aSse4FI6sI5Dw6bRk+BQ AaJCwIaPLK2XeRMjYXa+BcS2+RXVu6aS0PalWukNONkrtt47FvV+V7iOCYdVJtPdc85j gx2RqUGCEkvi3LF+b97bo+J7MkupKdzCPhFzsm5d2jjZVCWCBzi1zC14Fg92Eli/R4Rj o4oW3gCQ2C0JD1IACo2TQSPYz4rC0sR6/s7zLXnnHL14Mt4/EEbQIPm9179pDUVljnWo Dzpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:cc:to:references :in-reply-to:from:organization:dkim-signature; bh=YgorZ9y1ABigf+8AfYUUWexSMaoGg5QlyfBL6eKu5CY=; fh=WGg/TcGKDyt0p2qE65Zq9XWKZcJYhGiRm0+xHwRwbhU=; b=08MAPJjY4IFaks1CBQ8ReAZX0KJqATXcDFEr0bNYf7HUXrTJ0vf+RkP74sy+tKgmh1 BKJPPjA0/KRX8rMGMlrnIzin9NHp0josWdDM+qNFZ1rBPhni6sznyQJpggm4+IrKq53g WyjeUlAmvMf90bp4mhQIlqJTFdLltjpg5mYNhNbEtVByCaO/PBSYzct2bStZKp18czA8 H4NGFAqo5nRlwhP+v6jZY7S1lpSYgJq7hpEeA35JS6FtfP2hHAMf2k1PxUd3IDz6O9vH pDWLqlNzryuyy9A0gyTKehJPBewhlNXTYUD8HiAGjKMQXh5HRLgsyoVQJSwg5CkvXrQD rHFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EDDq0GqU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-34220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id pv21-20020a170907209500b00a26db3465fasi10601497ejb.1028.2024.01.22.14.02.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 14:02:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EDDq0GqU; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-34220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4BF9F1F29039 for ; Mon, 22 Jan 2024 22:01:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 139F748CE1; Mon, 22 Jan 2024 22:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EDDq0GqU" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AE9B48CD7 for ; Mon, 22 Jan 2024 22:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705960891; cv=none; b=vCXbbJXKqjsZqmSlDwTx6xmJAAIAwEfhe95Rn2kHoNUZv2e0CmCPWMlM5lM7hms20VRUb4TcuAAE3UbQp/rFIFwiuDpo28Q+K+NrtF78Za3qNVuhW1rBXrZrEWKZQUMjMTNr0WcywCbMQe1HEMTEQOoiUUw7hfZsty4GJv0/GNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705960891; c=relaxed/simple; bh=V1yJVFjM67labChbznd10CJnK+mwAgP7GMH9rMtUC+s=; h=From:In-Reply-To:References:To:Cc:Subject:MIME-Version: Content-Type:Date:Message-ID; b=JKqQoehaqwkmCa35UZpqclaYc40By5ZEGp4f0IvOi/MiSecdII0e/yYde20yfcchVTjFCuaIkbsfzrR6AOCCES4OEPC0yyNSljPsquuNwE1Ide+9/wywDhNGUkLqSNBSXayOHEMlKn5uuHu3aEXRLLrYaV+kxjC1cMRPHUQNEYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EDDq0GqU; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705960888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YgorZ9y1ABigf+8AfYUUWexSMaoGg5QlyfBL6eKu5CY=; b=EDDq0GqUgEUDONFlrrcfKEI8l1+mUFl6z1bu8pWclYnligWSWPmLipvcytVU+UKfe8vrMG zPHZNoFtue+iGTDGgGJWAcXpCILT9fQ8ylizBTHeTnTPhpxMSudoxcLtK3UE8SadH8aPOR 5tRw+lW7GCILkY0/0WeW8+T3/2xD5RU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-FVBxaMfkOUaLwqIkj88Zsg-1; Mon, 22 Jan 2024 17:01:24 -0500 X-MC-Unique: FVBxaMfkOUaLwqIkj88Zsg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9621845E60; Mon, 22 Jan 2024 22:01:22 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77F78492BC6; Mon, 22 Jan 2024 22:01:20 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <7790423f-665e-44cc-b4ae-d3f3d2996af5@linux.alibaba.com> References: <7790423f-665e-44cc-b4ae-d3f3d2996af5@linux.alibaba.com> <20240122123845.3822570-1-dhowells@redhat.com> <20240122123845.3822570-7-dhowells@redhat.com> To: Jingbo Xu Cc: dhowells@redhat.com, Christian Brauner , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Marc Dionne , Gao Xiang , Chao Yu , Yue Hu Subject: Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3980815.1705960879.1@warthog.procyon.org.uk> Date: Mon, 22 Jan 2024 22:01:19 +0000 Message-ID: <3980816.1705960879@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 Jingbo Xu wrote: > > - ret = cachefiles_ondemand_init_object(object); > > - if (ret < 0) > > - goto err_unuse; > > + if (object->ondemand) { > > + ret = cachefiles_ondemand_init_object(object); > > + if (ret < 0) > > + goto err_unuse; > > + } > > I'm not sure if object->ondemand shall be checked by the caller or > inside cachefiles_ondemand_init_object(), as > cachefiles_ondemand_clean_object() is also called without checking > object->ondemand. cachefiles_ondemand_clean_object() won't trigger the > NULL oops as the called cachefiles_ondemand_send_req() will actually > checks that. Meh. The above doesn't actually build if CONFIG_CACHEFILES_ONDEMAND=N. I think I have to push the check down into cachefiles_ondemand_init_object() instead. David