Blame SOURCES/0102-tc-q_netem-Don-t-dereference-possibly-NULL-pointer.patch

36cfb7
From a7329f9d8681bdbd2d8257b152ae6b4959232e67 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:08:08 +0200
36cfb7
Subject: [PATCH] tc/q_netem: Don't dereference possibly NULL pointer
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit a754de3ccd937
36cfb7
36cfb7
commit a754de3ccd937500940c6fcd0ad043855f56862d
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 24 11:46:32 2017 +0200
36cfb7
36cfb7
    tc/q_netem: Don't dereference possibly NULL pointer
36cfb7
36cfb7
    Assuming 'opt' might be NULL, move the call to RTA_PAYLOAD to after the
36cfb7
    check since it dereferences its parameter.
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 tc/q_netem.c | 3 ++-
36cfb7
 1 file changed, 2 insertions(+), 1 deletion(-)
36cfb7
36cfb7
diff --git a/tc/q_netem.c b/tc/q_netem.c
36cfb7
index 0975ae111de97..5a9e747411e85 100644
36cfb7
--- a/tc/q_netem.c
36cfb7
+++ b/tc/q_netem.c
36cfb7
@@ -538,7 +538,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
36cfb7
 	int *ecn = NULL;
36cfb7
 	struct tc_netem_qopt qopt;
36cfb7
 	const struct tc_netem_rate *rate = NULL;
36cfb7
-	int len = RTA_PAYLOAD(opt) - sizeof(qopt);
36cfb7
+	int len;
36cfb7
 	__u64 rate64 = 0;
36cfb7
 
36cfb7
 	SPRINT_BUF(b1);
36cfb7
@@ -546,6 +546,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
36cfb7
 	if (opt == NULL)
36cfb7
 		return 0;
36cfb7
 
36cfb7
+	len = RTA_PAYLOAD(opt) - sizeof(qopt);
36cfb7
 	if (len < 0) {
36cfb7
 		fprintf(stderr, "options size error\n");
36cfb7
 		return -1;
36cfb7
-- 
e138d9
2.21.0
36cfb7