Re: [PATCH net-next v3 12/13] net: renesas: rswitch: add handler for FDB notification

From: Paolo Abeni

Date: Thu Apr 02 2026 - 09:08:27 EST


On 3/31/26 12:04 PM, Michael Dege wrote:
> +/* called under rcu_read_lock() */
> +static int rswitch_switchdev_event(struct notifier_block *nb,
> + unsigned long event,
> + void *ptr)
> +{
> + struct net_device *ndev = switchdev_notifier_info_to_dev(ptr);
> + struct rswitch_switchdev_event_work *switchdev_work;
> + struct switchdev_notifier_fdb_info *fdb_info;
> + struct switchdev_notifier_info *info = ptr;
> + struct rswitch_private *priv;
> + int err;
> +
> + priv = container_of(nb, struct rswitch_private, rswitch_switchdev_nb);
> +
> + switch (event) {
> + case SWITCHDEV_FDB_ADD_TO_DEVICE:
> + fallthrough;
> + case SWITCHDEV_FDB_DEL_TO_DEVICE:
> + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC);
> +
> + if (!switchdev_work)
> + return NOTIFY_BAD;
> +
> + switchdev_work->ndev = info->dev;
> + switchdev_work->priv = priv;
> + switchdev_work->event = event;
> +
> + fdb_info = container_of(info,
> + struct switchdev_notifier_fdb_info,
> + info);
> +
> + INIT_WORK(&switchdev_work->work, rswitch_switchdev_bridge_fdb_event_work);
> +
> + memcpy(&switchdev_work->fdb_info, ptr, sizeof(switchdev_work->fdb_info));
> +
> + switchdev_work->fdb_info.addr = kzalloc(ETH_ALEN, GFP_ATOMIC);
> + if (!switchdev_work->fdb_info.addr)
> + goto err_addr_alloc;
> +
> + ether_addr_copy((u8 *)switchdev_work->fdb_info.addr,
> + fdb_info->addr);
> + dev_hold(ndev);

Please switch to netdev_hold()/netdev_put(), providing a suitable
netdevice_tracker.

/P