Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4acf427 authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller
Browse files

taprio: add null check on sched_nest to avoid potential null pointer dereference



The call to nla_nest_start_noflag can return a null pointer and currently
this is not being checked and this can lead to a null pointer dereference
when the null pointer sched_nest is passed to function nla_nest_end. Fix
this by adding in a null pointer check.

Addresses-Coverity: ("Dereference null return value")
Fixes: a3d43c0d ("taprio: Add support adding an admin schedule")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4ee7f19
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1087,6 +1087,8 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
		goto done;
		goto done;


	sched_nest = nla_nest_start_noflag(skb, TCA_TAPRIO_ATTR_ADMIN_SCHED);
	sched_nest = nla_nest_start_noflag(skb, TCA_TAPRIO_ATTR_ADMIN_SCHED);
	if (!sched_nest)
		goto options_error;


	if (dump_schedule(skb, admin))
	if (dump_schedule(skb, admin))
		goto admin_error;
		goto admin_error;