Commit acfeb6de authored by David Wang's avatar David Wang Committed by Greg Kroah-Hartman
Browse files

Fix a potential abuse of seq_printf() format string in drivers



Using device name as format string of seq_printf() is proned to
"Format string attack", opens possibility for exploitation.
Seq_puts() is safer and more efficient.

Signed-off-by: default avatarDavid Wang <00107082@163.com>
Reviewed-by: default avatarKees Cook <kees@kernel.org>
Link: https://lore.kernel.org/r/20241120053055.225195-1-00107082@163.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e7240bd9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ static void aspeed_sgpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
	int offset;

	irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset);
	seq_printf(p, dev_name(gpio->dev));
	seq_puts(p, dev_name(gpio->dev));
}

static const struct irq_chip aspeed_sgpio_irq_chip = {
+1 −1
Original line number Diff line number Diff line
@@ -1102,7 +1102,7 @@ static void aspeed_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
	if (rc)
		return;

	seq_printf(p, dev_name(gpio->dev));
	seq_puts(p, dev_name(gpio->dev));
}

static const struct irq_chip aspeed_gpio_irq_chip = {
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ static void ep93xx_irq_print_chip(struct irq_data *data, struct seq_file *p)
{
	struct gpio_chip *gc = irq_data_get_irq_chip_data(data);

	seq_printf(p, dev_name(gc->parent));
	seq_puts(p, dev_name(gc->parent));
}

static const struct irq_chip gpio_eic_irq_chip = {
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ static void hlwd_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
	struct hlwd_gpio *hlwd =
		gpiochip_get_data(irq_data_get_irq_chip_data(data));

	seq_printf(p, dev_name(hlwd->dev));
	seq_puts(p, dev_name(hlwd->dev));
}

static const struct irq_chip hlwd_gpio_irq_chip = {
+1 −1
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ static void mlxbf2_gpio_irq_print_chip(struct irq_data *irqd,
	struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
	struct mlxbf2_gpio_context *gs = gpiochip_get_data(gc);

	seq_printf(p, dev_name(gs->dev));
	seq_puts(p, dev_name(gs->dev));
}

static const struct irq_chip mlxbf2_gpio_irq_chip = {
Loading