Subject: Re: [PATCH bpf-next 1/2] bpf: support BPF_PROG_QUERY for BPF_FLOW_DISSECTOR attach_type

From: Stanislav Fomichev <[email-masked]>
Date: Tue, 23 Apr 2019 17:12:06 -0700

On 04/23, Jakub Kicinski wrote:
> On Tue, 23 Apr 2019 16:21:59 -0700, Stanislav Fomichev wrote:
> > +	rcu_read_lock();
> > +	attached = rcu_dereference(net->flow_dissector_prog);
> > +	if (attached) {
> > +		cnt = 1;
> > +		if (prog_ids &&
> > +		    copy_to_user(prog_ids, &attached->aux->id, sizeof(u32))) {
> 
> Not sure you can do copy_to_user inside an RCU section, doesn't it
> sleep?
Good point, I need to copy that aux->id somewhere and exit rcu section.

> > +			rcu_read_unlock();
> > +			return -EFAULT;
> > +		}
> > +	}
> > +	rcu_read_unlock();