lkml.org 
[lkml]   [2009]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch] hamradio: avoid null deref v3
    This should address the problems in version 1 (lazy) and version 2 (ugly).

    Bump the stats on orig_dev not on the newly assigned NULL dev variable.

    Signed-off-by: Dan Carpenter <error27@gmail.com>

    --- orig/drivers/net/hamradio/bpqether.c 2009-12-22 23:58:56.000000000 +0200
    +++ devel/drivers/net/hamradio/bpqether.c 2009-12-28 00:12:48.000000000 +0200
    @@ -248,6 +248,7 @@ static netdev_tx_t bpq_xmit(struct sk_bu
    {
    unsigned char *ptr;
    struct bpqdev *bpq;
    + struct net_device *orig_dev;
    int size;

    /*
    @@ -282,8 +283,9 @@ static netdev_tx_t bpq_xmit(struct sk_bu

    bpq = netdev_priv(dev);

    + orig_dev = dev;
    if ((dev = bpq_get_ether_dev(dev)) == NULL) {
    - dev->stats.tx_dropped++;
    + orig_dev->stats.tx_dropped++;
    kfree_skb(skb);
    return NETDEV_TX_OK;
    }

    \
     
     \ /
      Last update: 2009-12-28 17:57    [W:0.024 / U:0.260 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site