diff mbox series

[net] net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup

Message ID 20201020063420.187497-1-xie.he.0141@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
jkicinski/patch_count success Link
jkicinski/tree_selection success Clearly marked for net
jkicinski/subject_prefix success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 0 this patch: 0
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Xie He Oct. 20, 2020, 6:34 a.m. UTC
This driver calls ether_setup to set up the network device.
The ether_setup function would add the IFF_TX_SKB_SHARING flag to the
device. This flag indicates that it is safe to transmit shared skbs to
the device.

However, this is not true. This driver may pad the frame (in eth_tx)
before transmission, so the skb may be modified.

Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
---
 drivers/net/wan/hdlc_raw_eth.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jakub Kicinski Oct. 22, 2020, 1:01 a.m. UTC | #1
On Mon, 19 Oct 2020 23:34:20 -0700 Xie He wrote:
> This driver calls ether_setup to set up the network device.
> The ether_setup function would add the IFF_TX_SKB_SHARING flag to the
> device. This flag indicates that it is safe to transmit shared skbs to
> the device.
> 
> However, this is not true. This driver may pad the frame (in eth_tx)
> before transmission, so the skb may be modified.
> 
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Signed-off-by: Xie He <xie.he.0141@gmail.com>

Applied, thank you. 

In the future please try to provide a Fixes: tag.
Xie He Oct. 22, 2020, 1:20 a.m. UTC | #2
On Wed, Oct 21, 2020 at 6:02 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> Applied, thank you.
>
> In the future please try to provide a Fixes: tag.

OK. Thanks! I'll remember this in the future!
diff mbox series

Patch

diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c
index 08e0a46501de..c70a518b8b47 100644
--- a/drivers/net/wan/hdlc_raw_eth.c
+++ b/drivers/net/wan/hdlc_raw_eth.c
@@ -99,6 +99,7 @@  static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
 		old_qlen = dev->tx_queue_len;
 		ether_setup(dev);
 		dev->tx_queue_len = old_qlen;
+		dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 		eth_hw_addr_random(dev);
 		call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
 		netif_dormant_off(dev);