Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-08-08 Thread Cong Wang
On Sat, Aug 8, 2020 at 10:07 AM Gaurav Singh wrote: > > This PR fixes a possible segmentation violation. > > In function: ip6_xmit(), we have > const struct ipv6_pinfo *np = inet6_sk(sk); which returns NULL > unconditionally (regardless sk being NULL or not). > > In include/linux/ipv6.h: > >

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-08-08 Thread Gaurav Singh
This PR fixes a possible segmentation violation. In function: ip6_xmit(), we have const struct ipv6_pinfo *np = inet6_sk(sk); which returns NULL unconditionally (regardless sk being NULL or not). In include/linux/ipv6.h: static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) {

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-28 Thread Eric Dumazet
On 7/27/20 8:12 PM, Cong Wang wrote: > On Mon, Jul 27, 2020 at 7:14 PM Gaurav Singh wrote: >> >> Add return to fix build issue. Haven't reproduced this issue at >> my end. >> >> My hypothesis is this: In function: ip6_xmit(), we have >> const struct ipv6_pinfo *np = inet6_sk(sk); which returns

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread Cong Wang
On Mon, Jul 27, 2020 at 7:14 PM Gaurav Singh wrote: > > Add return to fix build issue. Haven't reproduced this issue at > my end. > > My hypothesis is this: In function: ip6_xmit(), we have > const struct ipv6_pinfo *np = inet6_sk(sk); which returns NULL. > > Further down the function, there's a

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread Gaurav Singh
Add return to fix build issue. Haven't reproduced this issue at my end. My hypothesis is this: In function: ip6_xmit(), we have const struct ipv6_pinfo *np = inet6_sk(sk); which returns NULL. Further down the function, there's a check: if (np) hlimit = hp->htop_limit Further, we have a call

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread Cong Wang
On Sun, Jul 26, 2020 at 8:39 PM Gaurav Singh wrote: > > ipv6_pinfo is initlialized by inet6_sk() which returns NULL. Why? It only returns NULL for timewait or request sock, but I don't see how ip6_autoflowlabel() could be called on these sockets. So please explain. > Hence it can cause

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread David Miller
From: Gaurav Singh Date: Sun, 26 Jul 2020 23:38:10 -0400 > ipv6_pinfo is initlialized by inet6_sk() which returns NULL. > Hence it can cause segmentation fault. Fix this by adding a > NULL check. Please take your time with such changes and actually look at the compiler output, it will warn

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-27 Thread kernel test robot
Hi Gaurav, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on sparc-next/master] [also build test WARNING on ipvs/master linus/master v5.8-rc7 next-20200724] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we

Re: [PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-26 Thread kernel test robot
Hi Gaurav, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on sparc-next/master] [also build test WARNING on ipvs/master linus/master v5.8-rc7 next-20200724] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we

[PATCH] [net/ipv6] ip6_output: Add ipv6_pinfo null check

2020-07-26 Thread Gaurav Singh
ipv6_pinfo is initlialized by inet6_sk() which returns NULL. Hence it can cause segmentation fault. Fix this by adding a NULL check. Signed-off-by: Gaurav Singh --- net/ipv6/ip6_output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/ip6_output.c