[PATCH] drivers/dax: Avoiding potential deadlock
dax_dev_huge_fault returning without releasing lock. Making code change to avoid this situation Signed-off-by: Pushkar Jambhlekar --- drivers/dax/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c index 0d1ca24..fd9c4db 100644 --- a/drivers/dax/dax.c +++ b/drivers/dax/dax.c @@ -590,7 +590,7 @@ static int dax_dev_huge_fault(struct vm_fault *vmf, rc = __dax_dev_pud_fault(dax_dev, vmf); break; default: - return VM_FAULT_FALLBACK; + rc = VM_FAULT_FALLBACK; } rcu_read_unlock(); -- 2.7.4
Re: [PATCH] drivers/dax: Avoiding potential deadlock
On Mon, Apr 10, 2017 at 9:45 PM, Pushkar Jambhlekar wrote: > dax_dev_huge_fault returning without releasing lock. Making code change to > avoid this situation > > Signed-off-by: Pushkar Jambhlekar > --- > drivers/dax/dax.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c > index 0d1ca24..fd9c4db 100644 > --- a/drivers/dax/dax.c > +++ b/drivers/dax/dax.c > @@ -590,7 +590,7 @@ static int dax_dev_huge_fault(struct vm_fault *vmf, > rc = __dax_dev_pud_fault(dax_dev, vmf); > break; > default: > - return VM_FAULT_FALLBACK; > + rc = VM_FAULT_FALLBACK; Thanks for the fix! Luckily we never take that branch, but we should fix it so we don't trip over it in some future where there are more fault sizes than pte, pmd, and pud. However, it should be setting rc to VM_FAULT_SIGBUS on an unknown / unsupported fault size.
Re: [PATCH] drivers/dax: Avoiding potential deadlock
Sent out another patch to correct return value. On Tue, Apr 11, 2017 at 10:25 AM, Dan Williams wrote: > On Mon, Apr 10, 2017 at 9:45 PM, Pushkar Jambhlekar > wrote: >> dax_dev_huge_fault returning without releasing lock. Making code change to >> avoid this situation >> >> Signed-off-by: Pushkar Jambhlekar >> --- >> drivers/dax/dax.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c >> index 0d1ca24..fd9c4db 100644 >> --- a/drivers/dax/dax.c >> +++ b/drivers/dax/dax.c >> @@ -590,7 +590,7 @@ static int dax_dev_huge_fault(struct vm_fault *vmf, >> rc = __dax_dev_pud_fault(dax_dev, vmf); >> break; >> default: >> - return VM_FAULT_FALLBACK; >> + rc = VM_FAULT_FALLBACK; > > Thanks for the fix! Luckily we never take that branch, but we should > fix it so we don't trip over it in some future where there are more > fault sizes than pte, pmd, and pud. However, it should be setting rc > to VM_FAULT_SIGBUS on an unknown / unsupported fault size. -- Jambhlekar Pushkar Arun