> My immediate concern is not really what selinux_xfrm_decode_session() > returns, but how to handle it, or rather errors in general, in > selinux_skb_flow_in(). I'm in the process of creating a patch to add > the missing NetLabel support to the secid patches and I am > wondering if > I should BUG_ON() for an error condition or simply jump to "out". > Jumping seems a bit cleaner to me, although perhaps harder to > debug, so > I was just wondering what the reasoning was behind the use of > BUG_ON().
It's more a "code integrity" check that I have sought to enforce via BUG_ON (meaning the function isn't expected to fail under any circumstances). Whether this is a severe enough error (possible as a result of a bug in decode_session or a corrupted kernel) that we should panic the system at that point is probably debatable. In particular I would be interested to know how similar situations are currently treated in the kernel. My recommendation would be to be consistent with the rest of the code and do a BUG_ON. As for other errors, you could jump out like the rest of the code already does (if that meets your needs that is). - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html