Patch "macsec: fix NULL deref in macsec_add_rxsa" has been added to the 5.15-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

    macsec: fix NULL deref in macsec_add_rxsa

to the 5.15-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:
     macsec-fix-null-deref-in-macsec_add_rxsa.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 414439ad3b6120d214261de3ba8fdcd99b3ee897
Author: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
Date:   Fri Jul 22 11:16:27 2022 +0200

    macsec: fix NULL deref in macsec_add_rxsa
    
    [ Upstream commit f46040eeaf2e523a4096199fd93a11e794818009 ]
    
    Commit 48ef50fa866a added a test on tb_sa[MACSEC_SA_ATTR_PN], but
    nothing guarantees that it's not NULL at this point. The same code was
    added to macsec_add_txsa, but there it's not a problem because
    validate_add_txsa checks that the MACSEC_SA_ATTR_PN attribute is
    present.
    
    Note: it's not possible to reproduce with iproute, because iproute
    doesn't allow creating an SA without specifying the PN.
    
    Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites (IEEE 802.1AEbw)")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=208315
    Reported-by: Frantisek Sumsal <fsumsal@xxxxxxxxxx>
    Signed-off-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index e53b40359fd1..f72d4380374d 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1751,7 +1751,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	pn_len = secy->xpn ? MACSEC_XPN_PN_LEN : MACSEC_DEFAULT_PN_LEN;
-	if (nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) {
+	if (tb_sa[MACSEC_SA_ATTR_PN] &&
+	    nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) {
 		pr_notice("macsec: nl: add_rxsa: bad pn length: %d != %d\n",
 			  nla_len(tb_sa[MACSEC_SA_ATTR_PN]), pn_len);
 		rtnl_unlock();



[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