motherofonelovelygirl,
She is just doing the natural exploration of her body. Masturbation is not harmful. However, if you freak out, then she may too. You should explain that it is okay for her to explore her body, but that it is a private thing. You need to explain the boundaries, that it is not proper to do it in front of other people. She is old enough to understand this (a two year old would not be old enough to understand). You might also tell her that if she uses sharp, pointed objects, she might hurt herself. But, it is quite normal for children to use pillows, stuffed toys, the edge of the bed, etc to rub up against.
If you google "childhood masturbation" there are several links to very good sites. The University of Michigan has an excellent article on the subject, with several frequently asked questions. But, there are also many other equally good sites.
Again, she is just exploring her body.