From: Dan Carpenter <dan.carpenter@oracle.com>
To: d.michailidis@fungible.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net/funeth: probing and netdev ops
Date: Fri, 4 Mar 2022 16:17:18 +0300 [thread overview]
Message-ID: <20220304131718.GF28739@kili> (raw)
Hello Dimitris Michailidis,
The patch ee6373ddf3a9: "net/funeth: probing and netdev ops" from Feb
24, 2022, leads to the following Smatch static checker warning:
drivers/net/ethernet/fungible/funeth/funeth_main.c:477 fun_free_rings()
warn: 'rxqs' was already freed.
drivers/net/ethernet/fungible/funeth/funeth_main.c
443 static void fun_free_rings(struct net_device *netdev, struct fun_qset *qset)
444 {
445 struct funeth_priv *fp = netdev_priv(netdev);
446 struct funeth_txq **xdpqs = qset->xdpqs;
447 struct funeth_rxq **rxqs = qset->rxqs;
448
449 /* qset may not specify any queues to operate on. In that case the
450 * currently installed queues are implied.
451 */
452 if (!rxqs) {
453 rxqs = rtnl_dereference(fp->rxqs);
454 xdpqs = rtnl_dereference(fp->xdpqs);
455 qset->txqs = fp->txqs;
456 qset->nrxqs = netdev->real_num_rx_queues;
457 qset->ntxqs = netdev->real_num_tx_queues;
458 qset->nxdpqs = fp->num_xdpqs;
459 }
460 if (!rxqs)
461 return;
462
463 if (rxqs == rtnl_dereference(fp->rxqs)) {
464 rcu_assign_pointer(fp->rxqs, NULL);
465 rcu_assign_pointer(fp->xdpqs, NULL);
466 synchronize_net();
467 fp->txqs = NULL;
468 }
469
470 free_rxqs(rxqs, qset->nrxqs, qset->rxq_start, qset->state);
471 free_txqs(qset->txqs, qset->ntxqs, qset->txq_start, qset->state);
472 free_xdpqs(xdpqs, qset->nxdpqs, qset->xdpq_start, qset->state);
473 if (qset->state == FUN_QSTATE_DESTROYED)
474 kfree(rxqs);
^^^^^^^^^^^
Should this return or set "rxqs = NULL" or something?
475
476 /* Tell the caller which queues were operated on. */
--> 477 qset->rxqs = rxqs;
^^^^^^^^^^^^^^^^^^
Only bad things will happen with safing this freed pointer.
478 qset->xdpqs = xdpqs;
479 }
regards,
dan carpenter
next reply other threads:[~2022-03-04 13:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 13:17 Dan Carpenter [this message]
2022-03-04 18:40 ` [bug report] net/funeth: probing and netdev ops Dimitris Michailidis
-- strict thread matches above, loose matches on Subject: below --
2024-08-15 11:29 Dan Carpenter
2024-08-15 15:59 ` Jakub Kicinski
2024-08-16 9:36 ` Dimitris Michailidis
2025-03-11 15:01 Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220304131718.GF28739@kili \
--to=dan.carpenter@oracle.com \
--cc=d.michailidis@fungible.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.