Skip to content

Commit 88d324e

Browse files
committed
Merge tag 'spi-fix-v6.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fix from Mark Brown: "This is a straightforward fix for a reference count leak in the rarely used SPI device mode functionality" * tag 'spi-fix-v6.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: Fix reference count leak in slave_show()
2 parents 21d1ccf + 176fda5 commit 88d324e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/spi/spi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,9 +2954,13 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
29542954
struct spi_controller *ctlr = container_of(dev, struct spi_controller,
29552955
dev);
29562956
struct device *child;
2957+
int ret;
29572958

29582959
child = device_find_any_child(&ctlr->dev);
2959-
return sysfs_emit(buf, "%s\n", child ? to_spi_device(child)->modalias : NULL);
2960+
ret = sysfs_emit(buf, "%s\n", child ? to_spi_device(child)->modalias : NULL);
2961+
put_device(child);
2962+
2963+
return ret;
29602964
}
29612965

29622966
static ssize_t slave_store(struct device *dev, struct device_attribute *attr,

0 commit comments

Comments
 (0)