Re: locking problem in ibmphp_hp.c

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

 



On Sun, 29 Nov 2009 18:01:19 +0200
Dan Carpenter <error27@xxxxxxxxx> wrote:

> There was a potential locking issue found by smatch static checker.
> 
> drivers/pci/hotplug/ibmphp_hpc.c
>    889                          up (&semOperations);
>    890                          msleep(POLL_INTERVAL_SEC * 1000);
>    891
>    892                          if (kthread_should_stop())
>    893                                  break;
> 
> We break here with semOperations released.
> 
>    894
>    895                          down (&semOperations);
>    896
>    897                          if (poll_count >= POLL_LATCH_CNT) {
>    898                                  poll_count = 0;
>    899                                  poll_state = POLL_SLOTS;
>    900                          } else
>    901                                  poll_state =
> POLL_LATCH_REGISTER; 902                          break;
> 
> We break here with semOperations held.
> 
>    903                  }
>    904                  /* give up the hardware semaphore */
> 
> We release semOperations here a second time which may be wrong since
> it was already released.
> 
>    905                  up (&semOperations);

Thanks, I committed what looks like an obvious fix (jump over the up in
the kthread_should_stop() case), but I have no test hardware, so I'll
trust someone will scream if it breaks something.

-- 
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux