net: if: Make sure iface->if_dev is not null when accessing L2

commit 971ae59913 ("net: pkt: Make sure iface is not null when
accessing L2") fixed net_if_l2 where iface was NULL, however if
iface->if_dev is NULL, the check breaks and returns an offset of
NULL (0x82 or so).  This is incorrect.

Let's add a check for iface->if_dev as well.

Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
Michael Scott 2020-01-24 11:41:54 -08:00 committed by Jukka Rissanen
commit 407ceeee6d

View file

@ -550,7 +550,7 @@ enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt);
*/
static inline const struct net_l2 * const net_if_l2(struct net_if *iface)
{
if (!iface) {
if (!iface || !iface->if_dev) {
return NULL;
}