Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2559520rdb; Wed, 15 Nov 2023 04:33:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdqqNw+s3xXhJIUiyTh2Y5OP+k30ca6Sr8+c/5KIt6vVRMaAADNhtC8liK6laitL29g5RB X-Received: by 2002:a05:6a21:185:b0:186:97bb:318e with SMTP id le5-20020a056a21018500b0018697bb318emr9850503pzb.28.1700051605246; Wed, 15 Nov 2023 04:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700051605; cv=none; d=google.com; s=arc-20160816; b=iDabhkV/ddTi2fkae1kwL4cwwIoazo6iZ2I1ObkK4MjJaLhhagWdq+IDX2oluPtU7i eCXRzFt5HOHTYZmYmnaJXfhRpj0wCbmJ1Zx4v7jgDNcTuRBE75JIgbj8DxwT/fhWNQCx /1Ek0ER9gMxQ1FeQHWrY6CV6OkA1TzS6V0fiOCff+GCxf390AUm8QLy3FcH+UktQnQUP S6eb7MGUWCtFNu5piNP/FAlNULgvsqAS7tFqTY3Xm9Mbbo2pXzQzWY15rJJJ8m2sI9yf KWkRljfcG1jRlCPKJz0S6LhimSQBao9KT79ZA8hRpjmSW4Hd7LEDzN1uPAzJvvn5rZ1A P2HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7ymwjRDEGx/rob7YccBbw/VIQH/kl+vjNZlHHnqtAps=; fh=EtsC2sNBryen0e61fkIwCGTbUgnVJeEb2yXc55qPl78=; b=fuMYVZ4kabTJanX1XDb6yFcs4OLFAM7ixfS0MjJ1dCoD+0EB84fwvW+2ZREEDReTyA MxLRL+0Qv81SJ0siDVdvug0TEpbaVYYMOCoNOEhLip5OrJY+P6vvBqO3MWKYVE70oC07 7ytCz622eqpAUu6GLPVmiUropgmaETVI7unkj+ExBaNxLMj4j/7m2xlLCr4T5EO2uRms qx0BOopoiSaSuo5PkPOLq6hFBQybghJuZfkLTIyZ/whpVh/RFuH9/cTZ0Gh2EHL7qfij oGkQjW8dveVUizN5NRtF8BVm5f3L6KltK6ZIDvQaYUBAq0z4T4Yc3nqTsolysjzDF8iw Epcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YQMuhsyw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k20-20020a056a00135400b006c34028e37dsi10196825pfu.219.2023.11.15.04.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 04:33:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YQMuhsyw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 73C9D8024B2B; Wed, 15 Nov 2023 04:33:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343764AbjKOMc7 (ORCPT + 99 others); Wed, 15 Nov 2023 07:32:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343585AbjKOMc4 (ORCPT ); Wed, 15 Nov 2023 07:32:56 -0500 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3D6D11D; Wed, 15 Nov 2023 04:32:51 -0800 (PST) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5842ea6f4d5so4202939eaf.2; Wed, 15 Nov 2023 04:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700051571; x=1700656371; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7ymwjRDEGx/rob7YccBbw/VIQH/kl+vjNZlHHnqtAps=; b=YQMuhsywkJ61hF14wJoTL0OqucIfKGY+3lLTvsALGGWuSA5guJe0+qe24x50onDS1N fGsCR7XnPJrkZWl6pJOSiWS4w3wYx/eSGN1xw7HQqixHLDEIzWuDLs8CThVc/pBigOuF jbZl7Kd6B4k259e/Um+AzzfwYaWpIoyMQzIi0fY60kJpNsDurLh9xa1KvTPquzEbQfrj sfazPHfDkpiKb6ewFhKIPea6rvFSvi6lQHhYL94Kw1qBJx2YXZjmQuUQKl+wXANGob5u p+Y9WAiqy2uKHfPI9kXPxHRpZtr+x/gUCEvpzCJT8S6Ro6jiILAG7F9iAyCkjwsavyzX B9Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700051571; x=1700656371; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ymwjRDEGx/rob7YccBbw/VIQH/kl+vjNZlHHnqtAps=; b=ORRMU/FCH7t+WNbuawIn/+OYaREheRjokJjO8uT7eSdJFKDicfOx8lyn2zqtT1InyU VeydgyhnuDO0jwHsdpVzj7PfeUpelfHzOPM0wHPx/63oyC7RzJ3p8fEeqT6NAydKTaQJ jRLcvp+2y/CY697EBdUtk7zFHo66m8d0sF+gQZA0IZMJnvfsmA+6LprSyUGT7HZufIOW ZJnQx7PqlZrdd3d9g92I4YOm3ScUW+uIAQDOlUWGOzV4pvXDwoeResV09wXSeMFo34cT M1mToGWDORbhE+Dl3lAX9dpVKthaeZJvYnZGhrkdTTWCLCuwZQ2/+HkuZMbVHv0uXs5+ i63A== X-Gm-Message-State: AOJu0YyE1X1DcIwMe6kCNCHB9ykrfR8T8iZ3JN6hpAHs0b15yugVa8P8 L58LmqjnVBYzlcNxxGKjSSD6hGSbUtGPBYLKGVg= X-Received: by 2002:a4a:9204:0:b0:581:e750:9995 with SMTP id f4-20020a4a9204000000b00581e7509995mr11552460ooh.3.1700051571046; Wed, 15 Nov 2023 04:32:51 -0800 (PST) MIME-Version: 1.0 References: <20231114153108.1932884-1-haowenchao2@huawei.com> In-Reply-To: From: Ilya Dryomov Date: Wed, 15 Nov 2023 13:32:38 +0100 Message-ID: Subject: Re: [PATCH] ceph: quota: Fix invalid pointer access in To: Xiubo Li Cc: Wenchao Hao , Jeff Layton , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, louhongxiang@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 15 Nov 2023 04:33:22 -0800 (PST) On Wed, Nov 15, 2023 at 1:35=E2=80=AFAM 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 =3D 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=3Dtrue, 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. Am I missing something that makes this qualify for stable? Thanks, Ilya