Skip to contentSkip to conversation

Patch "net/packet: fix missing net_device reference release" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message May 31, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

net/packet: fix missing net_device reference release

to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
net-packet-fix-missing-net_device-reference-release.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed May 31 09:13:10 JST 2017

From: Douglas Caetano dos Santos <[email protected]>
Date: Fri, 12 May 2017 15:19:15 -0300
Subject: net/packet: fix missing net_device reference release

From: Douglas Caetano dos Santos <[email protected]>

[ Upstream commit d19b183cdc1fa3d70d6abe2a4c369e748cd7ebb8 ]

When using a TX ring buffer, if an error occurs processing a control message (e.g. invalid message), the net_device reference is not released.

Fixes c14ac9451c348 ("sock: enable timestamping using control messages")

---
 net/packet/af_packet.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
net/packet/af_packet.c +7 -7
@@ -2614,13 +2614,6 @@ static int tpacket_snd(struct packet_soc
 		dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
 	}
 
-	sockc.tsflags = po->sk.sk_tsflags;
-	if (msg->msg_controllen) {
-		err = sock_cmsg_send(&po->sk, msg, &sockc);
-		if (unlikely(err))
-			goto out;
-	}
-
 	err = -ENXIO;
 	if (unlikely(dev == NULL))
 		goto out;
@@ -2628,6 +2621,13 @@ static int tpacket_snd(struct packet_soc
 	if (unlikely(!(dev->flags & IFF_UP)))
 		goto out_put;
 
+	sockc.tsflags = po->sk.sk_tsflags;
+	if (msg->msg_controllen) {
+		err = sock_cmsg_send(&po->sk, msg, &sockc);
+		if (unlikely(err))
+			goto out_put;
+	}
+
 	if (po->sk.sk_socket->type == SOCK_RAW)
 		reserve = dev->hard_header_len;
 	size_max = po->tx_ring.frame_size

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/net-packet-fix-missing-net_device-reference-release.patch