From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
Netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Wolfgang Grandegger <wg-ynQEQJNshbs@public.gmane.org>
Subject: Re: [PATCH net-next 1/3] can: mscan: fix improper return if dlc < 8 in start_xmit function
Date: Sat, 2 Jan 2010 14:30:41 +0100 [thread overview]
Message-ID: <20100102133041.GB2239@pengutronix.de> (raw)
In-Reply-To: <1262420274-16586-2-git-send-email-wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2275 bytes --]
On Sat, Jan 02, 2010 at 09:17:52AM +0100, Wolfgang Grandegger wrote:
> From: Wolfgang Grandegger <wg-ynQEQJNshbs@public.gmane.org>
>
> The start_xmit function of the MSCAN Driver did return improperly if
> the CAN dlc check failed (skb not freed and invalid return code). This
> patch adds a proper check of the frame lenght and data size and returns
> now correctly. Furthermore, a typo has been fixed.
A few little things, but in general:
Acked-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>
> Signed-off-by: Wolfgang Grandegger <wg-ynQEQJNshbs@public.gmane.org>
> ---
> drivers/net/can/mscan/mscan.c | 11 ++++++++---
> 1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
> index 07346f8..abdf5e8 100644
> --- a/drivers/net/can/mscan/mscan.c
> +++ b/drivers/net/can/mscan/mscan.c
> @@ -4,7 +4,7 @@
> * Copyright (C) 2005-2006 Andrey Volkov <avolkov-ppI4tVfbJvJWk0Htik3J/w@public.gmane.org>,
> * Varma Electronics Oy
> * Copyright (C) 2008-2009 Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
> - * Copytight (C) 2008-2009 Pengutronix <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> + * Copyright (C) 2008-2009 Pengutronix <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the version 2 of the GNU General Public License
> @@ -177,8 +177,13 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
> int i, rtr, buf_id;
> u32 can_id;
>
> - if (frame->can_dlc > 8)
> - return -EINVAL;
> + if (skb->len != sizeof(*frame) || frame->can_dlc > 8) {
> + dev_err(dev->dev.parent,
> + "Dropping non-conform paket: len %d, can_dlc %d\n",
s/paket/packet/
> + skb->len, frame->can_dlc);
Also, shouldn't it rather be %u (sk_buff->len is unsigned int)?
> + kfree_skb(skb);
> + return NETDEV_TX_OK;
> + }
>
> out_8(®s->cantier, 0);
>
> --
> 1.6.2.5
>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
[-- Attachment #2: Type: text/plain, Size: 188 bytes --]
_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core
next prev parent reply other threads:[~2010-01-02 13:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-02 8:17 [PATCH net-next 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x Wolfgang Grandegger
2010-01-02 8:17 ` [PATCH net-next 1/3] can: mscan: fix improper return if dlc < 8 in start_xmit function Wolfgang Grandegger
2010-01-02 8:17 ` [PATCH net-next 2/3] can: mscan-mpc5xxx: add support for the MPC521x processor Wolfgang Grandegger
[not found] ` <1262420274-16586-3-git-send-email-wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-01-02 8:17 ` [PATCH net-next 3/3] powerpc/mpc5xxx: add OF platform binding doc for FSL MSCAN devices Wolfgang Grandegger
[not found] ` <1262420274-16586-4-git-send-email-wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-01-02 14:05 ` Wolfram Sang
2010-01-02 13:57 ` [PATCH net-next 2/3] can: mscan-mpc5xxx: add support for the MPC521x processor Wolfram Sang
[not found] ` <20100102135734.GC2239-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-02 16:08 ` Wolfgang Grandegger
2010-01-04 12:49 ` Wolfgang Grandegger
2010-01-04 16:24 ` Wolfram Sang
[not found] ` <20100104162441.GA4665-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-04 16:52 ` Wolfgang Grandegger
2010-01-04 17:22 ` Wolfram Sang
[not found] ` <20100104172209.GC4665-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-04 17:35 ` Wolfgang Grandegger
2010-01-04 19:40 ` Wolfgang Denk
[not found] ` <20100104194027.CB2053F6FD-C2Gvrrd9BC/j/ljBK/0BTg@public.gmane.org>
2010-01-04 20:23 ` Wolfram Sang
[not found] ` <1262420274-16586-2-git-send-email-wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-01-02 13:30 ` Wolfram Sang [this message]
[not found] ` <20100102133041.GB2239-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-02 15:34 ` [PATCH net-next 1/3] can: mscan: fix improper return if dlc < 8 in start_xmit function Wolfgang Grandegger
[not found] ` <1262420274-16586-1-git-send-email-wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-01-02 13:27 ` [PATCH net-next 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x Wolfram Sang
[not found] ` <20100102132722.GA2239-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-01-02 15:32 ` Wolfgang Grandegger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100102133041.GB2239@pengutronix.de \
--to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=Devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=Linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=Netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
--cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org \
--cc=wg-ynQEQJNshbs@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).