1. 12 Jul, 2009 4 commits
  2. 10 Jul, 2009 4 commits
    • Roland Dreier's avatar
      cxgb3: Fix crash caused by stashing wrong netdev_queue · e594e96e
      Roland Dreier authored
      Commit c3a8c5b6 ("cxgb3: move away from LLTX") exposed a bug in how
      cxgb3 looks up the netdev_queue it stashes away in a qset during
      initialization.  For multiport devices, the TX queue index it uses is
      offset by the first_qset index of each port.  This leads to a crash
      once LLTX is removed, since hard_start_xmit is called with one TX
      queue lock held, while the TX reclaim timer task grabs a different
      (wrong) TX queue lock when it frees skbs.
      
      Fix this by removing the first_qset offset used to look up the TX
      queue passed into t3_sge_alloc_qset() from setup_sge_qsets().
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
      Acked-by: default avatarDivy Le Ray <divy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e594e96e
    • Yi Zou's avatar
      ixgbe: Fix coexistence of FCoE and Flow Director in 82599 · 8faa2a78
      Yi Zou authored
      Fix coexistence of Fiber Channel over Ethernet (FCoE) and Flow Director (FDIR)
      in 82599 and remove the disabling of FDIR when FCoE is enabled.
      
      Currently, FDIR is turned off when FCoE is enabled under the assumption that
      FCoE is always enabled with DCB being turned on. However, FDIR does not have
      to be turned off all the time when FCoE is enabled since FCoE can be enabled
      without DCB being turned on, e.g., use link pause only. This patch makes sure
      that when DCB is turned on or off, FDIR is turned on or off correspondingly;
      and when FCoE is enabled, it does not disable FDIR, rather, it will have FDIR
      set up properly so FCoE and FDIR can coexist regardless of DCB being on or off.
      Signed-off-by: default avatarYi Zou <yi.zou@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8faa2a78
    • Jiri Olsa's avatar
      memory barrier: adding smp_mb__after_lock · ad462769
      Jiri Olsa authored
      Adding smp_mb__after_lock define to be used as a smp_mb call after
      a lock.
      
      Making it nop for x86, since {read|write|spin}_lock() on x86 are
      full memory barriers.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad462769
    • Jiri Olsa's avatar
      net: adding memory barrier to the poll and receive callbacks · a57de0b4
      Jiri Olsa authored
      Adding memory barrier after the poll_wait function, paired with
      receive callbacks. Adding fuctions sock_poll_wait and sk_has_sleeper
      to wrap the memory barrier.
      
      Without the memory barrier, following race can happen.
      The race fires, when following code paths meet, and the tp->rcv_nxt
      and __add_wait_queue updates stay in CPU caches.
      
      CPU1                         CPU2
      
      sys_select                   receive packet
        ...                        ...
        __add_wait_queue           update tp->rcv_nxt
        ...                        ...
        tp->rcv_nxt check          sock_def_readable
        ...                        {
        schedule                      ...
                                      if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
                                              wake_up_interruptible(sk->sk_sleep)
                                      ...
                                   }
      
      If there was no cache the code would work ok, since the wait_queue and
      rcv_nxt are opposit to each other.
      
      Meaning that once tp->rcv_nxt is updated by CPU2, the CPU1 either already
      passed the tp->rcv_nxt check and sleeps, or will get the new value for
      tp->rcv_nxt and will return with new data mask.
      In both cases the process (CPU1) is being added to the wait queue, so the
      waitqueue_active (CPU2) call cannot miss and will wake up CPU1.
      
      The bad case is when the __add_wait_queue changes done by CPU1 stay in its
      cache, and so does the tp->rcv_nxt update on CPU2 side.  The CPU1 will then
      endup calling schedule and sleep forever if there are no more data on the
      socket.
      
      Calls to poll_wait in following modules were ommited:
      	net/bluetooth/af_bluetooth.c
      	net/irda/af_irda.c
      	net/irda/irnet/irnet_ppp.c
      	net/mac80211/rc80211_pid_debugfs.c
      	net/phonet/socket.c
      	net/rds/af_rds.c
      	net/rfkill/core.c
      	net/sunrpc/cache.c
      	net/sunrpc/rpc_pipe.c
      	net/tipc/socket.c
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a57de0b4
  3. 09 Jul, 2009 2 commits
  4. 08 Jul, 2009 14 commits
  5. 07 Jul, 2009 10 commits
    • Luciano Coelho's avatar
      mac80211: minstrel: avoid accessing negative indices in rix_to_ndx() · 3938b45c
      Luciano Coelho authored
      If rix is not found in mi->r[], i will become -1 after the loop.  This value
      is eventually used to access arrays, so we were accessing arrays with a
      negative index, which is obviously not what we want to do.  This patch fixes
      this potential problem.
      Signed-off-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
      Acked-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      3938b45c
    • Johannes Berg's avatar
      cfg80211: fix refcount leak · 2dce4c2b
      Johannes Berg authored
      The code in cfg80211's cfg80211_bss_update erroneously
      grabs a reference to the BSS, which means that it will
      never be freed.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Cc: stable@kernel.org [2.6.29, 2.6.30]
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      2dce4c2b
    • Johannes Berg's avatar
      hp-wmi: fix rfkill bug · 76d8b64e
      Johannes Berg authored
      Fix the third (I think) polarity error I accidentally
      introduced in the rfkill rewrite to make wireless work
      again on (certain?) HP laptops.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Tested-by: default avatarMaciej Rutecki <maciej.rutecki@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      76d8b64e
    • Andrey Yurovsky's avatar
      mac80211: fix allocation in mesh_queue_preq · 59615b5f
      Andrey Yurovsky authored
      We allocate a PREQ queue node in mesh_queue_preq, however the allocation
      may cause us to sleep.  Use GFP_ATOMIC to prevent this.
      
      [ 1869.126498] BUG: scheduling while atomic: ping/1859/0x10000100
      [ 1869.127164] Modules linked in: ath5k mac80211 ath
      [ 1869.128310] Pid: 1859, comm: ping Not tainted 2.6.30-wl #1
      [ 1869.128754] Call Trace:
      [ 1869.129293]  [<c1023a2b>] __schedule_bug+0x48/0x4d
      [ 1869.129866]  [<c13b5533>] __schedule+0x77/0x67a
      [ 1869.130544]  [<c1026f2e>] ? release_console_sem+0x17d/0x185
      [ 1869.131568]  [<c807cf47>] ? mesh_queue_preq+0x2b/0x165 [mac80211]
      [ 1869.132318]  [<c13b5b3e>] schedule+0x8/0x1f
      [ 1869.132807]  [<c1023c12>] __cond_resched+0x16/0x2f
      [ 1869.133478]  [<c13b5bf0>] _cond_resched+0x27/0x32
      [ 1869.134191]  [<c108a370>] kmem_cache_alloc+0x1c/0xcf
      [ 1869.134714]  [<c10273ae>] ? printk+0x15/0x17
      [ 1869.135670]  [<c807cf47>] mesh_queue_preq+0x2b/0x165 [mac80211]
      [ 1869.136731]  [<c807d1f8>] mesh_nexthop_lookup+0xee/0x12d [mac80211]
      [ 1869.138130]  [<c807417e>] ieee80211_xmit+0xe6/0x2b2 [mac80211]
      [ 1869.138935]  [<c80be46d>] ? ath5k_hw_setup_rx_desc+0x0/0x66 [ath5k]
      [ 1869.139831]  [<c80c97bc>] ? ath5k_tasklet_rx+0xba/0x506 [ath5k]
      [ 1869.140863]  [<c8075191>] ieee80211_subif_start_xmit+0x6c9/0x6e4
      [mac80211]
      [ 1869.141665]  [<c105cf1c>] ? handle_level_irq+0x78/0x9d
      [ 1869.142390]  [<c12e3f93>] dev_hard_start_xmit+0x168/0x1c7
      [ 1869.143092]  [<c12f1f17>] __qdisc_run+0xe1/0x1b7
      [ 1869.143612]  [<c12e25ff>] qdisc_run+0x18/0x1a
      [ 1869.144248]  [<c12e62f4>] dev_queue_xmit+0x16a/0x25a
      [ 1869.144785]  [<c13b6dcc>] ? _read_unlock_bh+0xe/0x10
      [ 1869.145465]  [<c12eacdb>] neigh_resolve_output+0x19c/0x1c7
      [ 1869.146182]  [<c130e2da>] ? ip_finish_output+0x0/0x51
      [ 1869.146697]  [<c130e2a0>] ip_finish_output2+0x182/0x1bc
      [ 1869.147358]  [<c130e327>] ip_finish_output+0x4d/0x51
      [ 1869.147863]  [<c130e9d5>] ip_output+0x80/0x85
      [ 1869.148515]  [<c130cc49>] dst_output+0x9/0xb
      [ 1869.149141]  [<c130dec6>] ip_local_out+0x17/0x1a
      [ 1869.149632]  [<c130e0bc>] ip_push_pending_frames+0x1f3/0x255
      [ 1869.150343]  [<c13247ff>] raw_sendmsg+0x5e6/0x667
      [ 1869.150883]  [<c1033c55>] ? insert_work+0x6a/0x73
      [ 1869.151834]  [<c8071e00>] ?
      ieee80211_invoke_rx_handlers+0x17da/0x1ae8 [mac80211]
      [ 1869.152630]  [<c132bd68>] inet_sendmsg+0x3b/0x48
      [ 1869.153232]  [<c12d7deb>] __sock_sendmsg+0x45/0x4e
      [ 1869.153740]  [<c12d8537>] sock_sendmsg+0xb8/0xce
      [ 1869.154519]  [<c80be46d>] ? ath5k_hw_setup_rx_desc+0x0/0x66 [ath5k]
      [ 1869.155289]  [<c1036b25>] ? autoremove_wake_function+0x0/0x30
      [ 1869.155859]  [<c115992b>] ? __copy_from_user_ll+0x11/0xce
      [ 1869.156573]  [<c1159d99>] ? copy_from_user+0x31/0x54
      [ 1869.157235]  [<c12df646>] ? verify_iovec+0x40/0x6e
      [ 1869.157778]  [<c12d869a>] sys_sendmsg+0x14d/0x1a5
      [ 1869.158714]  [<c8072c40>] ? __ieee80211_rx+0x49e/0x4ee [mac80211]
      [ 1869.159641]  [<c80c83fe>] ? ath5k_rxbuf_setup+0x6d/0x8d [ath5k]
      [ 1869.160543]  [<c80be46d>] ? ath5k_hw_setup_rx_desc+0x0/0x66 [ath5k]
      [ 1869.161434]  [<c80beba4>] ? ath5k_hw_get_rxdp+0xe/0x10 [ath5k]
      [ 1869.162319]  [<c80c97bc>] ? ath5k_tasklet_rx+0xba/0x506 [ath5k]
      [ 1869.163063]  [<c1005627>] ? enable_8259A_irq+0x40/0x43
      [ 1869.163594]  [<c101edb8>] ? __dequeue_entity+0x23/0x27
      [ 1869.164793]  [<c100187a>] ? __switch_to+0x2b/0x105
      [ 1869.165442]  [<c1021d5f>] ? finish_task_switch+0x5b/0x74
      [ 1869.166129]  [<c12d963a>] sys_socketcall+0x14b/0x17b
      [ 1869.166612]  [<c1002b95>] syscall_call+0x7/0xb
      Signed-off-by: default avatarAndrey Yurovsky <andrey@cozybit.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      59615b5f
    • Samuel Ortiz's avatar
      iwmc3200wifi: add Kconfig help · a7a4e41e
      Samuel Ortiz authored
      We're missing a Kconfig help for the iwmc3200wifi driver.
      Signed-off-by: default avatarSamuel Ortiz <samuel.ortiz@intel.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      a7a4e41e
    • Vasanthakumar Thiagarajan's avatar
      ath9k: Fix leak in tx descriptor · cbfe89c6
      Vasanthakumar Thiagarajan authored
      When we reclaim the tx desc, we always assume that the
      last desc is a holding desc, which is not true, and skip it.
      If the tx queue is drained during channel change, internal
      reset and etc, the last descriptor may not be the holding
      descriptor and we fail to reclaim them. This results in the
      following two issues.
      
      1. Tx stuck - We drop all the frames coming from upper layer
      due to shortage in tx desc.
      
      2. Crash - If we fail to reclaim a tx descriptor, we miss to
      update the tx BA window with the seq number of the frame
      associated to that desc, which, at some point, result in
      the following crash due to an assert failure in ath_tx_addto_baw().
      
      This patch fixes these two issues.
      
       kernel BUG at ../drivers/net/wireless/ath/ath9k/xmit.c:180!
      [155064.304164] invalid opcode: 0000 [#1] SMP
       Call Trace:
        [<fbc6d83b>] ? ath9k_tx+0xeb/0x160 [ath9k]
        [<fbbc9591>]  ipv6? __ieee80211_tx+0x41/0x120 [mac80211]
        [<fbbcb5ae>] ?  aes_i586ieee80211_master_start_xmit+0x28e/0x560 [mac80211]
        [<c037e501>]  aes_generic? _spin_lock_irqsave+0x31/0x40
        [<c02f347b>] ? dev_hard_start_xmit+0x16b/0x1c0
        [<c03058b5>] ? __qdisc_run+0x1b5/0x200
        [<fbbcda5a>] ?  af_packetieee80211_select_queue+0xa/0x100 [mac80211]
        [<c02f53b7>] ?  i915dev_queue_xmit+0x2e7/0x3f0
        [<fbbc9b49>] ? ieee80211_subif_start_xmit+0x369/0x7a0 [mac80211]
        [<c031bc35>] ? ip_output+0x55/0xb0
        [<c02e0188>] ? show_memcpy_count+0x18/0x60
        [<c02eb186>] ? __kfree_skb+0x36/0x90
        [<c02f2202>] ?  binfmt_miscdev_queue_xmit_nit+0xd2/0x110
        [<c02f347b>] ? dev_hard_start_xmit+0x16b/0x1c0
        [<c03058b5>] ? __qdisc_run+0x1b5/0x200
        [<c033bca7>] ?  scoarp_create+0x57/0x2a0
        [<c02f53b7>] ?  bridgedev_queue_xmit+0x2e7/0x3f0
        [<c03034a0>] ? eth_header+0x0/0xc0
        [<c033b95f>]  stp? arp_xmit+0x5f/0x70
        [<c033bf4f>] ? arp_send+0x5f/0x70
        [<c033c8f5>]  bnep? arp_solicit+0x105/0x210
        [<c02fa5aa>] ? neigh_timer_handler+0x19a/0x390
        [<c013bf88>] ? run_timer_softirq+0x138/0x210
        [<c02fa410>] ?  ppdevneigh_timer_handler+0x0/0x390
        [<c02fa410>] ? neigh_timer_handler+0x0/0x390
      Signed-off-by: default avatarVasanthakumar Thiagarajan <vasanth@atheros.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      cbfe89c6
    • Larry Finger's avatar
      b43/b43legacy: fix radio LED initialization · fd4973c5
      Larry Finger authored
      Fix condition in which radio LED did not initialize correctly, and remove
      4 compilation warnings.
      
      After the recent changes in rfkill, the radio LED used by b43/b43legacy
      did not always initialize correctly.
      
      Both b43 and b43legacy used the deprecated variable radio_enabled in
      struct ieee80211_conf.
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      fd4973c5
    • Jiri Slaby's avatar
      Wireless: nl80211, fix lock imbalance · 1f5fc70a
      Jiri Slaby authored
      Don't forget to unlock cfg80211_mutex in one fail path of
      nl80211_set_wiphy.
      Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      1f5fc70a
    • Greg Ungerer's avatar
      fec: fix definition of 5272 version of FEC_X_DES_ACTIVE register · 5ca1ea23
      Greg Ungerer authored
      fec: fix definition of 5272 version of FEC_X_DES_ACTIVE register
      
      The ColdFire 5272 FEC driver has a different register address map
      than other users of the FEC driver. And its definition of the
      FEC_X_DES_ACTIVE register is incorrect, it should be 0x14.
      The fec interface cannot transmit data with the old value.
      Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
      ----
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ca1ea23
    • Greg Ungerer's avatar
      9ff1a91c
  6. 06 Jul, 2009 6 commits
    • David S. Miller's avatar
      0ca1b08e
    • Wei Yongjun's avatar
      sctp: fix warning at inet_sock_destruct() while release sctp socket · 1bc4ee40
      Wei Yongjun authored
      Commit 'net: Move rx skb_orphan call to where needed' broken sctp protocol
      with warning at inet_sock_destruct(). Actually, sctp can do this right with
      sctp_sock_rfree_frag() and sctp_skb_set_owner_r_frag() pair.
      
          sctp_sock_rfree_frag(skb);
          sctp_skb_set_owner_r_frag(skb, newsk);
      
      This patch not revert the commit d55d87fd,
      instead remove the sctp_sock_rfree_frag() function.
      
      ------------[ cut here ]------------
      WARNING: at net/ipv4/af_inet.c:151 inet_sock_destruct+0xe0/0x142()
      Modules linked in: sctp ipv6 dm_mirror dm_region_hash dm_log dm_multipath
      scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd [last unloaded: scsi_wait_scan]
      Pid: 1808, comm: sctp_test Not tainted 2.6.31-rc2 #40
      Call Trace:
       [<c042dd06>] warn_slowpath_common+0x6a/0x81
       [<c064a39a>] ? inet_sock_destruct+0xe0/0x142
       [<c042dd2f>] warn_slowpath_null+0x12/0x15
       [<c064a39a>] inet_sock_destruct+0xe0/0x142
       [<c05fde44>] __sk_free+0x19/0xcc
       [<c05fdf50>] sk_free+0x18/0x1a
       [<ca0d14ad>] sctp_close+0x192/0x1a1 [sctp]
       [<c0649f7f>] inet_release+0x47/0x4d
       [<c05fba4d>] sock_release+0x19/0x5e
       [<c05fbab3>] sock_close+0x21/0x25
       [<c049c31b>] __fput+0xde/0x189
       [<c049c3de>] fput+0x18/0x1a
       [<c049988f>] filp_close+0x56/0x60
       [<c042f422>] put_files_struct+0x5d/0xa1
       [<c042f49f>] exit_files+0x39/0x3d
       [<c043086a>] do_exit+0x1a5/0x5dd
       [<c04a86c2>] ? d_kill+0x35/0x3b
       [<c0438fa4>] ? dequeue_signal+0xa6/0x115
       [<c0430d05>] do_group_exit+0x63/0x8a
       [<c0439504>] get_signal_to_deliver+0x2e1/0x2f9
       [<c0401d9e>] do_notify_resume+0x7c/0x6b5
       [<c043f601>] ? autoremove_wake_function+0x0/0x34
       [<c04a864e>] ? __d_free+0x3d/0x40
       [<c04a867b>] ? d_free+0x2a/0x3c
       [<c049ba7e>] ? vfs_write+0x103/0x117
       [<c05fc8fa>] ? sys_socketcall+0x178/0x182
       [<c0402a56>] work_notifysig+0x13/0x19
      ---[ end trace 9db92c463e789fba ]---
      Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1bc4ee40
    • Mariusz Kozlowski's avatar
      tun/tap: Fix crashes if open() /dev/net/tun and then poll() it. · 3c8a9c63
      Mariusz Kozlowski authored
      Fix NULL pointer dereference in tun_chr_pool() introduced by commit
      33dccbb0 ("tun: Limit amount of queued
      packets per device") and triggered by this code:
      
      	int fd;
      	struct pollfd pfd;
      	fd = open("/dev/net/tun", O_RDWR);
      	pfd.fd = fd;
      	pfd.events = POLLIN | POLLOUT;
      	poll(&pfd, 1, 0);
      Reported-by: default avatarEugene Kapun <abacabadabacaba@gmail.com>
      Signed-off-by: default avatarMariusz Kozlowski <m.kozlowski@tuxland.pl>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c8a9c63
    • Stephane Contri's avatar
      dsa: fix 88e6xxx statistics counter snapshotting · 1ded3f59
      Stephane Contri authored
      The bit that tells us whether a statistics counter snapshot operation
      has completed is located in the GLOBAL register block, not in the
      GLOBAL2 register block, so fix up mv88e6xxx_stats_wait() to poll the
      right register address.
      Signed-off-by: default avatarStephane Contri <Stephane.Contri@grassvalley.com>
      Signed-off-by: default avatarLennert Buytenhek <buytenh@marvell.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ded3f59
    • Eric Dumazet's avatar
      forcedeth: Fix NAPI race. · 78c29bd9
      Eric Dumazet authored
      Eric Dumazet a écrit :
      > Ingo Molnar a écrit :
      >>> The following changes since commit 52989765:
      >>>   Linus Torvalds (1):
      >>>         Merge git://git.kernel.org/.../davem/net-2.6
      
      > >>> are available in the git repository at:
      
      >>>   master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
      >> Hm, something in this lot quickly wrecked networking here - see the
      >> tx timeout dump below. It starts with:
      >>
      >> [  351.004596] WARNING: at net/sched/sch_generic.c:246 dev_watchdog+0x10b/0x19c()
      >> [  351.011815] Hardware name: System Product Name
      >> [  351.016220] NETDEV WATCHDOG: eth0 (forcedeth): transmit queue 0 timed out
      >>
      >> Config attached. Unfortunately i've got no time to do bisection
      >> today.
      >
      >
      >
      > forcedeth might have a problem, in its netif_wake_queue() logic, but
      > I could not see why a recent patch could make this problem visible now.
      >
      > CPU0/1: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ stepping 02
      > is not a new cpu either :)
      >
      > forcedeth uses an internal tx_stop without appropriate barrier.
      >
      > Could you try following patch ?
      >
      > (random guess as I dont have much time right now)
      
      We might have a race in napi_schedule(), leaving interrupts disabled forever.
      I cannot test this patch, I dont have the hardware...
      Tested-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78c29bd9
    • Julia Lawall's avatar
      drivers/net/smsc911x.c: Fix resource size off by 1 error · 39424539
      Julia Lawall authored
      The call resource_size(res) returns res->end - res->start + 1 and thus the
      second change is semantics-preserving.  res_size is then used as the second
      argument of a call to request_mem_region, and the memory allocated by this
      call appears to be the same as what is released in the two calls to
      release_mem_region.  So the size argument for those calls should be
      resource_size(size) as well.  Alternatively, in the second call to
      release_mem_region, the second argument could be res_size, as that variable
      has already been initialized at the point of this call.
      
      The problem was found using the following semantic patch:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @@
      struct resource *res;
      @@
      
      - (res->end - res->start) + 1
      + resource_size(res)
      
      @@
      struct resource *res;
      @@
      
      - res->end - res->start
      + BAD(resource_size(res))
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      39424539