Patch "net: ipv4: Fix the warning for dereference" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: ipv4: Fix the warning for dereference

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-ipv4-fix-the-warning-for-dereference.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b240adf93f16b55cc86905b2530e399eb246263f
Author: Yajun Deng <yajun.deng@xxxxxxxxx>
Date:   Mon Aug 30 17:16:40 2021 +0800

    net: ipv4: Fix the warning for dereference
    
    [ Upstream commit 1b9fbe813016b08e08b22ddba4ddbf9cb1b04b00 ]
    
    Add a if statements to avoid the warning.
    
    Dan Carpenter report:
    The patch faf482ca196a: "net: ipv4: Move ip_options_fragment() out of
    loop" from Aug 23, 2021, leads to the following Smatch complaint:
    
        net/ipv4/ip_output.c:833 ip_do_fragment()
        warn: variable dereferenced before check 'iter.frag' (see line 828)
    
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Fixes: faf482ca196a ("net: ipv4: Move ip_options_fragment() out of loop")
    Link: https://lore.kernel.org/netdev/20210830073802.GR7722@kadam/T/#t
    Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index fb91a466b2d34..e77afaecc9818 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -833,7 +833,9 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
 
 		/* Everything is OK. Generate! */
 		ip_fraglist_init(skb, iph, hlen, &iter);
-		ip_options_fragment(iter.frag);
+
+		if (iter.frag)
+			ip_options_fragment(iter.frag);
 
 		for (;;) {
 			/* Prepare header of the next frame,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux