[next,1/2] batman-adv: check return type of unicast packet preparations
Commit Message
batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's data.
And if it tries to do so then this can potentially fail.
We shouldn't continue working on this skb in such a case.
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
unicast.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
Il 27.07.2013 03:24 Linus Lüssing ha scritto:
> batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
> data.
In next these functions are named a bit differently. I think this can be
fixed while merging the patch.
> And if it tries to do so then this can potentially fail.
>
> We shouldn't continue working on this skb in such a case.
>
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
On Monday, July 29, 2013 04:14:23 Antonio Quartulli wrote:
> Il 27.07.2013 03:24 Linus Lüssing ha scritto:
> > batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
> > data.
>
> In next these functions are named a bit differently. I think this can be
> fixed while merging the patch.
>
> > And if it tries to do so then this can potentially fail.
> >
> > We shouldn't continue working on this skb in such a case.
> >
> > Signed-off-by: Linus Lüssing <linus.luessing@web.de>
>
> Acked-by: Antonio Quartulli <ordex@autistici.org>
Applied in revision d781a70.
Thanks,
Marek
@@ -428,11 +428,13 @@ find_router:
switch (packet_type) {
case BATADV_UNICAST:
- batadv_unicast_prepare_skb(skb, orig_node);
+ if (!batadv_unicast_prepare_skb(skb, orig_node))
+ goto out;
break;
case BATADV_UNICAST_4ADDR:
- batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
- packet_subtype);
+ if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
+ packet_subtype))
+ goto out;
break;
default:
/* this function supports UNICAST and UNICAST_4ADDR only. It