Skip to content

Commit c330fb1

Browse files
KAGA-KOKOjgross1
authored andcommitted
XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt
XEN data pointer which contains XEN specific information. handler data is meant for interrupt handlers and not for storing irq chip specific information as some devices require handler data to store internal per interrupt information, e.g. pinctrl/GPIO chained interrupt handlers. This obviously creates a conflict of interests and crashes the machine because the XEN pointer is overwritten by the driver pointer. As the XEN data is not handler specific it should be stored in irqdesc::irq_data::chip_data instead. A simple sed s/irq_[sg]et_handler_data/irq_[sg]et_chip_data/ cures that. Cc: [email protected] Reported-by: Roman Shaposhnik <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Roman Shaposhnik <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent ee87e15 commit c330fb1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/xen/events/events_base.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
156156
/* Get info for IRQ */
157157
struct irq_info *info_for_irq(unsigned irq)
158158
{
159-
return irq_get_handler_data(irq);
159+
return irq_get_chip_data(irq);
160160
}
161161

162162
/* Constructors for packed IRQ information. */
@@ -377,7 +377,7 @@ static void xen_irq_init(unsigned irq)
377377
info->type = IRQT_UNBOUND;
378378
info->refcnt = -1;
379379

380-
irq_set_handler_data(irq, info);
380+
irq_set_chip_data(irq, info);
381381

382382
list_add_tail(&info->list, &xen_irq_list_head);
383383
}
@@ -426,14 +426,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
426426

427427
static void xen_free_irq(unsigned irq)
428428
{
429-
struct irq_info *info = irq_get_handler_data(irq);
429+
struct irq_info *info = irq_get_chip_data(irq);
430430

431431
if (WARN_ON(!info))
432432
return;
433433

434434
list_del(&info->list);
435435

436-
irq_set_handler_data(irq, NULL);
436+
irq_set_chip_data(irq, NULL);
437437

438438
WARN_ON(info->refcnt > 0);
439439

@@ -603,7 +603,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
603603
static void __unbind_from_irq(unsigned int irq)
604604
{
605605
evtchn_port_t evtchn = evtchn_from_irq(irq);
606-
struct irq_info *info = irq_get_handler_data(irq);
606+
struct irq_info *info = irq_get_chip_data(irq);
607607

608608
if (info->refcnt > 0) {
609609
info->refcnt--;
@@ -1108,7 +1108,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
11081108

11091109
void unbind_from_irqhandler(unsigned int irq, void *dev_id)
11101110
{
1111-
struct irq_info *info = irq_get_handler_data(irq);
1111+
struct irq_info *info = irq_get_chip_data(irq);
11121112

11131113
if (WARN_ON(!info))
11141114
return;
@@ -1142,7 +1142,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
11421142
if (irq == -1)
11431143
return -ENOENT;
11441144

1145-
info = irq_get_handler_data(irq);
1145+
info = irq_get_chip_data(irq);
11461146

11471147
if (!info)
11481148
return -ENOENT;
@@ -1170,7 +1170,7 @@ int evtchn_get(evtchn_port_t evtchn)
11701170
if (irq == -1)
11711171
goto done;
11721172

1173-
info = irq_get_handler_data(irq);
1173+
info = irq_get_chip_data(irq);
11741174

11751175
if (!info)
11761176
goto done;

0 commit comments

Comments
 (0)