lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTik5x38mWno0EUGhaHDD_INLlpeaGSExGxjIC4as@mail.gmail.com>
Date:	Sun, 20 Jun 2010 00:42:02 -0700
From:	Suresh Rajashekara <suresh.raj+linuxomap@...il.com>
To:	Jiri Slaby <jirislaby@...il.com>
Cc:	linux-omap@...r.kernel.org, linux-pm@...ts.linux-foundation.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: wait_for_completion_interruptible does not wait !! [During PM 
	suspend]

On Sun, Jun 20, 2010 at 12:23 AM, Jiri Slaby <jirislaby@...il.com> wrote:
> On 06/20/2010 08:52 AM, Suresh Rajashekara wrote:
>> The ioctl waits on a completion variable (using
>> wait_for_completion_interruptible).
> ...
>> I tried wait_for_completion instead, but now the kernel refuses to suspend.
>
> Do you check return value of wait_for_completion_interruptible and
> return its value if nonzero?
>
> We need the code to comment, otherwise it's hard to say.

No. I am not checking the return value of the
wait_for_completion_interruptible. I can do it

The code is as follows. I have cut the relevant portion of the code
and pasted in to the email

My test application. The actual application is exactly similar (actual
application has different names)
<SNIP>
void *headset_detect_thread_start ( void *private_date )
{
    int hs_fd = 0;
    int iState = 0;

    hs_fd = open("/dev/adc", O_RDWR);

    if ( hs_fd == -1 ) {
        printf("The headset device could not be opened\n");
        goto hs_thread_exit;
    }

    for (;;) {
       pthread_testcancel();
       ioctl(hs_fd, IOCTL_CODEC_HEADSET_DETECT, &iState);
       pthread_testcancel();

       if ( iState )
           printf("\n++++ Headset Insertion detected\n");
       else
           printf("\n---- Headset Removal detected\n");

       SignalEvent(); // Dummy function, but the actual application
does inside the function
    }

hs_thread_out:
    close(hs_fd);
hs_thread_exit:
    pthread_exit(NULL);
}
</SNIP>


Kernel Code:

/* Code from Ioctl of the codec driver*/
<SNIP>
 case IOCTL_CODEC_HEADSET_DETECT:
       headset_detect();
       headset_detect_state = get_hsdetect_state();
       copy_to_user( argp, &headset_detect_state, sizeof(int)) ;
       break;
</SNIP>

implementation of headset_detect in the codec driver
<SNIP>
void headset_detect(void){
	/* This variable is completed in interrupt handler */
    wait_for_completion_interruptible(&drv_priv->headset_completion);
}
</SNIP>

Thanks,
Suresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ