* [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.
@ 2014-01-12 2:01 damuzi000
2014-01-12 7:20 ` Hannes Frederic Sowa
2014-01-12 9:39 ` Bruce Liu
0 siblings, 2 replies; 5+ messages in thread
From: damuzi000 @ 2014-01-12 2:01 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-kernel, damuzi000
Signed-off-by: damuzi000 <damuzi000@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 797b56a..47f2287 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [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.
2014-01-12 2:01 [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 damuzi000
@ 2014-01-12 7:20 ` Hannes Frederic Sowa
2014-01-12 9:39 ` Bruce Liu
1 sibling, 0 replies; 5+ messages in thread
From: Hannes Frederic Sowa @ 2014-01-12 7:20 UTC (permalink / raw)
To: damuzi000; +Cc: peppe.cavallaro, netdev, linux-kernel
On Sun, Jan 12, 2014 at 10:01:35AM +0800, damuzi000 wrote:
>
> Signed-off-by: damuzi000 <damuzi000@gmail.com>
Please use real names in submissions.
Thanks,
Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [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.
2014-01-12 2:01 [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 damuzi000
2014-01-12 7:20 ` Hannes Frederic Sowa
@ 2014-01-12 9:39 ` Bruce Liu
2014-01-12 11:38 ` Daniel Borkmann
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Liu @ 2014-01-12 9:39 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-kernel, damuzi000
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.
Signed-off-by: Bruce Liu <damuzi000@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 797b56a..47f2287 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [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.
2014-01-12 9:39 ` Bruce Liu
@ 2014-01-12 11:38 ` Daniel Borkmann
2014-01-13 13:54 ` Bruce Liu
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2014-01-12 11:38 UTC (permalink / raw)
To: Bruce Liu; +Cc: peppe.cavallaro, netdev, linux-kernel
On 01/12/2014 10:39 AM, Bruce Liu wrote:
> 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.
>
>
> Signed-off-by: Bruce Liu <damuzi000@gmail.com>
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.
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 797b56a..47f2287 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -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)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [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.
2014-01-12 11:38 ` Daniel Borkmann
@ 2014-01-13 13:54 ` Bruce Liu
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Liu @ 2014-01-13 13:54 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: peppe.cavallaro, netdev, linux-kernel
On Sun, Jan 12, 2014 at 12:38:28PM +0100, Daniel Borkmann wrote:
> On 01/12/2014 10:39 AM, Bruce Liu wrote:
> > 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.
> >
> >
> >Signed-off-by: Bruce Liu <damuzi000@gmail.com>
>
> 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.
>
Thanks, and I'll resend the patch.
Bruce.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-13 13:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 2:01 [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 damuzi000
2014-01-12 7:20 ` Hannes Frederic Sowa
2014-01-12 9:39 ` Bruce Liu
2014-01-12 11:38 ` Daniel Borkmann
2014-01-13 13:54 ` Bruce Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).