Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix os crash caused by optoe when class switch #413

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions patch/0001-fix-os-crash-caused-by-optoe-when-class-switch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 846abadb7505c10e85a3450a7343d6a89b5ecd96 Mon Sep 17 00:00:00 2001
From: philo <philo@micasnetworks.com>
Date: Fri, 12 Jul 2024 11:12:58 +0800
Subject: [PATCH] fix os crash caused by optoe when class switch

---
drivers/misc/eeprom/optoe.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/eeprom/optoe.c b/drivers/misc/eeprom/optoe.c
index 9129312a1..63bb8c46a 100644
--- a/drivers/misc/eeprom/optoe.c
+++ b/drivers/misc/eeprom/optoe.c
@@ -941,8 +941,10 @@ static ssize_t set_dev_class(struct device *dev,
} else {
/* one-address (eg QSFP) and CMIS family */
/* if it exists, remove 0x51 i2c address */
- if (optoe->client[1])
+ if (optoe->client[1]) {
i2c_unregister_device(optoe->client[1]);
+ optoe->client[1] = NULL;
+ }
optoe->bin.size = ONE_ADDR_EEPROM_SIZE;
optoe->num_addresses = 1;
}
@@ -1224,8 +1226,10 @@ static int optoe_probe(struct i2c_client *client,

err_struct:
if (num_addresses == 2) {
- if (optoe->client[1])
+ if (optoe->client[1]) {
i2c_unregister_device(optoe->client[1]);
+ optoe->client[1] = NULL;
philo-micas marked this conversation as resolved.
Show resolved Hide resolved
+ }
}

kfree(optoe->writebuf);
--
2.25.1

3 changes: 3 additions & 0 deletions patch/series
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ cisco-npu-disable-other-bars.patch
# Security patch
0001-Change-the-system.map-file-permission-only-readable-.patch

# Micas patches
0001-fix-os-crash-caused-by-optoe-when-class-switch.patch

#
#
############################################################
Expand Down