qib_lookup_qpn() appears to leak pointer out of rcu_read_unlock()

From: Paul E. McKenney
Date: Tue Feb 11 2014 - 19:35:26 EST


Hello!

The qib_lookup_qpn() function does RCU pointer traversals within RCU
read-side critical sections as required, but the qp pointer is returned
from this function after it does rcu_read_unlock(). One of the callers,
qib_rcv_hdrerr(), dereferences this pointer upon return.

This appears to me to be a bug. From what I can see, the structure
pointed to by qp could be freed immediately after the rcu_read_unlock(),
which would result in a SEGV when qib_rcv_hdrerr() does its later
spin_lock(&qp->r_lock).

So what am I missing here?

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/