Subject: Re: take 2 WAS(Re: PATCH: IPSEC xfrm events

From: Patrick McHardy <[email-masked]>
Date: Sun, 03 Apr 2005 17:47:51 +0200

jamal wrote:
>>+void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c)
>> {
>>+	struct xfrm_mgr *km;
>>+
>>+	read_lock(&xfrm_km_lock);
>>+	list_for_each_entry(km, &xfrm_km_list, list)
>>+		if (km->notify_policy)
>>+			km->notify_policy(xp, dir, c);
>>+	read_unlock(&xfrm_km_lock);
>>+}
>>+
>>+void km_state_notify(struct xfrm_state *x, struct km_event *c)
>>+{
>>+	struct xfrm_mgr *km;
>>+	read_lock(&xfrm_km_lock);
>>+	list_for_each_entry(km, &xfrm_km_list, list)
>>+		km->notify(x, c);
>>+	read_unlock(&xfrm_km_lock);
>>+}

You call these functions from both softirq- and user-context, so you
need to protect against BHs.

Regards
Patrick