* [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port
@ 2018-01-10 19:09 Marcel Apfelbaum
2018-01-15 15:54 ` Laszlo Ersek
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Apfelbaum @ 2018-01-10 19:09 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, mst, zuban32s, qemu-stable
If we try to use more pcie_root_ports then available slots
and an IO hint is passed to the port, QEMU crashes because
we try to init the "IO hint" capability even if the device
is not created.
Fix it by checking for error before adding the capability,
so QEMU can fail gracefully.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index ad4e6aa7ff..0e2f2e8bf1 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
PCIDevice *d = PCI_DEVICE(dev);
GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
+ Error *local_err = NULL;
- rpc->parent_realize(dev, errp);
+ rpc->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,
grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,
--
2.13.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port
2018-01-10 19:09 [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port Marcel Apfelbaum
@ 2018-01-15 15:54 ` Laszlo Ersek
2018-01-15 16:31 ` Marcel Apfelbaum
0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2018-01-15 15:54 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel; +Cc: qemu-stable, zuban32s, mst
On 01/10/18 20:09, Marcel Apfelbaum wrote:
> If we try to use more pcie_root_ports then available slots
> and an IO hint is passed to the port, QEMU crashes because
> we try to init the "IO hint" capability even if the device
> is not created.
> Fix it by checking for error before adding the capability,
> so QEMU can fail gracefully.
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
> hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
In your opinion, can we add:
Cc: qemu-stable@nongnu.org
Fixes: 226263fb5cdaa4a4a95f1680fabbc9dd2123fd67
?
(Not sure if a stable branch is already open for 2.11. Commit
226263fb5cdaa appeared in 2.11.)
Ah, I'm silly. You CC'd stable up-front. :)
So, what about the Fixes tag?
>
> diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
> index ad4e6aa7ff..0e2f2e8bf1 100644
> --- a/hw/pci-bridge/gen_pcie_root_port.c
> +++ b/hw/pci-bridge/gen_pcie_root_port.c
> @@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
> PCIDevice *d = PCI_DEVICE(dev);
> GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
> PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
> + Error *local_err = NULL;
>
> - rpc->parent_realize(dev, errp);
> + rpc->parent_realize(dev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
>
> int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,
> grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks
Laszlo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port
2018-01-15 15:54 ` Laszlo Ersek
@ 2018-01-15 16:31 ` Marcel Apfelbaum
2018-01-16 19:05 ` Laszlo Ersek
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Apfelbaum @ 2018-01-15 16:31 UTC (permalink / raw)
To: Laszlo Ersek, qemu-devel, mst; +Cc: qemu-stable, zuban32s
On 15/01/2018 17:54, Laszlo Ersek wrote:
> On 01/10/18 20:09, Marcel Apfelbaum wrote:
>> If we try to use more pcie_root_ports then available slots
>> and an IO hint is passed to the port, QEMU crashes because
>> we try to init the "IO hint" capability even if the device
>> is not created.
>> Fix it by checking for error before adding the capability,
>> so QEMU can fail gracefully.
>>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>> ---
>> hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> In your opinion, can we add:
>
> Cc: qemu-stable@nongnu.org
> Fixes: 226263fb5cdaa4a4a95f1680fabbc9dd2123fd67
>
> ?
>
> (Not sure if a stable branch is already open for 2.11. Commit
> 226263fb5cdaa appeared in 2.11.)
>
> Ah, I'm silly. You CC'd stable up-front. :)
>
> So, what about the Fixes tag?
>
For sure, I wasn't aware of the "Fixes" tag. I'll be sure to use it
in the future.
Do I need to resend, or Michael can pick the tag?
>>
>> diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
>> index ad4e6aa7ff..0e2f2e8bf1 100644
>> --- a/hw/pci-bridge/gen_pcie_root_port.c
>> +++ b/hw/pci-bridge/gen_pcie_root_port.c
>> @@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
>> PCIDevice *d = PCI_DEVICE(dev);
>> GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
>> PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
>> + Error *local_err = NULL;
>>
>> - rpc->parent_realize(dev, errp);
>> + rpc->parent_realize(dev, &local_err);
>> + if (local_err) {
>> + error_propagate(errp, local_err);
>> + return;
>> + }
>>
>> int rc = pci_bridge_qemu_reserve_cap_init(d, 0, grp->bus_reserve,
>> grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,
>>
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
Appreciated!
Thanks,
Marcel
> Thanks
> Laszlo
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port
2018-01-15 16:31 ` Marcel Apfelbaum
@ 2018-01-16 19:05 ` Laszlo Ersek
0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2018-01-16 19:05 UTC (permalink / raw)
To: Marcel Apfelbaum, qemu-devel, mst; +Cc: qemu-stable, zuban32s
On 01/15/18 17:31, Marcel Apfelbaum wrote:
> On 15/01/2018 17:54, Laszlo Ersek wrote:
>> On 01/10/18 20:09, Marcel Apfelbaum wrote:
>>> If we try to use more pcie_root_ports then available slots
>>> and an IO hint is passed to the port, QEMU crashes because
>>> we try to init the "IO hint" capability even if the device
>>> is not created.
>>> Fix it by checking for error before adding the capability,
>>> so QEMU can fail gracefully.
>>>
>>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>>> ---
>>> hw/pci-bridge/gen_pcie_root_port.c | 7 ++++++-
>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> In your opinion, can we add:
>>
>> Cc: qemu-stable@nongnu.org
>> Fixes: 226263fb5cdaa4a4a95f1680fabbc9dd2123fd67
>>
>> ?
>>
>> (Not sure if a stable branch is already open for 2.11. Commit
>> 226263fb5cdaa appeared in 2.11.)
>>
>> Ah, I'm silly. You CC'd stable up-front. :)
>>
>> So, what about the Fixes tag?
>>
>
> For sure, I wasn't aware of the "Fixes" tag. I'll be sure to use it
> in the future.
>
> Do I need to resend, or Michael can pick the tag?
I think Michael can add the tag the same as my R-b.
Thanks,
Laszlo
>
>>>
>>> diff --git a/hw/pci-bridge/gen_pcie_root_port.c
>>> b/hw/pci-bridge/gen_pcie_root_port.c
>>> index ad4e6aa7ff..0e2f2e8bf1 100644
>>> --- a/hw/pci-bridge/gen_pcie_root_port.c
>>> +++ b/hw/pci-bridge/gen_pcie_root_port.c
>>> @@ -74,8 +74,13 @@ static void gen_rp_realize(DeviceState *dev, Error
>>> **errp)
>>> PCIDevice *d = PCI_DEVICE(dev);
>>> GenPCIERootPort *grp = GEN_PCIE_ROOT_PORT(d);
>>> PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
>>> + Error *local_err = NULL;
>>> - rpc->parent_realize(dev, errp);
>>> + rpc->parent_realize(dev, &local_err);
>>> + if (local_err) {
>>> + error_propagate(errp, local_err);
>>> + return;
>>> + }
>>> int rc = pci_bridge_qemu_reserve_cap_init(d, 0,
>>> grp->bus_reserve,
>>> grp->io_reserve, grp->mem_reserve, grp->pref32_reserve,
>>>
>>
>> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>>
>
> Appreciated!
>
> Thanks,
> Marcel
>
>> Thanks
>> Laszlo
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-16 19:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 19:09 [Qemu-devel] [PATCH] hw/pci-bridge: fix QEMU crash because of pcie-root-port Marcel Apfelbaum
2018-01-15 15:54 ` Laszlo Ersek
2018-01-15 16:31 ` Marcel Apfelbaum
2018-01-16 19:05 ` Laszlo Ersek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.