mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
netlink: fix regression with group writers
Refactoring of argument list to nl_send_one() led to derefercing
wrong union member. Rename nl_send_one() to a more generic name,
isolate anew nl_send_one() as the callback only for the normal
writer and provide correct argument to nl_send() from nl_send_group().
Fixes: ff5ad900d2
This commit is contained in:
parent
0013741108
commit
09fa78d438
|
@ -233,7 +233,7 @@ nl_send_group(struct nl_writer *nw)
|
||||||
copy = nl_buf_copy(nb);
|
copy = nl_buf_copy(nb);
|
||||||
if (copy != NULL) {
|
if (copy != NULL) {
|
||||||
nw->buf = copy;
|
nw->buf = copy;
|
||||||
(void)nl_send_one(nw);
|
(void)nl_send(nw, nlp_last);
|
||||||
} else {
|
} else {
|
||||||
NLP_LOCK(nlp_last);
|
NLP_LOCK(nlp_last);
|
||||||
if (nlp_last->nl_socket != NULL)
|
if (nlp_last->nl_socket != NULL)
|
||||||
|
@ -246,7 +246,7 @@ nl_send_group(struct nl_writer *nw)
|
||||||
}
|
}
|
||||||
if (nlp_last != NULL) {
|
if (nlp_last != NULL) {
|
||||||
nw->buf = nb;
|
nw->buf = nb;
|
||||||
(void)nl_send_one(nw);
|
(void)nl_send(nw, nlp_last);
|
||||||
} else
|
} else
|
||||||
nl_buf_free(nb);
|
nl_buf_free(nb);
|
||||||
|
|
||||||
|
|
|
@ -194,9 +194,8 @@ nl_taskqueue_handler(void *_arg, int pending)
|
||||||
* If no queue overrunes happened, wakes up socket owner.
|
* If no queue overrunes happened, wakes up socket owner.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
nl_send_one(struct nl_writer *nw)
|
nl_send(struct nl_writer *nw, struct nlpcb *nlp)
|
||||||
{
|
{
|
||||||
struct nlpcb *nlp = nw->nlp;
|
|
||||||
struct socket *so = nlp->nl_socket;
|
struct socket *so = nlp->nl_socket;
|
||||||
struct sockbuf *sb = &so->so_rcv;
|
struct sockbuf *sb = &so->so_rcv;
|
||||||
struct nl_buf *nb;
|
struct nl_buf *nb;
|
||||||
|
|
|
@ -65,6 +65,13 @@ nlmsg_get_buf(struct nl_writer *nw, u_int len, bool waitok)
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
nl_send_one(struct nl_writer *nw)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (nl_send(nw, nw->nlp));
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
_nlmsg_get_unicast_writer(struct nl_writer *nw, int size, struct nlpcb *nlp)
|
_nlmsg_get_unicast_writer(struct nl_writer *nw, int size, struct nlpcb *nlp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,9 +130,7 @@ void nl_osd_unregister(void);
|
||||||
void nl_set_thread_nlp(struct thread *td, struct nlpcb *nlp);
|
void nl_set_thread_nlp(struct thread *td, struct nlpcb *nlp);
|
||||||
|
|
||||||
/* netlink_io.c */
|
/* netlink_io.c */
|
||||||
#define NL_IOF_UNTRANSLATED 0x01
|
bool nl_send(struct nl_writer *, struct nlpcb *);
|
||||||
#define NL_IOF_IGNORE_LIMIT 0x02
|
|
||||||
bool nl_send_one(struct nl_writer *);
|
|
||||||
void nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *nlmsg,
|
void nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *nlmsg,
|
||||||
struct nl_pstate *npt);
|
struct nl_pstate *npt);
|
||||||
void nl_on_transmit(struct nlpcb *nlp);
|
void nl_on_transmit(struct nlpcb *nlp);
|
||||||
|
|
Loading…
Reference in a new issue