Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1621942lqe; Mon, 8 Apr 2024 14:52:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5wcMrb86AKhNWhCdlYls/2o8HBZo66rbcYNGcuLZV5qZr0VcHUty7mmyEodONZkz81PVhVdOukplSPKSDJBOl7V6SBw92UR4KB3smtQ== X-Google-Smtp-Source: AGHT+IEZ8D+DxpwBPTu3BPdQCLnB19zOp3psaBXEe0NK00EM0rxZC1BX979bC6jg5RXAjDg0rHF8 X-Received: by 2002:a05:6512:3ba3:b0:516:cdb6:2ca6 with SMTP id g35-20020a0565123ba300b00516cdb62ca6mr7949488lfv.35.1712613165120; Mon, 08 Apr 2024 14:52:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712613165; cv=pass; d=google.com; s=arc-20160816; b=WafP6s3Lwzakm9sSDz56zUAF3aYMN6myDclIOhCeQieQMDPXoUgWI+qbt1a+sm26Cf +1ZNW20iAqXiYpk0ADHlaPv8ZoFuo8+YOPA8srLjz86t17yc6klvAuTsD+nWKizxdgow mL13lENMaxN0e7EOYStCiByUvgprs+pI/5v/K13toG0h2UkEYI3RIn3Mox6wKnOavbvT U8TE5OYpO/qoPkN4TfNz9dqCeOvtvrPn3cGlOCmF3AfINbwfKEMmoZg//e8sr9726b+1 q52IAoOm7lFdjSRpoTd+AMi3RUaxTFFqJ57+UAC0JWYYDMnFZA4Y3ZMf/2RumfSGiK3Y tqLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=amcZSzW3yyTzEXypL37TcjBNZBV4M3dWgOvIguTbuzI=; fh=5XNDufd/7AVEQcNzHpUs8QZk3cSux0mZWot231c9cj0=; b=zQoKeyQE6zL/ky8AL6SvAq/rfbn0w0NLtxJaC4fuERWwjKvCG+mFB+nPlrsHheqBmB UxgP7hcHUv5fWf5rbFBbjzDZubl6XskFCol+Yu4r2oUpsiyN2kSbDaetlFgTX4j4vZU+ bZuGTqCkpY/8ORulSKdiaFIsxgT5keogQ1fCjuSmG5pHkSHOyC6uKmIdd+aXK3P3AMzY x784gn1/06+vyiqSN/V7XLBQnhA66PB8dnw/oHSZcRpca2c6EmH6JYzJgPF/0eZ015/8 kJnZHRsxXq7mM2H6La967zEDAux9Tq2GDibo1ln0SqCe+3WU6e9cXMsnZ9Urrg6RcNWR /0QQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KFTehzjZ; arc=pass (i=1 spf=pass spfdomain=flex--dhavale.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ga40-20020a1709070c2800b00a51c24f8f1dsi2714534ejc.840.2024.04.08.14.52.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 14:52:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KFTehzjZ; arc=pass (i=1 spf=pass spfdomain=flex--dhavale.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 B87551F228B6 for ; Mon, 8 Apr 2024 21:52:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6572A14884C; Mon, 8 Apr 2024 21:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KFTehzjZ" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21A011442F3 for ; Mon, 8 Apr 2024 21:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712613158; cv=none; b=bMnxpuMB7jn/fYDO4lJBZyaqfWcfI2v/jdJNLnf+pxqHV/R3otNN7WmiBeSVog+wPwHdgfxITvUhrxXL0SDSml2xJ2a8U6jjCbc9nnv9U+Ar9RmYRtZpUxthie4RlXtNX2zjHHjAQ0xOF2fOg9KwALfJDeTgoteSg2aSg9JaYco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712613158; c=relaxed/simple; bh=nvpM8tXyK/CURoTjuw83DuYMKwJ9CyjRJDN6oCQ+WcM=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=rPMlj8DPgvA6VrR/cw+M53jrKN5k9cpnJ0pBvQ1DS9yin69sllS0lgoY1IEjA36rJtDiZZNR7eDPuqFmvT1NNi8XACDXFlxjkI3uDxlgCJouxFdkCJ4TM+kSz1jcqUT0ytd8cpgSWO4zNDBdN/htOAC+CERq/SDWiGg64zYXxuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dhavale.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KFTehzjZ; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dhavale.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61506d6d667so84903427b3.1 for ; Mon, 08 Apr 2024 14:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712613156; x=1713217956; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=amcZSzW3yyTzEXypL37TcjBNZBV4M3dWgOvIguTbuzI=; b=KFTehzjZWAYt/par8SOgZJrE6uQ7QnRoaIeo1W6zXkM/3vv17gRR8exgPPpaXIsh9l 7SHnq9H/+ZkMzn9lYDlsM7Z33ZeT+HUfbIA/OLmi6PTlRR1zuKfboNs8uFNNZqk6YW+v VgCWq47v3o0c88gEc6nlR1dO/HpnplipYCAT5v4LNiQTIUA/T7vsXxC49c3cpfDHXpyd FMUQ6sdjfWRJ10vd+r0RWBVEurVBSqrOIAIZ+RoKgFaYo2OGjtlEe2lH1iHuEI39/Y7o Nk91oi5ry9ANeV53K6QbwK6/yAiKIAOZI0l1mSVPz7IjfeLfu0N4/4V1f6+RGqRJq8y0 IodA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712613156; x=1713217956; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=amcZSzW3yyTzEXypL37TcjBNZBV4M3dWgOvIguTbuzI=; b=tXpRt2oKYttLh5lKOW8wFpVfYD6E8XMlNj4ODZHCMXE36TYddYrlmMO+Ji9VAPhsCl BmcK4LFMLQGoylNzm1QIUJEA8hdbqJVpLxxw6O07AmTCYah6IxizXj9euFsyrOhkTt6N sTt5dyeoylPD8NZeYCGvsCPIy6O2TyRuY71nDnk7iJXmgBS/upIJVxTWxlDE/RcWWNPu b1og5qj+niAxF6BJYuZ7IRFaJEP8hLMTGyLABzPauHCttvwGavZG7L71Uwf/Emjgnz2e 5lKWlCSiHpmUk6e/my8kcVeZTNJQUGAmqKozGzYcdfFMO8PtHkLMU903OJSs2a3cyfm2 uVxA== X-Forwarded-Encrypted: i=1; AJvYcCU4O5/HndATFQKc6Se9hAfxOgvaVyG8ef9AePO23RBrzPI/EM+n9ghjIs537AlCld/Xt4aHX2yOB5mtEiGtQP/hWMiJ7zuXH/P28/2o X-Gm-Message-State: AOJu0YxuMLohkh05XWzdP+dzkbtITJ/09v0wT5vmyxwTA0wlEwDTkr0d AZRdSv0HiuPaHD1IHFE15PWXUS1MgyBN7Pc1qYLt0GXeHabMA+43axinsAaDMwIZlNAv8ly3wT7 TrbIccw== X-Received: from dhavale-desktop.mtv.corp.google.com ([2620:15c:211:201:9081:5db7:4b17:a606]) (user=dhavale job=sendgmr) by 2002:a81:ff05:0:b0:615:12a5:49c9 with SMTP id k5-20020a81ff05000000b0061512a549c9mr2538367ywn.3.1712613156122; Mon, 08 Apr 2024 14:52:36 -0700 (PDT) Date: Mon, 8 Apr 2024 14:52:29 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240408215231.3376659-1-dhavale@google.com> Subject: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool From: Sandeep Dhavale To: Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Chunhai Guo Cc: linux-erofs@lists.ozlabs.org, syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com, kernel-team@android.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" erofs will decompress in the preemptible context (kworker or per cpu thread). As smp_processor_id() cannot be used in preemptible contexts, use raw_smp_processor_id() instead to index into global buffer pool. Reported-by: syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com Fixes: 7a7513292cc6 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable") Signed-off-by: Sandeep Dhavale --- fs/erofs/zutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index b9b99158bb4e..036024bce9f7 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -30,7 +30,7 @@ static struct shrinker *erofs_shrinker_info; static unsigned int z_erofs_gbuf_id(void) { - return smp_processor_id() % z_erofs_gbuf_count; + return raw_smp_processor_id() % z_erofs_gbuf_count; } void *z_erofs_get_gbuf(unsigned int requiredpages) -- 2.44.0.478.gd926399ef9-goog