mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugo Lefeuvre <hle@owl.eu.com>
To: valdis.kletnieks@vt.edu
Cc: devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, kernelnewbies@kernelnewbies.org
Subject: Re: [PATCH] staging: pi433: add rw semaphore fixing concurrency issues
Date: Fri, 1 Jun 2018 09:51:21 -0400	[thread overview]
Message-ID: <20180601135121.GA11084@hle-laptop.local> (raw)
In-Reply-To: <255415.1527859942@turing-police.cc.vt.edu>

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

  reply	other threads:[~2018-06-01 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 12:50 Hugo Lefeuvre
2018-06-01 13:32 ` valdis.kletnieks
2018-06-01 13:51   ` Hugo Lefeuvre [this message]
2018-06-01 16:09 ` Greg Kroah-Hartman
2018-06-02 18:08   ` Hugo Lefeuvre

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=20180601135121.GA11084@hle-laptop.local \
    --to=hle@owl.eu.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valdis.kletnieks@vt.edu \
    /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®