Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp620212imm; Fri, 1 Jun 2018 06:53:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJRDwOnP3ieLW7FB7nDTSnQ4uwoYaXCwBBvBXtFG3cBkLrmXeR8Oclyw80Xn6jbie0bn4Qu X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr11010298pls.37.1527861222028; Fri, 01 Jun 2018 06:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527861221; cv=none; d=google.com; s=arc-20160816; b=XYdjHV3ZJR8l6Hfv0669X4xCtx7gXj0OpKefSg2zwSIQf3SqkHcZ5p1vke9z9sBAIf TqlXlcyOagfC/bfVTF4jYn3rvqbgiczJkgOSOovOJH7tnLWhK520OQCjoJ90nwRYS52E RCkqnIhNES4RjjlI8Q/X0cZtPfjheLTFPeGBiXggiyMql6jg6RJrH9vyByvCHb6A//0c xy7RSfFEwPcdYDjW3EKcGlTdOCCU8Zv+9HSSN9216cOURYV2zBDDzNoUEYB9nUbYUjyj I9jAhcMq4+3Uz21KGokYL0yAOY4xmPVqs1qBE9AyYJtP8vKwkQARxzlYZipq2ruwhMGj ghTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ERGPWRFa+Krw+7OBugzQJdAofJLtAoPcxOefvLnsdYA=; b=qWS7JPN6IQZ9dgvgx4lVWH79yf/ubZBODuXT2Q0BWgNLXNAgRhsgOnEmJ3DXAtrtv7 VgDj8q/KxplL1TkwHuOTqzuonfYnxgYBs6Eb5brQF2gSCziHzHtnKqpBp2+u/SCyxNYG ZCla8MFuLxpccltbT4xJBkpHSC37tRM2ahy0MP4TN4iiKSyDiXENVmbIUdYz2HRa8/cf jbskEL/4avZKgxG+W0tojCPGeRPfTn9csYA5MkZbWvmblqDLLch9CeC3DArbVfOsWz59 CSqCp6gPPyyiB5Yl3FcrUGk4BEEpbDBcaoKQIpNKmi2aTr9nrLIq7dP2l2ppDCXkOQWF wWPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p18-v6si31380861pgv.493.2018.06.01.06.53.27; Fri, 01 Jun 2018 06:53:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751968AbeFANv3 (ORCPT + 99 others); Fri, 1 Jun 2018 09:51:29 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:44259 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbeFANv0 (ORCPT ); Fri, 1 Jun 2018 09:51:26 -0400 X-Originating-IP: 208.88.110.46 Received: from localhost (mtl.savoirfairelinux.net [208.88.110.46]) (Authenticated sender: hle@owl.eu.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 7CC7F1BF203; Fri, 1 Jun 2018 15:51:31 +0200 (CEST) Date: Fri, 1 Jun 2018 09:51:21 -0400 From: Hugo Lefeuvre To: valdis.kletnieks@vt.edu Cc: devel@driverdev.osuosl.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernelnewbies@kernelnewbies.org Subject: Re: [PATCH] staging: pi433: add rw semaphore fixing concurrency issues Message-ID: <20180601135121.GA11084@hle-laptop.local> References: <20180601125037.GA2339@hle-laptop.local> <255415.1527859942@turing-police.cc.vt.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <255415.1527859942@turing-police.cc.vt.edu> User-Agent: Mutt/1.10.0 (2018-05-17) X-Spam-Level: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Valdis, > > @@ -805,9 +809,11 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) > > if (bytes_received > 0) { > > retval = copy_to_user(buf, device->rx_buffer, bytes_received); > > if (retval) > > + up_read(&instance->instance_sem); > > return -EFAULT; > > } > > > > + up_read(&instance->instance_sem); > > return bytes_received; > > } > > This doesn't do what you think. Oh right, no curly braces, didn't notice it. Thanks ! Otherwise, do you think the usage of rw semaphore is appropriate in this case ? Regards, Hugo -- Hugo Lefeuvre (hle) | www.owl.eu.com 4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA