Commit 609c0d95 authored by David S. Miller's avatar David S. Miller

[NETLINK]: Set socket error on netlink_ack() allocation failure.

parent 4382f5c3
...@@ -898,8 +898,18 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) ...@@ -898,8 +898,18 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len)); size = NLMSG_SPACE(4 + NLMSG_ALIGN(nlh->nlmsg_len));
skb = alloc_skb(size, GFP_KERNEL); skb = alloc_skb(size, GFP_KERNEL);
if (!skb) if (!skb) {
struct sock *sk;
sk = netlink_lookup(in_skb->sk->sk_protocol,
NETLINK_CB(in_skb).pid);
if (sk) {
sk->sk_err = ENOBUFS;
sk->sk_error_report(sk);
sock_put(sk);
}
return; return;
}
rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
NLMSG_ERROR, sizeof(struct nlmsgerr)); NLMSG_ERROR, sizeof(struct nlmsgerr));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment