Patch "ppp: Fix generating ifname when empty IFLA_IFNAME is specified" has been added to the 5.13-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

    ppp: Fix generating ifname when empty IFLA_IFNAME is specified

to the 5.13-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:
     ppp-fix-generating-ifname-when-empty-ifla_ifname-is-.patch
and it can be found in the queue-5.13 subdirectory.

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



commit 3a23e1c2a34563f6607b56a699ae62ea09811073
Author: Pali Rohár <pali@xxxxxxxxxx>
Date:   Sat Aug 7 15:27:03 2021 +0200

    ppp: Fix generating ifname when empty IFLA_IFNAME is specified
    
    [ Upstream commit 2459dcb96bcba94c08d6861f8a050185ff301672 ]
    
    IFLA_IFNAME is nul-term string which means that IFLA_IFNAME buffer can be
    larger than length of string which contains.
    
    Function __rtnl_newlink() generates new own ifname if either IFLA_IFNAME
    was not specified at all or userspace passed empty nul-term string.
    
    It is expected that if userspace does not specify ifname for new ppp netdev
    then kernel generates one in format "ppp<id>" where id matches to the ppp
    unit id which can be later obtained by PPPIOCGUNIT ioctl.
    
    And it works in this way if IFLA_IFNAME is not specified at all. But it
    does not work when IFLA_IFNAME is specified with empty string.
    
    So fix this logic also for empty IFLA_IFNAME in ppp_nl_newlink() function
    and correctly generates ifname based on ppp unit identifier if userspace
    did not provided preferred ifname.
    
    Without this patch when IFLA_IFNAME was specified with empty string then
    kernel created a new ppp interface in format "ppp<id>" but id did not
    match ppp unit id returned by PPPIOCGUNIT ioctl. In this case id was some
    number generated by __rtnl_newlink() function.
    
    Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
    Fixes: bb8082f69138 ("ppp: build ifname using unit identifier for rtnl based devices")
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index b9dd47bd597f..7a099c37527f 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1317,7 +1317,7 @@ static int ppp_nl_newlink(struct net *src_net, struct net_device *dev,
 	 * the PPP unit identifer as suffix (i.e. ppp<unit_id>). This allows
 	 * userspace to infer the device name using to the PPPIOCGUNIT ioctl.
 	 */
-	if (!tb[IFLA_IFNAME])
+	if (!tb[IFLA_IFNAME] || !nla_len(tb[IFLA_IFNAME]) || !*(char *)nla_data(tb[IFLA_IFNAME]))
 		conf.ifname_is_set = false;
 
 	err = ppp_dev_configure(src_net, dev, &conf);



[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