* [PATCH] block: add abort on failure
@ 2014-08-08 8:20 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 8:20 UTC (permalink / raw)
To: Joshua Morris, Jeff Moyer; +Cc: kernel-janitors, Philip Kelleher, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Initializing card seems to be critical to the rest of the probe process, so
abort the probe function if the calls to rsxx_load_config and
rsxx_get_num_targets do not succeed.
Suggested by Jeff Moyer.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/block/rsxx/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index a8de2ee..ae2805b 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
/************* Load Card Config *************/
st = rsxx_load_config(card);
- if (st)
+ if (st) {
dev_err(CARD_TO_DEV(card),
"Failed loading card config\n");
+ goto failed_dma_setup;
+ }
/************* Setup DMA Engine *************/
st = rsxx_get_num_targets(card, &card->n_targets);
- if (st)
+ if (st) {
dev_info(CARD_TO_DEV(card),
"Failed reading the number of DMA targets\n");
+ goto failed_dma_setup;
+ }
card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL);
if (!card->ctrl) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] block: add abort on failure
@ 2014-08-08 8:20 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 8:20 UTC (permalink / raw)
To: Joshua Morris, Jeff Moyer; +Cc: kernel-janitors, Philip Kelleher, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Initializing card seems to be critical to the rest of the probe process, so
abort the probe function if the calls to rsxx_load_config and
rsxx_get_num_targets do not succeed.
Suggested by Jeff Moyer.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/block/rsxx/core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index a8de2ee..ae2805b 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
/************* Load Card Config *************/
st = rsxx_load_config(card);
- if (st)
+ if (st) {
dev_err(CARD_TO_DEV(card),
"Failed loading card config\n");
+ goto failed_dma_setup;
+ }
/************* Setup DMA Engine *************/
st = rsxx_get_num_targets(card, &card->n_targets);
- if (st)
+ if (st) {
dev_info(CARD_TO_DEV(card),
"Failed reading the number of DMA targets\n");
+ goto failed_dma_setup;
+ }
card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL);
if (!card->ctrl) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] block: add abort on failure
2014-08-08 8:20 ` Julia Lawall
@ 2014-08-08 9:30 ` Julia Lawall
-1 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 9:30 UTC (permalink / raw)
To: Joshua Morris
Cc: Jeff Moyer, kernel-janitors, Philip Kelleher, dan.carpenter,
linux-kernel
On Fri, 8 Aug 2014, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initializing card seems to be critical to the rest of the probe process, so
> abort the probe function if the calls to rsxx_load_config and
> rsxx_get_num_targets do not succeed.
Note that this is not tested. Nevertheless, at least the first failure
will leave card in an unknown partially initialized state, which seems
undesirable.
julia
> Suggested by Jeff Moyer.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> drivers/block/rsxx/core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> index a8de2ee..ae2805b 100644
> --- a/drivers/block/rsxx/core.c
> +++ b/drivers/block/rsxx/core.c
> @@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
>
> /************* Load Card Config *************/
> st = rsxx_load_config(card);
> - if (st)
> + if (st) {
> dev_err(CARD_TO_DEV(card),
> "Failed loading card config\n");
> + goto failed_dma_setup;
> + }
>
> /************* Setup DMA Engine *************/
> st = rsxx_get_num_targets(card, &card->n_targets);
> - if (st)
> + if (st) {
> dev_info(CARD_TO_DEV(card),
> "Failed reading the number of DMA targets\n");
> + goto failed_dma_setup;
> + }
>
> card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL);
> if (!card->ctrl) {
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: add abort on failure
@ 2014-08-08 9:30 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 9:30 UTC (permalink / raw)
To: Joshua Morris
Cc: Jeff Moyer, kernel-janitors, Philip Kelleher, dan.carpenter,
linux-kernel
On Fri, 8 Aug 2014, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initializing card seems to be critical to the rest of the probe process, so
> abort the probe function if the calls to rsxx_load_config and
> rsxx_get_num_targets do not succeed.
Note that this is not tested. Nevertheless, at least the first failure
will leave card in an unknown partially initialized state, which seems
undesirable.
julia
> Suggested by Jeff Moyer.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> drivers/block/rsxx/core.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> index a8de2ee..ae2805b 100644
> --- a/drivers/block/rsxx/core.c
> +++ b/drivers/block/rsxx/core.c
> @@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
>
> /************* Load Card Config *************/
> st = rsxx_load_config(card);
> - if (st)
> + if (st) {
> dev_err(CARD_TO_DEV(card),
> "Failed loading card config\n");
> + goto failed_dma_setup;
> + }
>
> /************* Setup DMA Engine *************/
> st = rsxx_get_num_targets(card, &card->n_targets);
> - if (st)
> + if (st) {
> dev_info(CARD_TO_DEV(card),
> "Failed reading the number of DMA targets\n");
> + goto failed_dma_setup;
> + }
>
> card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL);
> if (!card->ctrl) {
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: add abort on failure
[not found] ` <OF8E178B75.111E73DE-ON86257D2E.00561BEC-86257D2E.00590C0D@us.ibm.com>
@ 2014-08-08 16:22 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 16:22 UTC (permalink / raw)
To: Josh Morris
Cc: Jeff Moyer, kernel-janitors, Philip Kelleher, dan.carpenter,
linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3450 bytes --]
On Fri, 8 Aug 2014, Josh Morris wrote:
> Howdy Julia,
>
> It is by design that we complete the probe despite failures in
> rsxx_load_config() and rsxx_get_num_targets(). The reason is that we will be
> unable to debug and fix the issue without a driver loaded.
>
> In the case that the on-card config has been corrupted we will need the
> driver loaded to reset or repair the configuration.
>
> I couldn't find a place where we were derefrencing card->ctrl outside of a
> loop that checked the index against n_targets. That should prevent the
> driver from dereferencing an 0 size array. So I believe we still want the
> probe to complete in this case so we can debug the hardware.
OK. I also looked for such a reference and didn't see one.
Thanks for the feedback.
julia
>
> Cheers!
>
> Josh
>
>
>
> From: Julia Lawall <julia.lawall@lip6.fr>
> To: Josh Morris/Houston/IBM@IBMUS,
> Cc: Jeff Moyer <jmoyer@redhat.com>, kernel-janitors@vger.kernel.org,
> Philip Kelleher <pjk1939@linux.vnet.ibm.com>, dan.carpenter@oracle.com,
> linux-kernel@vger.kernel.org
> Date: 08/08/2014 04:31 AM
> Subject: Re: [PATCH] block: add abort on failure
>
> ____________________________________________________________________________
>
>
>
> On Fri, 8 Aug 2014, Julia Lawall wrote:
>
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Initializing card seems to be critical to the rest of the probe process,
> so
> > abort the probe function if the calls to rsxx_load_config and
> > rsxx_get_num_targets do not succeed.
>
> Note that this is not tested. Nevertheless, at least the first failure
> will leave card in an unknown partially initialized state, which seems
> undesirable.
>
> julia
>
>
> > Suggested by Jeff Moyer.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> > drivers/block/rsxx/core.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> > index a8de2ee..ae2805b 100644
> > --- a/drivers/block/rsxx/core.c
> > +++ b/drivers/block/rsxx/core.c
> > @@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
> >
> > /************* Load Card Config *************/
> > st = rsxx_load_config(card);
> > - if (st)
> > + if (st) {
> > dev_err(CARD_TO_DEV(card),
> > "Failed loading card
> config\n");
> > + goto failed_dma_setup;
> > + }
> >
> > /************* Setup DMA Engine *************/
> > st = rsxx_get_num_targets(card, &card->n_targets);
> > - if (st)
> > + if (st) {
> > dev_info(CARD_TO_DEV(card),
> > "Failed reading the
> number of DMA targets\n");
> > + goto failed_dma_setup;
> > + }
> >
> > card->ctrl = kzalloc(card->n_targets *
> sizeof(*card->ctrl), GFP_KERNEL);
> > if (!card->ctrl) {
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: add abort on failure
@ 2014-08-08 16:22 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2014-08-08 16:22 UTC (permalink / raw)
To: Josh Morris
Cc: Jeff Moyer, kernel-janitors, Philip Kelleher, dan.carpenter,
linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3556 bytes --]
On Fri, 8 Aug 2014, Josh Morris wrote:
> Howdy Julia,
>
> It is by design that we complete the probe despite failures in
> rsxx_load_config() and rsxx_get_num_targets(). The reason is that we will be
> unable to debug and fix the issue without a driver loaded.
>
> In the case that the on-card config has been corrupted we will need the
> driver loaded to reset or repair the configuration.
>
> I couldn't find a place where we were derefrencing card->ctrl outside of a
> loop that checked the index against n_targets. That should prevent the
> driver from dereferencing an 0 size array. So I believe we still want the
> probe to complete in this case so we can debug the hardware.
OK. I also looked for such a reference and didn't see one.
Thanks for the feedback.
julia
>
> Cheers!
>
> Josh
>
>
>
> From: Julia Lawall <julia.lawall@lip6.fr>
> To: Josh Morris/Houston/IBM@IBMUS,
> Cc: Jeff Moyer <jmoyer@redhat.com>, kernel-janitors@vger.kernel.org,
> Philip Kelleher <pjk1939@linux.vnet.ibm.com>, dan.carpenter@oracle.com,
> linux-kernel@vger.kernel.org
> Date: 08/08/2014 04:31 AM
> Subject: Re: [PATCH] block: add abort on failure
>
> ____________________________________________________________________________
>
>
>
> On Fri, 8 Aug 2014, Julia Lawall wrote:
>
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Initializing card seems to be critical to the rest of the probe process,
> so
> > abort the probe function if the calls to rsxx_load_config and
> > rsxx_get_num_targets do not succeed.
>
> Note that this is not tested. Nevertheless, at least the first failure
> will leave card in an unknown partially initialized state, which seems
> undesirable.
>
> julia
>
>
> > Suggested by Jeff Moyer.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> > drivers/block/rsxx/core.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
> > index a8de2ee..ae2805b 100644
> > --- a/drivers/block/rsxx/core.c
> > +++ b/drivers/block/rsxx/core.c
> > @@ -915,15 +915,19 @@ static int rsxx_pci_probe(struct pci_dev *dev,
> >
> > /************* Load Card Config *************/
> > st = rsxx_load_config(card);
> > - if (st)
> > + if (st) {
> > dev_err(CARD_TO_DEV(card),
> > "Failed loading card
> config\n");
> > + goto failed_dma_setup;
> > + }
> >
> > /************* Setup DMA Engine *************/
> > st = rsxx_get_num_targets(card, &card->n_targets);
> > - if (st)
> > + if (st) {
> > dev_info(CARD_TO_DEV(card),
> > "Failed reading the
> number of DMA targets\n");
> > + goto failed_dma_setup;
> > + }
> >
> > card->ctrl = kzalloc(card->n_targets *
> sizeof(*card->ctrl), GFP_KERNEL);
> > if (!card->ctrl) {
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors"
> in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-08 16:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 8:20 [PATCH] block: add abort on failure Julia Lawall
2014-08-08 8:20 ` Julia Lawall
2014-08-08 9:30 ` Julia Lawall
2014-08-08 9:30 ` Julia Lawall
[not found] ` <OF8E178B75.111E73DE-ON86257D2E.00561BEC-86257D2E.00590C0D@us.ibm.com>
2014-08-08 16:22 ` Julia Lawall
2014-08-08 16:22 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.