Skip to contentSkip to conversation

Race in svcsock.c in 2.5.61

PATCH Trond Myklebust 1 participant 1 message Feb 17, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Neil,

knfsd needs to disable soft interrupts when calling csum_partial_copy_to_xdr().

At the moment there's a nasty conflict between the RPC server and client. The problem arises when you get to xdr_partial_copy_from_skb() (and the kmap_atomic()); the RPC client can end up calling the same function from a ->data_ready() soft interrupt, and corrupt any data the knfsd process may have copied.

Cheers,
Trond

net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c.orig +3 -0
@@ -577,12 +577,15 @@
 
 	if (skb_is_nonlinear(skb)) {
 		/* we have to copy */
+		local_bh_disable();
 		if (csum_partial_copy_to_xdr(&rqstp->rq_arg, skb)) {
+			local_bh_enable();
 			/* checksum error */
 			skb_free_datagram(svsk->sk_sk, skb);
 			svc_sock_received(svsk);
 			return 0;
 		}
+		local_bh_enable();
 		skb_free_datagram(svsk->sk_sk, skb); 
 	} else {
 		/* we can use it in-place */