1. 12 Sep, 2020 7 commits
    • Jakub Kicinski's avatar
      net: disable netpoll on fresh napis · 9f313bcb
      Jakub Kicinski authored
      [ Upstream commit 96e97bc0 ]
      
      napi_disable() makes sure to set the NAPI_STATE_NPSVC bit to prevent
      netpoll from accessing rings before init is complete. However, the
      same is not done for fresh napi instances in netif_napi_add(),
      even though we expect NAPI instances to be added as disabled.
      
      This causes crashes during driver reconfiguration (enabling XDP,
      changing the channel count) - if there is any printk() after
      netif_napi_add() but before napi_enable().
      
      To ensure memory ordering is correct we need to use RCU accessors.
      Reported-by: default avatarRob Sherwood <rsher@fb.com>
      Fixes: 2d8bff12 ("netpoll: Close race condition between poll_one_napi and napi_disable")
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f313bcb
    • Tetsuo Handa's avatar
      tipc: fix shutdown() of connectionless socket · 553d1bb7
      Tetsuo Handa authored
      [ Upstream commit 2a63866c ]
      
      syzbot is reporting hung task at nbd_ioctl() [1], for there are two
      problems regarding TIPC's connectionless socket's shutdown() operation.
      
      ----------
      #include <fcntl.h>
      #include <sys/socket.h>
      #include <sys/ioctl.h>
      #include <linux/nbd.h>
      #include <unistd.h>
      
      int main(int argc, char *argv[])
      {
              const int fd = open("/dev/nbd0", 3);
              alarm(5);
              ioctl(fd, NBD_SET_SOCK, socket(PF_TIPC, SOCK_DGRAM, 0));
              ioctl(fd, NBD_DO_IT, 0); /* To be interrupted by SIGALRM. */
              return 0;
      }
      ----------
      
      One problem is that wait_for_completion() from flush_workqueue() from
      nbd_start_device_ioctl() from nbd_ioctl() cannot be completed when
      nbd_start_device_ioctl() received a signal at wait_event_interruptible(),
      for tipc_shutdown() from kernel_sock_shutdown(SHUT_RDWR) from
      nbd_mark_nsock_dead() from sock_shutdown() from nbd_start_device_ioctl()
      is failing to wake up a WQ thread sleeping at wait_woken() from
      tipc_wait_for_rcvmsg() from sock_recvmsg() from sock_xmit() from
      nbd_read_stat() from recv_work() scheduled by nbd_start_device() from
      nbd_start_device_ioctl(). Fix this problem by always invoking
      sk->sk_state_change() (like inet_shutdown() does) when tipc_shutdown() is
      called.
      
      The other problem is that tipc_wait_for_rcvmsg() cannot return when
      tipc_shutdown() is called, for tipc_shutdown() sets sk->sk_shutdown to
      SEND_SHUTDOWN (despite "how" is SHUT_RDWR) while tipc_wait_for_rcvmsg()
      needs sk->sk_shutdown set to RCV_SHUTDOWN or SHUTDOWN_MASK. Fix this
      problem by setting sk->sk_shutdown to SHUTDOWN_MASK (like inet_shutdown()
      does) when the socket is connectionless.
      
      [1] https://syzkaller.appspot.com/bug?id=3fe51d307c1f0a845485cf1798aa059d12bf18b2Reported-by: default avatarsyzbot <syzbot+e36f41d207137b5d12f7@syzkaller.appspotmail.com>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      553d1bb7
    • Xin Long's avatar
      sctp: not disable bh in the whole sctp_get_port_local() · 84cfc878
      Xin Long authored
      [ Upstream commit 3106ecb4 ]
      
      With disabling bh in the whole sctp_get_port_local(), when
      snum == 0 and too many ports have been used, the do-while
      loop will take the cpu for a long time and cause cpu stuck:
      
        [ ] watchdog: BUG: soft lockup - CPU#11 stuck for 22s!
        [ ] RIP: 0010:native_queued_spin_lock_slowpath+0x4de/0x940
        [ ] Call Trace:
        [ ]  _raw_spin_lock+0xc1/0xd0
        [ ]  sctp_get_port_local+0x527/0x650 [sctp]
        [ ]  sctp_do_bind+0x208/0x5e0 [sctp]
        [ ]  sctp_autobind+0x165/0x1e0 [sctp]
        [ ]  sctp_connect_new_asoc+0x355/0x480 [sctp]
        [ ]  __sctp_connect+0x360/0xb10 [sctp]
      
      There's no need to disable bh in the whole function of
      sctp_get_port_local. So fix this cpu stuck by removing
      local_bh_disable() called at the beginning, and using
      spin_lock_bh() instead.
      
      The same thing was actually done for inet_csk_get_port() in
      Commit ea8add2b ("tcp/dccp: better use of ephemeral
      ports in bind()").
      
      Thanks to Marcelo for pointing the buggy code out.
      
      v1->v2:
        - use cond_resched() to yield cpu to other tasks if needed,
          as Eric noticed.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: default avatarYing Xu <yinxu@redhat.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84cfc878
    • Kamil Lorenc's avatar
      net: usb: dm9601: Add USB ID of Keenetic Plus DSL · d2ece46d
      Kamil Lorenc authored
      [ Upstream commit a609d025 ]
      
      Keenetic Plus DSL is a xDSL modem that uses dm9620 as its USB interface.
      Signed-off-by: default avatarKamil Lorenc <kamil@re-ws.pl>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2ece46d
    • Paul Moore's avatar
      netlabel: fix problems with mapping removal · a3a5cb67
      Paul Moore authored
      [ Upstream commit d3b990b7 ]
      
      This patch fixes two main problems seen when removing NetLabel
      mappings: memory leaks and potentially extra audit noise.
      
      The memory leaks are caused by not properly free'ing the mapping's
      address selector struct when free'ing the entire entry as well as
      not properly cleaning up a temporary mapping entry when adding new
      address selectors to an existing entry.  This patch fixes both these
      problems such that kmemleak reports no NetLabel associated leaks
      after running the SELinux test suite.
      
      The potentially extra audit noise was caused by the auditing code in
      netlbl_domhsh_remove_entry() being called regardless of the entry's
      validity.  If another thread had already marked the entry as invalid,
      but not removed/free'd it from the list of mappings, then it was
      possible that an additional mapping removal audit record would be
      generated.  This patch fixes this by returning early from the removal
      function when the entry was previously marked invalid.  This change
      also had the side benefit of improving the code by decreasing the
      indentation level of large chunk of code by one (accounting for most
      of the diffstat).
      
      Fixes: 63c41688 ("netlabel: Add network address selectors to the NetLabel/LSM domain mapping")
      Reported-by: default avatarStephen Smalley <stephen.smalley.work@gmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3a5cb67
    • Jens Axboe's avatar
      block: ensure bdi->io_pages is always initialized · 732fd460
      Jens Axboe authored
      [ Upstream commit de1b0ee4 ]
      
      If a driver leaves the limit settings as the defaults, then we don't
      initialize bdi->io_pages. This means that file systems may need to
      work around bdi->io_pages == 0, which is somewhat messy.
      
      Initialize the default value just like we do for ->ra_pages.
      
      Cc: stable@vger.kernel.org
      Fixes: 9491ae4a ("mm: don't cap request size based on read-ahead setting")
      Reported-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      732fd460
    • Takashi Sakamoto's avatar
      ALSA; firewire-tascam: exclude Tascam FE-8 from detection · 9244e838
      Takashi Sakamoto authored
      Tascam FE-8 is known to support communication by asynchronous transaction
      only. The support can be implemented in userspace application and
      snd-firewire-ctl-services project has the support. However, ALSA
      firewire-tascam driver is bound to the model.
      
      This commit changes device entries so that the model is excluded. In a
      commit 53b3ffee ("ALSA: firewire-tascam: change device probing
      processing"), I addressed to the concern that version field in
      configuration differs depending on installed firmware. However, as long
      as I checked, the version number is fixed. It's safe to return version
      number back to modalias.
      
      Fixes: 53b3ffee ("ALSA: firewire-tascam: change device probing processing")
      Cc: <stable@vger.kernel.org> # 4.4+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20200823075537.56255-1-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9244e838
  2. 09 Sep, 2020 33 commits