When timestamping is enabled, stmmac_tx_clean will call stmmac_get_tx_hwtstamp to get tx TS. It's possible that skb is NULL because there are other network frames that use several descriptors. So we must return immediately in stmmac_get_tx_hwtstamp if skb is NULL to avoid system crash.
Subsystems (4)
PATCH 1/1 When timestamping is enabled, stmmac_tx_clean will call stmmac_get_tx_hwtstamp to get tx TS. It's possible that skb is NULL because there are other network frames that use several descriptors. So we must return immediately in stmmac_get_tx_hwtstamp if skb is NULL to avoid system crash.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -332,7 +332,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,return ;/* exit if skb doesn't support hw tstamp */ -if (likely (!(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS ))) +if (likely (!skb || !(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )))return ;if (priv->adv_ts)
Signature · 1 line
1.7.9.5
Quoted 2 lines · On Sun, Jan 12, 2014 at 10:01:35AM +0800, damuzi000 wrote:
Signed-off-by damuzi000 <[email protected]>
Please use real names in submissions.
Thanks,
Hannes
When timestamping is enabled, stmmac_tx_clean will call stmmac_get_tx_hwtstamp to get tx TS. It's possible that skb is NULL because there are other network frames that use several descriptors. So we must return immediately in stmmac_get_tx_hwtstamp if skb is NULL to avoid system crash.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -332,7 +332,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,return ;/* exit if skb doesn't support hw tstamp */ -if (likely (!(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS ))) +if (likely (!skb || !(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )))return ;if (priv->adv_ts)
Signature · 1 line
1.7.9.5
Quoted 6 lines · Bruce Liu
When timestamping is enabled,
stmmac_tx_cleanwill callstmmac_get_tx_hwtstampto get tx TS. It's possible that skb is NULL because there are other network frames that use several descriptors. So we must return immediately instmmac_get_tx_hwtstampif skb is NULL to avoid system crash.Signed-off-by Bruce Liu <[email protected]>
Please see Documentation/SubmittingPatches +489
You subject line is way too long and should just be something like:
[PATCH net-next] net: stmmac: fix NULL pointer dereference in stmmac_get_tx_hwtstamp
Don't indent your actual commit message with whitespaces as prefix, and do a line break after around 70 chars.
Btw, I mentioned net-next in the subject since merge window will open soon anyway.
Quoted 18 lines
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1
-1@@ -332,7 +332,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv,return ;/* exit if skb doesn't support hw tstamp */ -if (likely (!(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS ))) +if (likely (!skb || !(skb_shinfo (skb)->tx_flags &SKBTX_IN_PROGRESS )))return ;if (priv->adv_ts)
Quoted 12 lines · Daniel Borkmann
Quoted 6 lines · Bruce Liu
When timestamping is enabled,
stmmac_tx_cleanwill callstmmac_get_tx_hwtstampto get tx TS. It's possible that skb is NULL because there are other network frames that use several descriptors. So we must return immediately instmmac_get_tx_hwtstampif skb is NULL to avoid system crash.Signed-off-by Bruce Liu <[email protected]>Please see
Documentation/SubmittingPatches+489You subject line is way too long and should just be something like:
Quoted 8 lines
[PATCH net-next] net: stmmac: fix NULL pointer dereference in
stmmac_get_tx_hwtstampDon't indent your actual commit message with whitespaces as prefix, and do a line break after around 70 chars.
Btw, I mentioned net-next in the subject since merge window will open soon anyway.
Thanks, and I'll resend the patch.
Bruce.