netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [net/sched] Fix null pointer deref skb in tc_ctl_action
@ 2020-06-18  1:43 Gaurav Singh
  2020-06-18  3:43 ` Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gaurav Singh @ 2020-06-18  1:43 UTC (permalink / raw)
  To: gaurav1086, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	David S. Miller, Jakub Kicinski, open list:TC subsystem,
	open list

Add null check for skb

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 net/sched/act_api.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 8ac7eb0a8309..fd584821d75a 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1473,9 +1473,12 @@ static const struct nla_policy tcaa_policy[TCA_ROOT_MAX + 1] = {
 static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n,
 			 struct netlink_ext_ack *extack)
 {
+	if (!skb)
+		return 0;
+
 	struct net *net = sock_net(skb->sk);
 	struct nlattr *tca[TCA_ROOT_MAX + 1];
-	u32 portid = skb ? NETLINK_CB(skb).portid : 0;
+	u32 portid = NETLINK_CB(skb).portid;
 	int ret = 0, ovr = 0;
 
 	if ((n->nlmsg_type != RTM_GETACTION) &&
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-21  4:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-18  1:43 [PATCH] [net/sched] Fix null pointer deref skb in tc_ctl_action Gaurav Singh
2020-06-18  3:43 ` Eric Dumazet
2020-06-18 14:54 ` David Miller
2020-06-19 18:39 ` kernel test robot
2020-06-19 19:24 ` [PATCH] [net/sched] Remove redundant skb null check Gaurav Singh
2020-06-21  4:30   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).