Re: [PATCH net-next v4] net: openvswitch: Check vport netdev name

From: Jakub Kicinski
Date: Mon Apr 22 2024 - 20:39:12 EST


On Fri, 19 Apr 2024 14:14:25 +0800 Jun Gu wrote:
> vport->dev = dev_get_by_name(ovs_dp_get_net(vport->dp), name);
> - if (!vport->dev) {
> + /* Ensure that the device exists and that the provided
> + * name is not one of its aliases.
> + */
> + if (!vport->dev || strcmp(name, ovs_vport_name(vport))) {
> err = -ENODEV;
> goto error_free_vport;
> }

Sorry I applied this before I realised that it's buggy.
dev_get_by_name() will give you a reference on the device.
You must free it, so the error handling is different.
Please follow up ASAP to fix that.