[PATCH] ipv6:ip6_xmit remove unnecessary np NULL check

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE3526d REVIEWED: 1 (0M)

1 review trailer.

3 messages, 3 authors, 2016-12-10 · open the first message on its own page

[PATCH] ipv6:ip6_xmit remove unnecessary np NULL check

From: Manjeet Pawar <hidden>
Date: 2016-11-29 06:39:21

From: Rohit Thapliyal <redacted>

np NULL check doesn't seem required here as it shall never
be NULL anyways in inet6_sk(sk).

Signed-off-by: Rohit Thapliyal <redacted>
Signed-off-by: Manjeet Pawar <redacted>
Signed-off-by: David Miller <davem@davemloft.net>
Reviewed-by: Akhilesh Kumar <redacted>

---
v2->v3: Modified as per the suggestion from David Miller
        ip6_xmit calls are made without checking NULL np
        pointer, so no need to explicitly check NULL np in
        ip6_xmit.

 include/linux/ipv6.h  | 2 +-
 net/ipv6/ip6_output.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a064997..6c9c604 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -299,7 +299,7 @@ struct tcp6_timewait_sock {
 
 static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
-	return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
+	return inet_sk(__sk)->pinet6;
 }
 
 static inline struct raw6_sock *raw6_sk(const struct sock *sk)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59eb4ed..f8c63ec 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -213,8 +213,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
 	/*
 	 *	Fill in the IPv6 header
 	 */
-	if (np)
-		hlimit = np->hop_limit;
+	hlimit = np->hop_limit;
 	if (hlimit < 0)
 		hlimit = ip6_dst_hoplimit(dst);
 
-- 
1.9.1

Re: [PATCH] ipv6:ip6_xmit remove unnecessary np NULL check

From: Eric Dumazet <hidden>
Date: 2016-11-29 15:26:23

On Tue, 2016-11-29 at 12:02 +0530, Manjeet Pawar wrote:
quoted hunk
From: Rohit Thapliyal <redacted>

np NULL check doesn't seem required here as it shall never
be NULL anyways in inet6_sk(sk).

Signed-off-by: Rohit Thapliyal <redacted>
Signed-off-by: Manjeet Pawar <redacted>
Signed-off-by: David Miller <davem@davemloft.net>
Reviewed-by: Akhilesh Kumar <redacted>

---
v2->v3: Modified as per the suggestion from David Miller
        ip6_xmit calls are made without checking NULL np
        pointer, so no need to explicitly check NULL np in
        ip6_xmit.

 include/linux/ipv6.h  | 2 +-
 net/ipv6/ip6_output.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index a064997..6c9c604 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -299,7 +299,7 @@ struct tcp6_timewait_sock {
 
 static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
-	return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
+	return inet_sk(__sk)->pinet6;

David suggestion was about np being NULL or not in ip6_xmit()

But have you checked inet6_sk() was never called for a TCPv6 TIMEWAIT or
SYN_RECV request ?
quoted hunk
 }
 
 static inline struct raw6_sock *raw6_sk(const struct sock *sk)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59eb4ed..f8c63ec 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -213,8 +213,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
 	/*
 	 *	Fill in the IPv6 header
 	 */
-	if (np)
-		hlimit = np->hop_limit;
+	hlimit = np->hop_limit;
 	if (hlimit < 0)
 		hlimit = ip6_dst_hoplimit(dst);
 
This part is fine.

[ipv6] fe17dfdb36: general_protection_fault:#[##]SMP

From: kernel test robot <hidden>
Date: 2016-12-10 11:46:42

FYI, we noticed the following commit:

commit: fe17dfdb369d8b02fe19efc0f942c241896b4ae9 ("ipv6:ip6_xmit remove unnecessary np NULL check")
url: https://github.com/0day-ci/linux/commits/Manjeet-Pawar/ipv6-ip6_xmit-remove-unnecessary-np-NULL-check/20161129-151359


in testcase: nepim
with following parameters:

	runtime: 300s
	nr_threads: 100%
	cluster: cs-localhost
	protocol: tcp6
	cpufreq_governor: performance



on test machine: 8 threads Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz with 4G memory

caused below changes:


+------------------------------------------------------------------+------------+------------+
|                                                                  | 88abd8249e | fe17dfdb36 |
+------------------------------------------------------------------+------------+------------+
| boot_successes                                                   | 35         | 23         |
| boot_failures                                                    | 0          | 7          |
| invoked_oom-killer:gfp_mask=0x                                   | 0          | 2          |
| Mem-Info                                                         | 0          | 2          |
| Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 0          | 2          |
| general_protection_fault:#[##]SMP                                | 0          | 5          |
| RIP:ip6_finish_output                                            | 0          | 5          |
| calltrace:SyS_connect                                            | 0          | 5          |
| Kernel_panic-not_syncing:Fatal_exception_in_interrupt            | 0          | 5          |
+------------------------------------------------------------------+------------+------------+



[   14.178859] x86/PAT: bmc-watchdog:541 map pfn expected mapping type uncached-minus for [mem 0xbf780000-0xbf780fff], got write-back
[   14.179569] x86/PAT: bmc-watchdog:541 map pfn expected mapping type uncached-minus for [mem 0xbf780000-0xbf780fff], got write-back
[   15.155044] kernel profiling enabled schedstats, disable via kernel.sched_schedstats.
[   16.163235] general protection fault: 0000 [#1] SMP
[   16.163530] Modules linked in: rpcsec_gss_krb5 auth_rpcgss
[   16.163833] 2016-12-10 11:34:08 ./nepim -c ::1 -d -a 300 -n 8
[   16.163835] 
[   16.164380]  nfsv4 dns_resolver netconsole sr_mod cdromnepim - network pipemeter - version 0.53


To reproduce:

        git clone git://git.kernel.org/pub/scm/linux/kernel/git/wfg/lkp-tests.git
        cd lkp-tests
        bin/lkp install job.yaml  # job file is attached in this email
        bin/lkp run     job.yaml



Thanks,
Kernel Test Robot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help