lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] net: dsa: fix NULL pointer dereference in seq_match()
On Wed, Nov 30, 2022 at 2:15 PM Yuri Karpov <YKarpov@ispras.ru> wrote:
>
> ptp_parse_header() result is not checked in seq_match() that can lead
> to NULL pointer dereferense.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: c6fe0ad2c349 ("net: dsa: mv88e6xxx: add rx/tx timestamping support")
> Signed-off-by: Yuri Karpov <YKarpov@ispras.ru>
> ---
> drivers/net/dsa/mv88e6xxx/hwtstamp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/hwtstamp.c b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
> index 331b4ca089ff..97f30795a2bb 100644
> --- a/drivers/net/dsa/mv88e6xxx/hwtstamp.c
> +++ b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
> @@ -246,7 +246,7 @@ static int seq_match(struct sk_buff *skb, u16 ts_seqid)
>
> hdr = ptp_parse_header(skb, type);
>
> - return ts_seqid == ntohs(hdr->sequence_id);
> + return hdr ? ts_seqid == ntohs(hdr->sequence_id) : 0;
> }

You need to have the target tree in the subject. But change looks good to me.

Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

>
> static void mv88e6xxx_get_rxts(struct mv88e6xxx_chip *chip,
> --
> 2.34.1
>
[unhandled content-type:application/pkcs7-signature]
\
 
 \ /
  Last update: 2022-11-30 11:09    [W:0.046 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site