From: Evgeniy Polyakov <zbr@ioremap.net>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ldv-project@linuxtesting.org" <ldv-project@linuxtesting.org>
Subject: Re: [PATCH] w1: keep balance of mutex locks and refcnts
Date: Sun, 01 Oct 2017 08:55:09 +0300 [thread overview]
Message-ID: <152531506837309@web6g.yandex.ru> (raw)
In-Reply-To: <1506716604-23455-1-git-send-email-khoroshilov@ispras.ru>
Hi Alex
29.09.2017, 23:23, "Alexey Khoroshilov" <khoroshilov@ispras.ru>:
> w1_therm_eeprom() and w1_DS18B20_precision() decrement THERM_REFCNT
> on error paths, while they did not increment it yet.
>
> read_therm() unlocks bus mutex on some error paths,
> while it is not acquired.
>
> The patch makes sure all the functions keep the balance in usage of
> the mutex and the THERM_REFCNT.
>
> Found by Linux Driver Verification project (linuxtesting.org).
Yes, this looks like a bug, thanks for finding it!
Please update your patch to use single exit point and not a mix of returns in the body of the function.
> ret = mutex_lock_interruptible(&dev->bus_mutex);
> if (ret != 0)
> - goto post_unlock;
> + return ret;
>
> if (!sl->family_data) {
> - ret = -ENODEV;
> - goto pre_unlock;
> + mutex_unlock(&dev->bus_mutex);
> + return -ENODEV;
> }
next prev parent reply other threads:[~2017-10-01 5:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 20:23 Alexey Khoroshilov
2017-10-01 5:55 ` Evgeniy Polyakov [this message]
2017-10-07 17:59 ` Alexey Khoroshilov
2017-10-09 19:13 ` Evgeniy Polyakov
2017-10-21 22:03 ` [PATCH v2] " Alexey Khoroshilov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=152531506837309@web6g.yandex.ru \
--to=zbr@ioremap.net \
--cc=gregkh@linuxfoundation.org \
--cc=khoroshilov@ispras.ru \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®