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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <000001daf822$70840e10$518c2a30$@samsung.com>
Date: Tue, 27 Aug 2024 10:42:55 +0900
From: "Seunghwan Baek" <sh8267.baek@...sung.com>
To: "'Adrian Hunter'" <adrian.hunter@...el.com>,
	<linux-kernel@...r.kernel.org>, <linux-mmc@...r.kernel.org>,
	<ulf.hansson@...aro.org>, <ritesh.list@...il.com>,
	<quic_asutoshd@...cinc.com>
Cc: <grant.jung@...sung.com>, <jt77.jang@...sung.com>,
	<junwoo80.lee@...sung.com>, <dh0421.hwang@...sung.com>,
	<jangsub.yi@...sung.com>, <sh043.lee@...sung.com>, <cw9316.lee@...sung.com>,
	<wkon.kim@...sung.com>, <stable@...r.kernel.org>
Subject: RE: [PATCH 2/2] mmc : fix for check cqe halt.

> The subject starts with "[Patch 2/2]" but is there another patch?
> Did you mean "[Patch v2] ..."?
> 
> > To check if mmc cqe is in halt state, need to check set/clear of
> > CQHCI_HALT bit. At this time, we need to check with &, not &&.
> > Therefore, code to> check whether cqe is in halt state is modified to
> cqhci_halted, which has already been implemented.
> 
> Doesn't compile:
> 
> drivers/mmc/host/cqhci-core.c: In function ‘__cqhci_enable’:
> drivers/mmc/host/cqhci-core.c:285:13: error: implicit declaration of
> function ‘cqhci_halted’; did you mean ‘cqhci_writel’? [-Werror=implicit-
> function-declaration]
>   285 |         if (cqhci_halted(cq_host))
>       |             ^~~~~~~~~~~~
>       |             cqhci_writel
> drivers/mmc/host/cqhci-core.c: At top level:
> drivers/mmc/host/cqhci-core.c:956:13: error: conflicting types for
> ‘cqhci_halted’; have ‘bool(struct cqhci_host *)’ {aka ‘_Bool(struct
> cqhci_host *)’}
>   956 | static bool cqhci_halted(struct cqhci_host *cq_host)
>       |             ^~~~~~~~~~~~
> drivers/mmc/host/cqhci-core.c:285:13: note: previous implicit declaration
> of ‘cqhci_halted’ with type ‘int()’
>   285 |         if (cqhci_halted(cq_host))
>       |             ^~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Not only should it compile, but you must test it!
> 
> Probably better to make 2 patches:
> 1. Just the fix, cc stable i.e.
> 
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index c14d7251d0bb..a02da26a1efd 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -617,7 +617,7 @@ static int cqhci_request(struct mmc_host *mmc, struct
> mmc_request *mrq)
>  		cqhci_writel(cq_host, 0, CQHCI_CTL);
>  		mmc->cqe_on = true;
>  		pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> -		if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) {
> +		if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT) {
>  			pr_err("%s: cqhci: CQE failed to exit halt state\n",
>  			       mmc_hostname(mmc));
>  		}
> 
> 2. Tidy up, no cc stable
> 
> diff --git a/drivers/mmc/host/cqhci-core.c b/drivers/mmc/host/cqhci-core.c
> index a02da26a1efd..178277d90c31 100644
> --- a/drivers/mmc/host/cqhci-core.c
> +++ b/drivers/mmc/host/cqhci-core.c
> @@ -33,6 +33,11 @@ struct cqhci_slot {
>  #define CQHCI_HOST_OTHER	BIT(4)
>  };
> 
> +static bool cqhci_halted(struct cqhci_host *cq_host) {
> +	return cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT; }
> +
>  static inline u8 *get_desc(struct cqhci_host *cq_host, u8 tag)  {
>  	return cq_host->desc_base + (tag * cq_host->slot_sz); @@ -282,7
> +287,7 @@ static void __cqhci_enable(struct cqhci_host *cq_host)
> 
>  	cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
> 
> -	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
> +	if (cqhci_halted(cq_host))
>  		cqhci_writel(cq_host, 0, CQHCI_CTL);
> 
>  	mmc->cqe_on = true;
> @@ -617,7 +622,7 @@ static int cqhci_request(struct mmc_host *mmc, struct
> mmc_request *mrq)
>  		cqhci_writel(cq_host, 0, CQHCI_CTL);
>  		mmc->cqe_on = true;
>  		pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> -		if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT) {
> +		if (cqhci_halted(cq_host)) {
>  			pr_err("%s: cqhci: CQE failed to exit halt state\n",
>  			       mmc_hostname(mmc));
>  		}
> @@ -953,11 +958,6 @@ static bool cqhci_clear_all_tasks(struct mmc_host
> *mmc, unsigned int timeout)
>  	return ret;
>  }
> 
> -static bool cqhci_halted(struct cqhci_host *cq_host) -{
> -	return cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT;
> -}
> -
>  static bool cqhci_halt(struct mmc_host *mmc, unsigned int timeout)  {
>  	struct cqhci_host *cq_host = mmc->cqe_private;
> 
> 
> 
> >
> > Fixes: 0653300224a6 ("mmc: cqhci: rename cqhci.c to cqhci-core.c")
> 
> Fixes tag should be the commit that introduced the code, not one that
> moved it.  In this case, it has been there since the beginning:
> 
> Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled host")
> 
> Looks like the offending code kinda worked which explains why it wasn't
> noticed sooner.
> 
Sorry for my mistake.

I will make the patch again as you advised.

Thank you for your help.

> > Cc: stable@...r.kernel.org
> > Signed-off-by: Seunghwan Baek <sh8267.baek@...sung.com>
> > ---
> >  drivers/mmc/host/cqhci-core.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/cqhci-core.c
> > b/drivers/mmc/host/cqhci-core.c index c14d7251d0bb..3d5bcb92c78e
> > 100644
> > --- a/drivers/mmc/host/cqhci-core.c
> > +++ b/drivers/mmc/host/cqhci-core.c
> > @@ -282,7 +282,7 @@ static void __cqhci_enable(struct cqhci_host
> > *cq_host)
> >
> >  	cqhci_writel(cq_host, cqcfg, CQHCI_CFG);
> >
> > -	if (cqhci_readl(cq_host, CQHCI_CTL) & CQHCI_HALT)
> > +	if (cqhci_halted(cq_host))
> >  		cqhci_writel(cq_host, 0, CQHCI_CTL);
> >
> >  	mmc->cqe_on = true;
> > @@ -617,7 +617,7 @@ static int cqhci_request(struct mmc_host *mmc,
> struct mmc_request *mrq)
> >  		cqhci_writel(cq_host, 0, CQHCI_CTL);
> >  		mmc->cqe_on = true;
> >  		pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> > -		if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) {
> > +		if (cqhci_halted(cq_host)) {
> >  			pr_err("%s: cqhci: CQE failed to exit halt state\n",
> >  			       mmc_hostname(mmc));
> >  		}




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ