Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2268412pxb; Thu, 28 Oct 2021 20:31:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFV2WXr3j1H53zK3eh9jDWGvGc+Dp86KRBGiGnH9i5xoaGHEyl7bgCZDuPQi6NqESuNkEo X-Received: by 2002:aa7:8d88:0:b0:47b:d965:fbb2 with SMTP id i8-20020aa78d88000000b0047bd965fbb2mr8526798pfr.16.1635478305983; Thu, 28 Oct 2021 20:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635478305; cv=none; d=google.com; s=arc-20160816; b=jdYNHRs2Y8mr7FUsjyQcEPrvq1sKnW24poXzbr3RfdfxgojvWaVg7KXs4IhZxApJEG HB2scST+dZFfSkZqHM375IehmUg18TN2gLF7hqomeXtzFhMAPHAKr2Uaqsy5iaKSo3b2 bYXciMhtT398Vc4YzSUSVPClXCJUld80exg/yqIRFAsabV5ffy9wDvliS2lBr2DNyxpb 1g2fHd1k3gi3D6yleir1P0RLumXlJugTjBpNiZNAKcl2W+4rvhsk88e4yxJ+mmPDzZRh IDeFD+CwdKYth2GpzQ75ET6QSZVUA7IUFXv58rOp2CIGQYczSxy/WCAzPKPj1Cvn+Mhm yCrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yt3GCe+54FqcZOH31G5bddZOmFvvBWRqXYZp4dfbBP4=; b=PXWmgjV3NX3eqwGy6vIHMlDgIJWMLxS5BTU4UHsu3BQ882Eag+Yxbrn6H74Gy95Wm6 HmTJoKI4X73DjAaFcIBbZezmJZ877YR++CxPe/B5c4BGm4sE3vCibHdJZD0cO/s8Q9m1 3cDj62vPD99/AvQexzMzBGxO9NGGRFNvuV439dCbrWaMVpvUYyNG1AXr5kkn/XUY2qUN AZ1NEfrvav0qEEQ8jbNfpspFmONX5spEfd8Xquu2dz3TtbXTMZ1PPU4pVDX2skqtZHuj +Ux2SnJPJSS8e58fvjULPvYqz1FLH8Uw6RYXPe/Y32HzUTUF8asUB015L/eiF/fbux76 Cb8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=q88FJapu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t21si8608583pfg.150.2021.10.28.20.31.33; Thu, 28 Oct 2021 20:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=q88FJapu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231638AbhJ2Dbv (ORCPT + 99 others); Thu, 28 Oct 2021 23:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbhJ2Dbv (ORCPT ); Thu, 28 Oct 2021 23:31:51 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14DF9C061570 for ; Thu, 28 Oct 2021 20:29:23 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id j9so405659pgh.1 for ; Thu, 28 Oct 2021 20:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yt3GCe+54FqcZOH31G5bddZOmFvvBWRqXYZp4dfbBP4=; b=q88FJapufg3fkDigwnOkLElje1mOJaOMneaa+cUXfVv3z+dQxlVNwoUKzUWKvy2Rf0 9EUV0vPPJSHw3FH4JXXyceGvnpp9hBu8puHYOMQQ2xoyq8EBIOfPn/rgRBLqjiJZ+DT+ EgWhHMYyvHjxcGGRc80cYMhEOxw0oqFHlvO8ccn/0b6FLVveo7+JleqXOCGYloMZk/R0 x1j6ay8vk82+VHZAejPhffP8jogUeCPE8Fs6D6WAWQ29YdQ738WTbzgHkhhU+3PMW0dT +qRmg7bbrMxnRayXPFtbQlPT15hoz9X7BfDK8MpvBNMAORXctA/W5k0bAUK5aYVE6pbG D55Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yt3GCe+54FqcZOH31G5bddZOmFvvBWRqXYZp4dfbBP4=; b=AWq2J2d1HDr3aD7YOTX0MBEv1llqbwisKdsR1+D8563NtL/rogQZb+n/vVYDvHLFeR +Fx5E0Znpq+i5so+j0cYMVrbYlg2hibCATyUDK/Ja9vmVpyEhbZ4s5lZmQFa331Sa+Wp a2MfT7r+0aXuIHgXunz25ErZzB9CPy/uDaUcU8SgKm6RzJmivAUc9QoGlDHzTN5m/+V8 PS0yQEDmmnKBOYMjSPut0SS196HtcTCQ7FPuTkHX0K3Zf8SWVDld+DB0gVDRe1xFdXdG lN92zY6Mo0CkgGssy+u3cXyt/ov6dEQdedHs50pwZWBacPS8KayAk2Jxk3jfyIla02Uj bR7w== X-Gm-Message-State: AOAM533xc5/pI8rY614f7gauOENl/k75C3EbziQZvHIYGes8wGWgdy/X hgjUjo259HCVISflKOy1iZN6kA== X-Received: by 2002:a65:448a:: with SMTP id l10mr6160963pgq.313.1635478162580; Thu, 28 Oct 2021 20:29:22 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.242]) by smtp.gmail.com with ESMTPSA id w5sm5396319pfu.85.2021.10.28.20.29.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Oct 2021 20:29:22 -0700 (PDT) From: Muchun Song To: andriy.shevchenko@linux.intel.com, akpm@linux-foundation.org, sfr@canb.auug.org.au, revest@chromium.org, adobriyan@gmail.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Muchun Song Subject: [PATCH] seq_file: fix passing wrong private data Date: Fri, 29 Oct 2021 11:26:38 +0800 Message-Id: <20211029032638.84884-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DEFINE_PROC_SHOW_ATTRIBUTE() is supposed to be used to define a series of functions and variables to register proc file easily. And the users can use proc_create_data() to pass their own private data and get it via seq->private in the callback. Unfortunately, the proc file system use PDE_DATA() to get private data instead of inode->i_private. So fix it. Fortunately, there only one user of it which does not pass any private data, so this bug does not break any in-tree codes. Fixes: 97a32539b956 ("proc: convert everything to "struct proc_ops"") Signed-off-by: Muchun Song --- include/linux/seq_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 103776e18555..72dbb44a4573 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -209,7 +209,7 @@ static const struct file_operations __name ## _fops = { \ #define DEFINE_PROC_SHOW_ATTRIBUTE(__name) \ static int __name ## _open(struct inode *inode, struct file *file) \ { \ - return single_open(file, __name ## _show, inode->i_private); \ + return single_open(file, __name ## _show, PDE_DATA(inode)); \ } \ \ static const struct proc_ops __name ## _proc_ops = { \ -- 2.11.0