Thread (1 message) 1 message, 1 author, 2019-09-01

Re: [PATCH net 7/7] rxrpc: Use skb_unshare() rather than skb_cow_data()

From: David Howells <dhowells@redhat.com>
Date: 2019-09-01 07:11:46
Also in: lkml

Hillf Danton [off-list ref] wrote:
quoted
+		/* Unshare the packet so that it can be modified for in-place
+		 * decryption.
+		 */
+		if (sp->hdr.securityIndex != 0) {
+			struct sk_buff *nskb = skb_unshare(skb, GFP_ATOMIC);
+			if (!nskb) {
+				rxrpc_eaten_skb(skb, rxrpc_skb_unshared_nomem);
+				goto out;
+			}
+
+			if (nskb != skb) {
+				rxrpc_eaten_skb(skb, rxrpc_skb_received);
+				rxrpc_new_skb(skb, rxrpc_skb_unshared);
+				skb = nskb;
+				sp = rxrpc_skb(skb);
+			}
+		}
Unsharing skb makes it perilous to take a peep at it afterwards.
Ah, good point.  rxrpc_new_skb() should be after the assignment.

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help