On 2011-05-24 20:00, Boaz Harrosh wrote: > On 05/24/2011 07:52 PM, Benny Halevy wrote: >> On 2011-05-24 18:04, Boaz Harrosh wrote: >>> NULL deref on first ever call. (When device is not found) >>> >>> Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx> >>> --- >>> fs/nfs/pnfs_dev.c | 2 +- >>> 1 files changed, 1 insertions(+), 1 deletions(-) >>> >>> diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c >>> index 7997899..7e5542c 100644 >>> --- a/fs/nfs/pnfs_dev.c >>> +++ b/fs/nfs/pnfs_dev.c >>> @@ -100,7 +100,7 @@ _find_get_deviceid(const struct pnfs_layoutdriver_type *ld, >>> >>> rcu_read_lock(); >>> d = _lookup_deviceid(ld, clp, id, hash); >>> - if (!atomic_inc_not_zero(&d->ref)) >>> + if (!d || !atomic_inc_not_zero(&d->ref)) >> >> This makes more sense, no? >> + if (d && !atomic_inc_not_zero(&d->ref)) >> >> Benny >> >>> d = NULL; > > Sure, since then d is already set to NULL, I guess > Right. >>> rcu_read_unlock(); >>> return d; >> > > Boaz -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html