Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757279AbbFBMN1 (ORCPT ); Tue, 2 Jun 2015 08:13:27 -0400 Received: from SpacedOut.fries.net ([67.64.210.234]:53762 "EHLO SpacedOut.fries.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753437AbbFBMNT (ORCPT ); Tue, 2 Jun 2015 08:13:19 -0400 Date: Tue, 2 Jun 2015 07:12:55 -0500 From: David Fries To: Dan Carpenter Cc: Evgeniy Polyakov , Matt Campbell , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [patch 2/2] w1: unlock correct lock on error in w1_seq_show() Message-ID: <20150602121255.GA20149@spacedout.fries.net> References: <20150601095632.GB897@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150601095632.GB897@mwanda> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.5.11 (SpacedOut.fries.net [127.0.0.1]); Tue, 02 Jun 2015 07:12:58 -0500 (CDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1417 Lines: 37 Thanks for including me, I'm going to have to nack this though, it is an error, but bus_mutex is correct, mutex is incorrect, so the other two lock/unlock in that routine are the ones that need to be changed. w1.h * @mutex: protect most of w1_master * @bus_mutex: pretect concurrent bus access On Mon, Jun 01, 2015 at 12:56:32PM +0300, Dan Carpenter wrote: > Smatch complains that we don't unlock "master->mutex" on this error > path. It looks like it is a typo and we unlock ->bus_mutext where > ->mutex was intended. > > Fixes: d9411e57dc7f ('w1: Add support for DS28EA00 sequence to w1-therm') > Signed-off-by: Dan Carpenter > > diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c > index 3351be6..79ecaf8 100644 > --- a/drivers/w1/slaves/w1_therm.c > +++ b/drivers/w1/slaves/w1_therm.c > @@ -412,7 +412,7 @@ static ssize_t w1_seq_show(struct device *device, > c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); > return PAGE_SIZE - c; > error: > - mutex_unlock(&sl->master->bus_mutex); > + mutex_unlock(&sl->master->mutex); > return -EIO; > } > -- David Fries -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/