Re: [PATCH v3 4/4] bdi: protect bdi->dev with spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2020/3/23 22:04, Greg KH wrote:
On Mon, Mar 23, 2020 at 09:22:54PM +0800, Yufen Yu wrote:
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 82d2401fec37..1c0e2d0d6236 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -525,12 +525,16 @@ static inline const char *bdi_dev_name(struct backing_dev_info *bdi)
  static inline char *bdi_get_dev_name(struct backing_dev_info *bdi,
  			char *dname, int len)
  {
+	spin_lock_irq(&bdi->lock);
  	if (!bdi || !bdi->dev) {
+		spin_unlock_irq(&bdi->lock);

You can't test for (!bdi) right after you accessed bdi->lock :(

Sorry for this coding error.

Thanks,
Yufen



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux