Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2586279rdb; Wed, 15 Nov 2023 05:17:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2gaRLC+9dQihcLCjS7Ejo94byR1MffWik63/vUxCi1Fo2i6DOKS0cZjJeaMeOLMn07r/V X-Received: by 2002:a05:6a00:1594:b0:6be:7ee:9900 with SMTP id u20-20020a056a00159400b006be07ee9900mr12313385pfk.8.1700054272349; Wed, 15 Nov 2023 05:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700054272; cv=none; d=google.com; s=arc-20160816; b=Qxwf+RsUmkxkUd3WrvmWWgXAHYQTRH2y41e8KaJE6NSYmf92aIv3QnSRYA9QTerdOK 29Q75g4SuGT2gowHry4URUopW0vaL2Yb9rkPK3+FGb2/vOPK8/k7ZwlP8gOTNC7yph3Q tuHfpxweKV+lIbP5td+/Nn9r/WRbFzYaXycLyi9gPIjyeYzK1XRt7BUiphN8Ws8QLksh Vob2EcEQOri68APcS9e/VsnFqxRJ35sQFaBuHfU2MUYwkZ7W8L92IQxl9geKEfgZWkr0 wpoQoO29dctAl+tME0i5UeehFiIUsM5hS4199t30pcB/zE/akAK+5+lWLzWcWkx23IOf WRZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=F+dllCLAEC41jq93R276OiytSCxqMBHKzTo25Nwd4Ng=; fh=NxvMNVnOvwtniYKlEdL5drDXPzn6ptKkw+5IThQSShI=; b=tHWtE4lygwcrvP/Ao983kQIFACevVmUwqxeFs0BL2no+gQ0wtjwebPSK0q4KzEgm9F OYSm3YaRRvs/8K8CBXEHwdmJY0nI3rl7aFWysIETdjtuZ0Hz7yCB2rNb3LL31xA9J1or EU7/QOyEjE82E0pQmlRQ+UwqxhV7yuEJqel3LICNBKEqCBCZuN0uiueQaK6nZXT2LMWg rlUqjxz3XaeXrhUdq0Q1xcUEl3CynM0dp6mdQ17KJnQnOkzOdS7p5z8OJZflm9VkJB2m mo276GZaL592pSnU3DIxEea1SYftG2YhUn+K+BLnZ4LtuRAwQnG8XhFp2+5n7PpWzikw Eucg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NIW5E7C5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h5-20020a656385000000b005b7c45afeacsi9941859pgv.630.2023.11.15.05.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:17:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NIW5E7C5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D0CE080C6EA5; Wed, 15 Nov 2023 05:17:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343883AbjKONRl (ORCPT + 99 others); Wed, 15 Nov 2023 08:17:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343875AbjKONRk (ORCPT ); Wed, 15 Nov 2023 08:17:40 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F40311D for ; Wed, 15 Nov 2023 05:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700054255; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F+dllCLAEC41jq93R276OiytSCxqMBHKzTo25Nwd4Ng=; b=NIW5E7C5IaEappdI2ZSmTrqB09ldWPGyoYLmRsoeUhRP19pQczJBFQG8XagXIUvHXSCYNt xUbQxECDEo4G/4Rj7LkdMeL200wEEqWGjlBmnX2QwwMVrO9cVGQIARN4qnVe26RHOkJZmp 9xQpQd91leofLVFzDm/NYVEF3e2WL0Y= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-cXIT7N2vN7yMUUV5k9b3FA-1; Wed, 15 Nov 2023 08:17:34 -0500 X-MC-Unique: cXIT7N2vN7yMUUV5k9b3FA-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-5be0d0248e5so6383793a12.3 for ; Wed, 15 Nov 2023 05:17:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700054253; x=1700659053; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F+dllCLAEC41jq93R276OiytSCxqMBHKzTo25Nwd4Ng=; b=D/zyMOfdPDGQ1IhMXK4qOaEODMpiBftcqYtw08hN6j1fCMENLFpCM8XAwBzzNizwAy HG/1NAU/CXi/V204iS9OMXw4n0z2SStGaA8c8Af2TEV2S+P8TOigp/7P6+a+vit7JeF8 AtppYx2Fi6Z5peOuOz6bR3KPU5yjrEfRk+h77AyDkCtYEDuSOh+/vBOxUrGlKfWL8/zp y4YO7yhX8X2c2+/IP2BbilYUOtNuIyGlEELoSUtYQUQxAwPZ6JpAvlPaqnvIO8cXqDVW quX9czJmgcwT0/uuCVvgVxTo5JC02+mNRM4VRLsgU+LyV9hObkladXYfARDAVRzPp0iU DwKw== X-Gm-Message-State: AOJu0Yz5eZI6kCP4Gb6r4jVYLGhl5F5WtQdPhlXXDe3bnjBvWW6qkHcd Kq4mFJpvBvxuRfHeoZIUYM56A29Y+Ulb/2MkKrkKNo7znTUuTg3m2CDaJluHcMDuIsEfc0+mDvn Qqj5Zy/csH+xX3St2wSleZWM9 X-Received: by 2002:a17:903:230f:b0:1ce:8ed:237f with SMTP id d15-20020a170903230f00b001ce08ed237fmr6445225plh.5.1700054252923; Wed, 15 Nov 2023 05:17:32 -0800 (PST) X-Received: by 2002:a17:903:230f:b0:1ce:8ed:237f with SMTP id d15-20020a170903230f00b001ce08ed237fmr6445204plh.5.1700054252587; Wed, 15 Nov 2023 05:17:32 -0800 (PST) Received: from [10.72.112.63] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id jd7-20020a170903260700b001ca222edc16sm7329376plb.135.2023.11.15.05.17.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Nov 2023 05:17:32 -0800 (PST) Message-ID: Date: Wed, 15 Nov 2023 21:17:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] ceph: quota: Fix invalid pointer access in Content-Language: en-US To: Ilya Dryomov Cc: Wenchao Hao , Jeff Layton , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, louhongxiang@huawei.com References: <20231114153108.1932884-1-haowenchao2@huawei.com> From: Xiubo Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SORBS_WEB,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 05:17:50 -0800 (PST) On 11/15/23 20:32, Ilya Dryomov wrote: > On Wed, Nov 15, 2023 at 1:35 AM Xiubo Li wrote: >> >> On 11/14/23 23:31, Wenchao Hao wrote: >>> This issue is reported by smatch, get_quota_realm() might return >>> ERR_PTR, so we should using IS_ERR_OR_NULL here to check the return >>> value. >>> >>> Signed-off-by: Wenchao Hao >>> --- >>> fs/ceph/quota.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c >>> index 9d36c3532de1..c4b2929c6a83 100644 >>> --- a/fs/ceph/quota.c >>> +++ b/fs/ceph/quota.c >>> @@ -495,7 +495,7 @@ bool ceph_quota_update_statfs(struct ceph_fs_client *fsc, struct kstatfs *buf) >>> realm = get_quota_realm(mdsc, d_inode(fsc->sb->s_root), >>> QUOTA_GET_MAX_BYTES, true); >>> up_read(&mdsc->snap_rwsem); >>> - if (!realm) >>> + if (IS_ERR_OR_NULL(realm)) >>> return false; >>> >>> spin_lock(&realm->inodes_with_caps_lock); >> Good catch. >> >> Reviewed-by: Xiubo Li >> >> We should CC the stable mail list. > Hi Xiubo, > > What exactly is being fixed here? get_quota_realm() is called with > retry=true, which means that no errors can be returned -- EAGAIN, the > only error that get_quota_realm() can otherwise generate, would be > handled internally by retrying. Yeah, that's true. > Am I missing something that makes this qualify for stable? Actually it's just for the smatch check for now. IMO we shouldn't depend on the 'retry', just potentially for new changes in future could return a ERR_PTR and cause potential bugs. If that's not worth to make it for stable, let's remove it. Thanks - Xiubo > > Thanks, > > Ilya >