From nobody Sat Jun 20 17:33:50 2026 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 328951DE2AD for ; Sun, 12 Apr 2026 07:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775978487; cv=none; b=NGABuCir14KBFAGLUWl6xYFtSjourKfY2pL68kWzts6VGyWF90SMLUrajU+6ALQHgbvjcmjI210FbyjAmEV1DuSsIMrBIZtyQQHNJsn6CS592wrG4MhOrhelFxz0Io2mQ8BLBqRV8SlZ9ZbmJkoJ0ckdFBhDYy2qtyy82FWLGqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775978487; c=relaxed/simple; bh=nbHz2BmQ1oP1wZT0NjNprtGrX0V9J7CUG72G1oQFhsM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=niddkMgaYObSVtkWk00IQNqVB/kY+RGQilCHQMeX7Hi//9HVaBx0IqHOnnIOemqozImKTDo2gWoaJ+8M+jZvpR0BJiEwPJCP8wNws4ypY49B874a6L0QYRmnrMTybJ23RUVu8MiyZ1Mx69HkHsh2syPktf4r0RRdQ4qgfpoWXyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V/7+vswS; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V/7+vswS" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2b45cb89f7eso163075ad.0 for ; Sun, 12 Apr 2026 00:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775978485; x=1776583285; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GDIIM2YOn1/RAWDIAFXQVjX+5NzXl47IB6XB/yelA6s=; b=V/7+vswS2Vc5fzlkk88tQlbA0HXkn8bWynWdy9oTm8RU+JR/Nb58pDh2vJmaBfQHCn Ag+hvdyqU2G87UQVioDGqoq9g03GiAVx3EhjuZGrbW6IUnTHdDPy4UDn5l6JqU9VIdqP Pr4eRyfP8YgqkL5REsABdWMUDOb1DhEKYiyR9/DcrcN16bn6608O3SodN4IoCmtOvvqd c0EzcpzfRb6vobEkiILOW/GlRtmvF9y/6Y3u1TAjN14x2+oD2F0HlqGY6QsITK91IGYy 2utFsdR7fRgIbm8FORZzdHmcp4KzWN7NFJKAi99GtQAF/2vehELOhgvhYDAYUzub3vwH 9VwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775978485; x=1776583285; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GDIIM2YOn1/RAWDIAFXQVjX+5NzXl47IB6XB/yelA6s=; b=syYy9CxHtwvTggwOxiPuKMCmY4z0jhmqRjjI+H8/3ineL+Ji2JpPKV9tY6bmIIwtm/ IAywQ6oXnkzfJIUUQ/CLi5gc7OyiIWXDZKW1OQVTFndIXHuqdFtAKsTSs5mHGWRpKwdt 7JEJGaWZWtjQAyfuEWv/HqgPIoX0m1J3H1BPowHEbIFqlwWNWyOBwyfiH+/lxD+i18QF VwUPGEKJfA51Kn93spWceWRcn1z5nusUik1Hn3HkKrOQujG1qmzoGA2aiR43NjXGmyQw OgXtUhz7LoXUbeKg2xPRTSHrutnU9NBS1wSrmJZFA5/h+teA8ZlCy54j4iWss9EJ5PiW wZFw== X-Forwarded-Encrypted: i=1; AFNElJ/ppmXoOkuXdGVGkEfF1XChF+NuNxH9xUs3qjpkgJUOtHHpwDrEsbxmcGvG2lpl4iirh/r/TgXyNi/Q7nE=@vger.kernel.org X-Gm-Message-State: AOJu0YwIwGw726jL1SZBlkYcD2L7wpC4QthXQwgUMCijZxf37Hft4AwF YWtTY8bLW2XXjhoCsIPhbpnDwmNiHfEsUvEq6HZxj/ZGGZugMQrMImND X-Gm-Gg: AeBDieveMa1vtF5xU0vKpy3rt4vmZJ28jcVAZOfiOzmWq6modt6Hao59OHrauhBRzAk e/IoygI/ss44Y6onC6uKozuoBeuAspcwiAJJE2DyJVU+q31zu8h6vo4Drs+AFwd1ZziOSrqlG01 VoXPvPpiICIEE0yBWN9A2QJRxGl7jQ8HNOqBMf+4Wh+LOpQ//Y5oDOe2Enet4INb1/jkEhlIAmB F6/3aur8JOlKIQsnZS6prkimMLl3Y7FulsSx4n1GBOeZaHafXnpq2xFj5uCTOE0Wy5KsfLwGvHD 2X2s0NGpZkX7Dm1WTwGLFHyEYazjW48WsgbhEjKneRSU1Ht7Br8ZkpTaM1I8yrbM/fzLp7RK7Ms NZfm5QERdNPfPxZLqsx1JTjthuY4XFRRi23O9FCN1DlvQh/cm5uBJWrWy+H7o8NzJE3CQpq95jM VKRZgEPEgsJ37CIIln59pY6vljaA== X-Received: by 2002:a17:90b:4d0e:b0:35b:90e7:c44f with SMTP id 98e67ed59e1d1-35e425381c6mr9521661a91.7.1775978485552; Sun, 12 Apr 2026 00:21:25 -0700 (PDT) Received: from lgs.. ([199.182.234.55]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35fb37d6e36sm477425a91.16.2026.04.12.00.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2026 00:21:25 -0700 (PDT) From: Guangshuo Li To: Eddie James , Ninad Palsule , Joel Stanley , Jeremy Kerr , linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li , stable@vger.kernel.org Subject: [PATCH] fsi/core: Fix device reference leak in fsi_slave_init() error path Date: Sun, 12 Apr 2026 15:21:14 +0800 Message-ID: <20260412072114.2418511-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After device_initialize(), the embedded struct device in struct fsi_slave is expected to be released through the device core with put_device(). In fsi_slave_init(), the cdev_device_add() failure path frees the slave object directly instead of dropping the device reference, which bypasses the normal device lifetime handling for the embedded struct device. Since this path has already allocated the minor and taken a reference to the OF node, switch it to put_device() so the cleanup is handled through fsi_slave_release(). Fixes: 371975b0b0752 ("fsi/core: Fix error paths on CFAM init") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li --- drivers/fsi/fsi-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index c6c115993ebc..444878ab9fb1 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1084,7 +1084,8 @@ static int fsi_slave_init(struct fsi_master *master, = int link, uint8_t id) rc =3D cdev_device_add(&slave->cdev, &slave->dev); if (rc) { dev_err(&slave->dev, "Error %d creating slave device\n", rc); - goto err_free_ida; + put_device(&slave->dev); + return rc; } =20 /* Now that we have the cdev registered with the core, any fatal @@ -1110,8 +1111,6 @@ static int fsi_slave_init(struct fsi_master *master, = int link, uint8_t id) =20 return 0; =20 -err_free_ida: - fsi_free_minor(slave->dev.devt); err_free: of_node_put(slave->dev.of_node); kfree(slave); --=20 2.43.0