public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
  • * [PATCH] Avoid null-pointer access in w1/slaves/w1_therm
           [not found] <CA+1k2cH5Y+RngvEbgE3CW5g+bO3V1ytDJC=u6DLVDZvbEOhu5A@mail.gmail.com>
           [not found] ` <CA+1k2cF1frcEUu-L_cSJxTp=GKExn6Vt2rdCeY=zrhM62FUggw@mail.gmail.com>
    @ 2015-02-27  8:43 ` Thorsten.Bschorr
      2015-02-28 20:17   ` David Fries
      1 sibling, 1 reply; 24+ messages in thread
    From: Thorsten.Bschorr @ 2015-02-27  8:43 UTC (permalink / raw)
      To: linux-kernel; +Cc: Evgeniy Polyakov, David Fries
    
    w1_slave_show unlocks the bus while waiting for the sensor
    to convert the temperature. If the sensor gets disconnected
    during that time, sl->family_data could get NULL.
    Note: the w1_slave pointer inside w1_slave_show is protected by
    sysfs-mutex
    ---
     drivers/w1/slaves/w1_therm.c | 6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
    index 1f11a20..3a14cb1 100644
    --- a/drivers/w1/slaves/w1_therm.c
    +++ b/drivers/w1/slaves/w1_therm.c
    @@ -236,6 +236,12 @@ static ssize_t w1_slave_show(struct device *device,
     				i = mutex_lock_interruptible(&dev->bus_mutex);
     				if (i != 0)
     					return i;
    +
    +				/* Ensure that device is still there -
    +				 * it could have gone while we unlocked the bus.
    +				 * Note: sl is still protected by sysfs-mutex */
    +				if(!sl->family_data)
    +					return -ENODEV;
     			} else if (!w1_strong_pullup) {
     				sleep_rem = msleep_interruptible(tm);
     				if (sleep_rem != 0) {
    -- 
    1.8.4.5
    
    
    ---
    Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
    http://www.avast.com
    
    
    ^ permalink raw reply related	[flat|nested] 24+ messages in thread

  • end of thread, other threads:[~2015-04-17 13:03 UTC | newest]
    
    Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <CA+1k2cH5Y+RngvEbgE3CW5g+bO3V1ytDJC=u6DLVDZvbEOhu5A@mail.gmail.com>
         [not found] ` <CA+1k2cF1frcEUu-L_cSJxTp=GKExn6Vt2rdCeY=zrhM62FUggw@mail.gmail.com>
         [not found]   ` <CA+1k2cEwtY+U7TS3rpmMp5nEBokO8vwhcOiD0ExVQnuoB=XVLQ@mail.gmail.com>
    2015-02-23 17:09     ` Fwd: w1/slaves/w1_therm: null-ptr access of sl->family_data Thorsten Bschorr
    2015-02-24  1:37       ` David Fries
    2015-02-25  9:28         ` Thorsten Bschorr
    2015-02-27  8:43 ` [PATCH] Avoid null-pointer access in w1/slaves/w1_therm Thorsten.Bschorr
    2015-02-28 20:17   ` David Fries
         [not found]     ` <369891425174502@web4m.yandex.ru>
    2015-03-01  2:17       ` David Fries
    2015-03-01 13:04         ` Thorsten Bschorr
    2015-03-02  0:17           ` David Fries
    2015-03-04 15:36             ` Евгений Поляков
    2015-03-08 21:14               ` David Fries
    2015-03-09 22:47                 ` Thorsten Bschorr
    2015-03-09 23:09                   ` David Fries
    2015-03-10  0:05                     ` Thorsten Bschorr
    2015-03-10  0:34                       ` Thorsten Bschorr
    2015-03-12  0:44                         ` David Fries
    2015-03-10 13:52                     ` Evgeniy Polyakov
    2015-03-12  0:54                       ` David Fries
    2015-03-14 20:55                         ` Evgeniy Polyakov
    2015-03-18  4:20                           ` David Fries
    2015-03-18 15:18                             ` Evgeniy Polyakov
    2015-03-19  0:09                               ` David Fries
         [not found]                                 ` <CADq11+-tZmQEVUL=sHC64i4auC_5i=+y2yBcMTaJMdD5Z0dE6w@mail.gmail.com>
    2015-04-16  3:51                                   ` David Fries
    2015-04-16 11:57                                     ` Evgeniy Polyakov
         [not found]                                       ` <CA+1k2cFw+2NTOtbSaJ1S=kBAn2Mj62DTeZo68V9t1Wk-7m7GyA@mail.gmail.com>
    2015-04-17 12:55                                         ` Evgeniy Polyakov
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox