Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5667715rdb; Wed, 13 Dec 2023 16:08:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfnoi/AiU08uagMXuK0E6YbVughAESGQjrazIXmPqjt7P41sbTss8ON1HoaqVMb3ovlJGa X-Received: by 2002:a17:902:d2c7:b0:1d0:6ffe:9fc with SMTP id n7-20020a170902d2c700b001d06ffe09fcmr10407681plc.90.1702512518271; Wed, 13 Dec 2023 16:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702512518; cv=none; d=google.com; s=arc-20160816; b=OcHLKzEYtnimMl+H2y6x2EWfMyTciXTcNBc7S3HONqmIbw9UjL4ao4sMf2zNII4f6h tTmoMif13mYzBw7hhS0XGt7dz3mDW9Nu8iKiuJ0OC5MZbs2ZUaOzhRqYIj4n4K89Q6rn +yp1FvPZFJ7K2ZaGucQ8tYUdcyegkYhdC9EOwE9XQMxbDYlw8Yt6Z6eb9QV0BKreEwBX HMXpCUx2pL0WARw/ACCQaCdwi3AGz1yKrG8nsOnm1y3oa/i/Mrd4FXwcM0itIcCmTXGK REwAge/2EqWHNb7NN+cV6V7Y9xfCvmua49ouqfstGgHnj45fhMR0oFfC1+3WiUBgXDqQ oaqg== 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=TtvhaOg9jPDPBdDCBRPbw5S67qdZw1uJRVGCfj1Llbg=; fh=rIWQlQuFaRT3lVMU5BdwQ4XNr3R71w5Wcsq3VJm7BA4=; b=l2ETSwTJYrL+wJm1QohAfOOY+4MaflmeY7oP9sWyjlF4gkc9LNSxjQWsX6YPaMhK/X wfVXKazoinJpqR9jvurFWfQX8W17SS/ncxtxA2jOX4Nv7aP8qa6N836vecY7l+xfjZi8 7L4bKIG8ZPwE6i5bYoyyPtVrbPRx69f22SOXl++I2xrC1MP3x/RzD0QnsIz9S3CU9o+B hGNP3BHZChqRuC6yza4BiHwxDvVCCkuXRLFBSNKcpjHuJVH7QAVtSS6QYPYhA6EQZAz1 WSBdfrPxJNI6l1n7s5K47cwYgwTjQboHvJEuKQDBDsjgL0eo0INBeHj/jz1V2bXXZA6E Xs+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rq0tCafp; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n2-20020a170902d2c200b001cfdfa28b70si10382929plc.469.2023.12.13.16.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 16:08:38 -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=@ibm.com header.s=pp1 header.b=rq0tCafp; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A42CA8052BC6; Wed, 13 Dec 2023 16:08:35 -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 S234072AbjLNAIS (ORCPT + 99 others); Wed, 13 Dec 2023 19:08:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjLNAIR (ORCPT ); Wed, 13 Dec 2023 19:08:17 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE70A6 for ; Wed, 13 Dec 2023 16:08:23 -0800 (PST) Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDNHiXk032758; Thu, 14 Dec 2023 00:08:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=TtvhaOg9jPDPBdDCBRPbw5S67qdZw1uJRVGCfj1Llbg=; b=rq0tCafps8G+rqUL+KZ2gVOZ2clcy2H9KonSqLe7fx0C+xXfT/wsISz51JEKGddkdzwc K7CwIuOeXV1Z7PtR10aX7wUxxZoPIGpers9LvS1OEgjL03sYiCLs9yBsIAtewMC6vele I1HP7p/MO6344ab3Bta1d2rcTdIO0mNppmmBoZ7hlOHQMip2DeZNTuZ80ya2kp5EwdrG 3vbXHfvAJaN7zlTqySr61QfgxuS1lHxF7jUWn0G0pAmgjbJSU+EPLfIusKCrQdQO7zXq hUD9U+wK7YspGwXjZIBEBmp+4sLxVXyvADpE9/9yenQc/je4RJjb1WWXCBqOcToJFyh2 Cg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3uynbt1xff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 00:08:12 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3BDLKgUZ012588; Thu, 14 Dec 2023 00:08:11 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uw3jp4tn9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 00:08:11 +0000 Received: from smtpav01.wdc07v.mail.ibm.com (smtpav01.wdc07v.mail.ibm.com [10.39.53.228]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3BE089Gw3539542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Dec 2023 00:08:09 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04E2858068; Thu, 14 Dec 2023 00:08:09 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E013758055; Thu, 14 Dec 2023 00:08:08 +0000 (GMT) Received: from gfwa600.aus.stglabs.ibm.com (unknown [9.3.84.101]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTPS; Thu, 14 Dec 2023 00:08:08 +0000 (GMT) Received: by gfwa600.aus.stglabs.ibm.com (Postfix, from userid 181152) id 3D838740051; Wed, 13 Dec 2023 18:08:08 -0600 (CST) From: Lakshmi Yadlapati To: joel@jms.id.au, eajames@linux.ibm.com, ninad@linux.ibm.com, alistair@popple.id.au Cc: Lakshmi Yadlapati , linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] fsi: Fix panic on scom file read Date: Wed, 13 Dec 2023 18:07:44 -0600 Message-Id: <20231214000744.1281464-1-lakshmiy@us.ibm.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3Ik0TkYMBeazdKCvzsrjrQcsREMgJWN_ X-Proofpoint-ORIG-GUID: 3Ik0TkYMBeazdKCvzsrjrQcsREMgJWN_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-13_15,2023-12-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 clxscore=1011 bulkscore=0 mlxscore=0 spamscore=0 suspectscore=0 impostorscore=0 mlxlogscore=734 phishscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312130170 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 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, 13 Dec 2023 16:08:35 -0800 (PST) Reading the scom file without the custom open method (i2cr_scom_open) causes a kernel panic. This change replaces simple_open with i2cr_scom_open to properly initialize the private_data field in the file structure, preventing the panic during scom file operations. Signed-off-by: Lakshmi Yadlapati --- drivers/fsi/i2cr-scom.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c index cb7e02213032..8d65c562b488 100644 --- a/drivers/fsi/i2cr-scom.c +++ b/drivers/fsi/i2cr-scom.c @@ -73,9 +73,18 @@ static ssize_t i2cr_scom_write(struct file *filep, const char __user *buf, size_ return len; } +static int i2cr_scom_open(struct inode *inode, struct file *file) +{ + struct i2cr_scom *scom = container_of(inode->i_cdev, struct i2cr_scom, cdev); + + file->private_data = scom; + + return 0; +} + static const struct file_operations i2cr_scom_fops = { .owner = THIS_MODULE, - .open = simple_open, + .open = i2cr_scom_open, .llseek = i2cr_scom_llseek, .read = i2cr_scom_read, .write = i2cr_scom_write, -- 2.39.2