1. 15 Aug, 2013 7 commits
    • Amit Shah's avatar
      virtio: console: clean up port data immediately at time of unplug · 9f92fafc
      Amit Shah authored
      commit ea3768b4 upstream.
      
      We used to keep the port's char device structs and the /sys entries
      around till the last reference to the port was dropped.  This is
      actually unnecessary, and resulted in buggy behaviour:
      
      1. Open port in guest
      2. Hot-unplug port
      3. Hot-plug a port with the same 'name' property as the unplugged one
      
      This resulted in hot-plug being unsuccessful, as a port with the same
      name already exists (even though it was unplugged).
      
      This behaviour resulted in a warning message like this one:
      
      -------------------8<---------------------------------------
      WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
      Hardware name: KVM
      sysfs: cannot create duplicate filename
      '/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'
      
      Call Trace:
       [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0
       [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50
       [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130
       [<ffffffff811f23e8>] ? create_dir+0x68/0xb0
       [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50
       [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260
       [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60
       [<ffffffff812734b4>] ? kobject_add+0x44/0x70
       [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0
       [<ffffffff8134b389>] ? device_add+0xc9/0x650
      
      -------------------8<---------------------------------------
      
      Instead of relying on guest applications to release all references to
      the ports, we should go ahead and unregister the port from all the core
      layers.  Any open/read calls on the port will then just return errors,
      and an unplug/plug operation on the host will succeed as expected.
      
      This also caused buggy behaviour in case of the device removal (not just
      a port): when the device was removed (which means all ports on that
      device are removed automatically as well), the ports with active
      users would clean up only when the last references were dropped -- and
      it would be too late then to be referencing char device pointers,
      resulting in oopses:
      
      -------------------8<---------------------------------------
      PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
       #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
       #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
       #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
       #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
       #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
       #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
          [exception RIP: strlen+2]
          RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
          RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
          RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
          RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
          R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
          R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
       #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
       #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
       #9 [ffff88011b9d5de0] device_del at ffffffff813440c7
      
      -------------------8<---------------------------------------
      
      So clean up when we have all the context, and all that's left to do when
      the references to the port have dropped is to free up the port struct
      itself.
      Reported-by: default avatarchayang <chayang@redhat.com>
      Reported-by: default avatarYOGANANTH SUBRAMANIAN <anantyog@in.ibm.com>
      Reported-by: default avatarFuXiangChun <xfu@redhat.com>
      Reported-by: default avatarQunfang Zhang <qzhang@redhat.com>
      Reported-by: default avatarSibiao Luo <sluo@redhat.com>
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f92fafc
    • Amit Shah's avatar
      virtio: console: fix race in port_fops_open() and port unplug · 9c040cbf
      Amit Shah authored
      commit 671bdea2 upstream.
      
      Between open() being called and processed, the port can be unplugged.
      Check if this happened, and bail out.
      
      A simple test script to reproduce this is:
      
      while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done;
      
      This opens and closes the port a lot of times; unplugging the port while
      this is happening triggers the bug.
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c040cbf
    • Amit Shah's avatar
      virtio: console: fix race with port unplug and open/close · d0bfaaca
      Amit Shah authored
      commit 057b82be upstream.
      
      There's a window between find_port_by_devt() returning a port and us
      taking a kref on the port, where the port could get unplugged.  Fix it
      by taking the reference in find_port_by_devt() itself.
      
      Problem reported and analyzed by Mateusz Guzik.
      Reported-by: default avatarMateusz Guzik <mguzik@redhat.com>
      Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0bfaaca
    • Curt Brune's avatar
      hwmon: (adt7470) Fix incorrect return code check · b9ea0ce2
      Curt Brune authored
      commit 93d783bc upstream.
      
      In adt7470_write_word_data(), which writes two bytes using
      i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
      together when they should be OR-ed together.
      
      The return code of i2c_smbus_write_byte_data() is zero for success.
      
      The upshot is only the first byte was ever written to the hardware.
      The 2nd byte was never written out.
      
      I noticed that trying to set the fan speed limits was not working
      correctly on my system.  Setting the fan speed limits is the only
      code that uses adt7470_write_word_data().  After making the change
      the limit settings work and the alarms work also.
      Signed-off-by: default avatarCurt Brune <curt@cumulusnetworks.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b9ea0ce2
    • Theodore Ts'o's avatar
      ext4: make sure group number is bumped after a inode allocation race · b2fea70a
      Theodore Ts'o authored
      commit a34eb503 upstream.
      
      When we try to allocate an inode, and there is a race between two
      CPU's trying to grab the same inode, _and_ this inode is the last free
      inode in the block group, make sure the group number is bumped before
      we continue searching the rest of the block groups.  Otherwise, we end
      up searching the current block group twice, and we end up skipping
      searching the last block group.  So in the unlikely situation where
      almost all of the inodes are allocated, it's possible that we will
      return ENOSPC even though there might be free inodes in that last
      block group.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2fea70a
    • Sumit.Saxena@lsi.com's avatar
      SCSI: megaraid_sas: megaraid_sas driver init fails in kdump kernel · 3b8d21f4
      Sumit.Saxena@lsi.com authored
      commit 6431f5d7 upstream.
      
      Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails
      in kdump kernel with LSI MegaRAID controller(device id-0x73).
      
      Actually this issue needs fix in firmware, but for firmware running in field,
      this driver fix is proposed to resolve the issue.  At firmware initialization
      time, if firmware does not come to ready state, driver will reset the adapter
      and retry for firmware transition to ready state unconditionally(not only
      executed for kdump kernel).
      Signed-off-by: default avatarSumit Saxena <sumit.saxena@lsi.com>
      Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b8d21f4
    • Martin K. Petersen's avatar
      SCSI: Don't attempt to send extended INQUIRY command if skip_vpd_pages is set · 7eee85fd
      Martin K. Petersen authored
      commit 7562523e upstream.
      
      If a device has the skip_vpd_pages flag set we should simply fail the
      scsi_get_vpd_page() call.
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarStuart Foster <smf.linux@ntlworld.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7eee85fd
  2. 12 Aug, 2013 1 commit
  3. 11 Aug, 2013 25 commits
  4. 04 Aug, 2013 7 commits